diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 23da715..274d182 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -1,24 +1,37 @@ name: Build and Test + on: [push, pull_request] + jobs: build: runs-on: ubuntu-latest + strategy: - matrix: {compiler: [gcc, clang], build_type: [Release, Debug]} + matrix: + compiler: [g++, clang++] + build_type: [Debug] + steps: - uses: actions/checkout@v4 - - name: Install deps - run: sudo apt-get update && sudo apt-get install -y build-essential cmake - - name: Configure - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + + - name: Install latest CMake + run: | + wget https://github.com/Kitware/CMake/releases/download/v4.2.0/cmake-4.2.0-linux-x86_64.sh + chmod +x cmake-4.2.0-linux-x86_64.sh + sudo ./cmake-4.2.0-linux-x86_64.sh --skip-license --prefix=/usr/local + + - name: Configure with sanitizers + run: | + SAN="-fsanitize=address,undefined -fno-omit-frame-pointer" + cmake -S . -B build \ + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ + -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} \ + -DCMAKE_C_FLAGS="$SAN" \ + -DCMAKE_CXX_FLAGS="$SAN" + - name: Build run: cmake --build build -j + - name: Run tests - run: ctest --output-on-failure -C ${{ matrix.build_type }} -V - sanitize: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer" - - run: cmake --build build -j - - run: ctest --output-on-failure -C Debug -V + working-directory: build + run: ctest --output-on-failure -V