Skip to content

Commit

Permalink
ci: LLVM support
Browse files Browse the repository at this point in the history
Update CI scripts to also build the tests with various versions of
LLVM. Versions below 17 can't be installed with the official llvm.sh
script, so for now let's test only 17+.

Signed-off-by: Ihor Solodrai <[email protected]>
  • Loading branch information
theihor authored and anakryiko committed Feb 20, 2025
1 parent a5e2c3e commit d1f4677
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 16 deletions.
18 changes: 11 additions & 7 deletions .github/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

set -euo pipefail

GCC_VERSION=${GCC_VERSION:-13}
SHARED=${SHARED:-0}

export CC=gcc-${GCC_VERSION}
export CXX=g++-${GCC_VERSION}
export AR=gcc-ar-${GCC_VERSION}
if [ "$COMPILER" == "llvm" ]; then
export CC="clang-${COMPILER_VERSION}"
export CXX="clang++-${COMPILER_VERSION}"
export AR="llvm-ar-${COMPILER_VERSION}"
export LD="lld-${COMPILER_VERSION}"
elif [ "$COMPILER" == "gcc" ]; then
export CC="gcc-${COMPILER_VERSION}"
export CXX="g++-${COMPILER_VERSION}"
export AR="gcc-ar-${COMPILER_VERSION}"
fi

make -C tests clean
make SHARED=${SHARED} -C tests -j$(nproc) build
make SHARED=${SHARED:-0} -C tests -j$(nproc) build
15 changes: 11 additions & 4 deletions .github/scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,22 @@ set -euo pipefail
# Assume sudo in this script
GITHUB_WORKSPACE=${GITHUB_WORKSPACE:-$(pwd)}
BPFTRACE_VERSION=${BPFTRACE_VERSION:-0.22.1}
GCC_VERSION=${GCC_VERSION:-13}
COMPILER=${COMPILER:-gcc}
COMPILER_VERSION=${COMPILER_VERSION:-13}

# Install pre-requisites
export DEBIAN_FRONTEND=noninteractive
apt-get update -y
apt-get install -y curl file gawk libfuse2t64 make sudo
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
apt-get install -y curl file gawk gnupg libfuse2t64 lsb-release make software-properties-common sudo wget

# Install CC
apt-get install -y gcc-${GCC_VERSION} g++-${GCC_VERSION}
if [ "$COMPILER" == "llvm" ]; then
curl -O https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
./llvm.sh ${COMPILER_VERSION}
else
apt-get install -y gcc-${COMPILER_VERSION} g++-${COMPILER_VERSION}
fi

${GITHUB_WORKSPACE}/.github/scripts/install-bpftrace.sh

21 changes: 16 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,28 @@ on:
jobs:
build-and-test:

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
gcc-version: [ 10, 11, 12, 13, 14 ]
runs-on: [ 'ubuntu-latest' ]
shared: [ 0, 1 ]
compiler:
- { name: 'gcc', version: 11 }
- { name: 'gcc', version: 12 }
- { name: 'gcc', version: 13 }
- { name: 'gcc', version: 14 }
- { name: 'llvm', version: 17 }
- { name: 'llvm', version: 18 }
- { name: 'llvm', version: 19 }

runs-on: ${{ matrix.runs-on }}

name: gcc-${{ matrix.gcc-version }} SHARED=${{ matrix.shared }}
name: ${{ endsWith(matrix.runs-on, '-arm') && 'arm64' || 'x86_64' }} SHARED=${{ matrix.shared }} ${{ matrix.compiler.name }}-${{ matrix.compiler.version }}

env:
GCC_VERSION: ${{ matrix.gcc-version }}
ARCH: ${{ endsWith(matrix.runs-on, '-arm') && 'arm64' || 'x86_64' }}
COMPILER: ${{ matrix.compiler.name }}
COMPILER_VERSION: ${{ matrix.compiler.version }}
SHARED: ${{ matrix.shared }}

steps:
Expand Down

0 comments on commit d1f4677

Please sign in to comment.