Update CompilerFlags.cmake #35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ master ] | |
| paths: | |
| - '**/*.cpp' | |
| - '**/*.hpp' | |
| - 'cmake/**' | |
| - 'CMakeLists.txt' | |
| - 'CMakePresets.json' | |
| - '.github/workflows/ci.yml' | |
| workflow_dispatch: | |
| jobs: | |
| build-and-test: | |
| name: ${{ matrix.compiler }}-${{ matrix.build_type }} on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest] | |
| compiler: [gcc, clang] | |
| build_type: [Sanitize, Release] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: { fetch-depth: 0 } | |
| - name: Install CMake | |
| uses: lukka/get-cmake@latest | |
| - name: Install build tools | |
| run: sudo apt update && sudo apt install -y clang lld gcc g++ ccache ninja-build | |
| - name: Restore ccache | |
| uses: actions/cache@v3 | |
| with: | |
| path: ${{ github.workspace }}/.ccache | |
| key: ${{ runner.os }}-ccache-${{ matrix.compiler }}-${{ matrix.build_type }} | |
| - name: Restore build directory | |
| uses: actions/cache@v3 | |
| with: | |
| path: build/${{ matrix.compiler }}-${{ matrix.build_type }} | |
| key: ${{ runner.os }}-ccache-${{ matrix.compiler }}-${{ matrix.build_type }} | |
| - name: Configure with CMake Preset | |
| env: | |
| CCACHE_DIR: ${{ github.workspace }}/.ccache | |
| CMAKE_C_COMPILER_LAUNCHER: ccache | |
| CMAKE_CXX_COMPILER_LAUNCHER: ccache | |
| run: cmake --preset ${{ matrix.compiler }}-${{ matrix.build_type }} | |
| - name: Build (Ninja) | |
| run: cmake --build --preset ${{ matrix.compiler }}-${{ matrix.build_type }} | |
| - name: Run tests (ctest) | |
| run: ctest --preset ${{ matrix.compiler }}-${{ matrix.build_type }} | |
| # not sure if next steps are required | |
| - name: Save ccache | |
| uses: actions/cache@v3 | |
| with: | |
| path: ${{ github.workspace }}/.ccache | |
| key: ${{ runner.os }}-ccache-${{ matrix.compiler }}-${{ matrix.build_type }} | |
| - name: Save build directory | |
| uses: actions/cache@v3 | |
| with: | |
| path: build/${{ matrix.compiler }}-${{ matrix.build_type }} | |
| key: ${{ runner.os }}-ccache-${{ matrix.compiler }}-${{ matrix.build_type }} |