name: CI on: push: branches: [ "main" ] pull_request: branches: [ "main" ] jobs: build: runs-on: ${{ matrix.platform.os }} strategy: fail-fast: false matrix: build_configuration: [debug, release, sanitizers] platform: - { os: ubuntu-latest, compiler: gcc } - { os: ubuntu-latest, compiler: clang } - { os: macos-latest, compiler: appleclang } - { os: windows-latest, compiler: msvc } steps: - name: checkout uses: actions/checkout@v3 - name: Set up Python for CMake installation uses: actions/setup-python@v5 with: python-version: '3.12' - name: Install CMake 4.x run: python -m pip install "cmake>=4.0,<5" - name: Set up MSVC developer environment if: runner.os == 'Windows' uses: ilammy/msvc-dev-cmd@v1 - name: Install Ninja on Linux if: runner.os == 'Linux' run: sudo apt-get update && sudo apt-get install -y ninja-build - name: Install Ninja on macOS if: runner.os == 'macOS' run: brew list ninja >/dev/null 2>&1 || brew install ninja - name: cache uses: actions/cache@v3 with: path: build/${{ matrix.platform.compiler }}-${{ matrix.build_configuration }}/_deps key: ${{ runner.os }}-${{ matrix.platform.compiler }}-${{ matrix.build_configuration }}-${{ github.workflow }}-fetchcontent-${{ hashFiles('CMakePresets.json', '**/CMakeLists.txt', '**/*.cmake') }} - name: Configure CMake run: cmake --preset ${{ matrix.platform.compiler }}-${{ matrix.build_configuration }} - name: Build run: cmake --build --preset ${{ matrix.platform.compiler }}-${{ matrix.build_configuration }} --parallel 2 - name: Test run: ctest --preset ${{ matrix.platform.compiler }}-${{ matrix.build_configuration }}