Skip to content

Commit fe22eb0

Browse files
Use containers for compilers
1 parent ef13fb3 commit fe22eb0

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

.github/workflows/cmake.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,46 +8,46 @@ on:
88

99
jobs:
1010
build:
11-
name: Build with ${{ matrix.compiler.c }}-${{ matrix.compiler.version }} in ${{ matrix.build_type }}
11+
name: Build ${{ matrix.build_type }} using ${{ matrix.toolchain.name }}
1212

1313
runs-on: ubuntu-latest
1414

1515
strategy:
1616
fail-fast: false
1717

1818
matrix:
19-
build_type: [ Debug ]
20-
compiler:
21-
- { c: gcc, cxx: g++, version: "14" }
22-
# - { c: gcc, cxx: g++, version: "15" } # Only available on Ubuntu 25.04 "Plucky"
23-
- { c: clang, cxx: clang++, version: "19" }
24-
- { c: clang, cxx: clang++, version: "20" }
19+
build_type: [ Debug, RelWithDebInfo ]
20+
toolchain:
21+
- { name: gcc-14, c_compiler: gcc, cxx_compiler: g++, version: "14", image: "gcc:14" }
22+
- { name: gcc-15, c_compiler: gcc, cxx_compiler: g++, version: "15", image: "gcc:15" }
23+
- { name: clang-19, c_compiler: clang-19, cxx_compiler: clang++-19, version: "19", image: "ghcr.io/silkeh/clang:19" }
24+
- { name: clang-20, c_compiler: clang-20, cxx_compiler: clang++-20, version: "20", image: "ghcr.io/silkeh/clang:20" }
25+
26+
container:
27+
image: ${{ matrix.toolchain.image }}
2528

2629
steps:
2730
- uses: actions/checkout@v4
2831

29-
- name: Install ${{ matrix.compiler.c }}-${{ matrix.compiler.version }}
32+
- name: Install Dependencies
3033
run: |
31-
if [[ "${{ matrix.compiler.c }}" == "gcc" ]]; then
32-
PACKAGES="gcc-${{ matrix.compiler.version }} g++-${{ matrix.compiler.version }}"
33-
elif [[ "${{ matrix.compiler.c }}" == "clang" ]]; then
34-
CODENAME=$(lsb_release -sc)
35-
PACKAGES=clang-${{ matrix.compiler.version }}
36-
wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/llvm.gpg > /dev/null
37-
sudo add-apt-repository "deb http://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${{ matrix.compiler.version }} main"
38-
fi
39-
sudo apt-get update
40-
sudo apt-get install -y --no-install-recommends ${PACKAGES}
34+
apt-get update
35+
apt-get install -y --no-install-recommends curl git tar
36+
curl -L https://github.com/Kitware/CMake/releases/download/v3.30.4/cmake-3.30.4-linux-x86_64.tar.gz \
37+
-o cmake.tar.gz
38+
mkdir -p $HOME/cmake
39+
tar -xzf cmake.tar.gz --strip-components=1 -C $HOME/cmake
40+
echo "$HOME/cmake/bin" >> $GITHUB_PATH
4141
4242
- name: Configure CMake
4343
run: |
4444
cmake -B build \
4545
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
46-
-DCMAKE_C_COMPILER=${{ matrix.compiler.c }}-${{ matrix.compiler.version }} \
47-
-DCMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }}-${{ matrix.compiler.version }} \
46+
-DCMAKE_C_COMPILER=${{ matrix.toolchain.c_compiler }} \
47+
-DCMAKE_CXX_COMPILER=${{ matrix.toolchain.cxx_compiler }} \
4848
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
4949
-DSIMPLY_INSTALL_PRE_COMMIT_HOOKS=OFF \
50-
-S ${{ github.workspace }}
50+
-S .
5151
5252
- name: Build
5353
run: cmake --build build --config ${{ matrix.build_type }}

0 commit comments

Comments
 (0)