Skip to content

Use containers for compilers #12

Use containers for compilers

Use containers for compilers #12

Workflow file for this run

name: CMake
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
name: Build ${{ matrix.build_type }} using ${{ matrix.toolchain.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build_type: [ Debug, RelWithDebInfo ]
toolchain:
- { name: gcc-14, c_compiler: gcc, cxx_compiler: g++, version: "14", image: "gcc:14" }
- { name: gcc-15, c_compiler: gcc, cxx_compiler: g++, version: "15", image: "gcc:15" }
- { name: clang-19, c_compiler: clang-19, cxx_compiler: clang++-19, version: "19", image: "ghcr.io/silkeh/clang:19" }
- { name: clang-20, c_compiler: clang-20, cxx_compiler: clang++-20, version: "20", image: "ghcr.io/silkeh/clang:20" }
container:
image: ${{ matrix.toolchain.image }}
steps:
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
apt-get update
apt-get install -y --no-install-recommends curl git tar
curl -L https://github.com/Kitware/CMake/releases/download/v3.30.4/cmake-3.30.4-linux-x86_64.tar.gz \
-o cmake.tar.gz
mkdir -p $HOME/cmake
tar -xzf cmake.tar.gz --strip-components=1 -C $HOME/cmake
echo "$HOME/cmake/bin" >> $GITHUB_PATH
- name: Configure CMake
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_C_COMPILER=${{ matrix.toolchain.c_compiler }} \
-DCMAKE_CXX_COMPILER=${{ matrix.toolchain.cxx_compiler }} \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DSIMPLY_INSTALL_PRE_COMMIT_HOOKS=OFF \
-S .
- name: Build
run: cmake --build build --config ${{ matrix.build_type }}
- name: Test
working-directory: build
run: ctest --build-config ${{ matrix.build_type }}