Skip to content

Commit d1f4677

Browse files
theihoranakryiko
authored andcommitted
ci: LLVM support
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 <ihor.solodrai@linux.dev>
1 parent a5e2c3e commit d1f4677

File tree

3 files changed

+38
-16
lines changed

3 files changed

+38
-16
lines changed

.github/scripts/build.sh

+11-7
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33
set -euo pipefail
44

5-
GCC_VERSION=${GCC_VERSION:-13}
6-
SHARED=${SHARED:-0}
7-
8-
export CC=gcc-${GCC_VERSION}
9-
export CXX=g++-${GCC_VERSION}
10-
export AR=gcc-ar-${GCC_VERSION}
5+
if [ "$COMPILER" == "llvm" ]; then
6+
export CC="clang-${COMPILER_VERSION}"
7+
export CXX="clang++-${COMPILER_VERSION}"
8+
export AR="llvm-ar-${COMPILER_VERSION}"
9+
export LD="lld-${COMPILER_VERSION}"
10+
elif [ "$COMPILER" == "gcc" ]; then
11+
export CC="gcc-${COMPILER_VERSION}"
12+
export CXX="g++-${COMPILER_VERSION}"
13+
export AR="gcc-ar-${COMPILER_VERSION}"
14+
fi
1115

1216
make -C tests clean
13-
make SHARED=${SHARED} -C tests -j$(nproc) build
17+
make SHARED=${SHARED:-0} -C tests -j$(nproc) build

.github/scripts/setup.sh

+11-4
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,22 @@ set -euo pipefail
55
# Assume sudo in this script
66
GITHUB_WORKSPACE=${GITHUB_WORKSPACE:-$(pwd)}
77
BPFTRACE_VERSION=${BPFTRACE_VERSION:-0.22.1}
8-
GCC_VERSION=${GCC_VERSION:-13}
8+
COMPILER=${COMPILER:-gcc}
9+
COMPILER_VERSION=${COMPILER_VERSION:-13}
910

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

1516
# Install CC
16-
apt-get install -y gcc-${GCC_VERSION} g++-${GCC_VERSION}
17+
if [ "$COMPILER" == "llvm" ]; then
18+
curl -O https://apt.llvm.org/llvm.sh
19+
chmod +x llvm.sh
20+
./llvm.sh ${COMPILER_VERSION}
21+
else
22+
apt-get install -y gcc-${COMPILER_VERSION} g++-${COMPILER_VERSION}
23+
fi
1724

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

.github/workflows/test.yml

+16-5
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,28 @@ on:
99
jobs:
1010
build-and-test:
1111

12-
runs-on: ubuntu-latest
13-
1412
strategy:
13+
fail-fast: false
1514
matrix:
16-
gcc-version: [ 10, 11, 12, 13, 14 ]
15+
runs-on: [ 'ubuntu-latest' ]
1716
shared: [ 0, 1 ]
17+
compiler:
18+
- { name: 'gcc', version: 11 }
19+
- { name: 'gcc', version: 12 }
20+
- { name: 'gcc', version: 13 }
21+
- { name: 'gcc', version: 14 }
22+
- { name: 'llvm', version: 17 }
23+
- { name: 'llvm', version: 18 }
24+
- { name: 'llvm', version: 19 }
25+
26+
runs-on: ${{ matrix.runs-on }}
1827

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

2130
env:
22-
GCC_VERSION: ${{ matrix.gcc-version }}
31+
ARCH: ${{ endsWith(matrix.runs-on, '-arm') && 'arm64' || 'x86_64' }}
32+
COMPILER: ${{ matrix.compiler.name }}
33+
COMPILER_VERSION: ${{ matrix.compiler.version }}
2334
SHARED: ${{ matrix.shared }}
2435

2536
steps:

0 commit comments

Comments
 (0)