| 1 | name: CMake |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | pull_request: |
| 6 | |
| 7 | env: |
| 8 | # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) |
| 9 | BUILD_TYPE: Release |
| 10 | |
| 11 | jobs: |
| 12 | build: |
| 13 | # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. |
| 14 | # You can convert this to a matrix build if you need cross-platform coverage. |
| 15 | # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix |
| 16 | runs-on: ${{ matrix.os }} |
| 17 | strategy: |
| 18 | matrix: |
| 19 | os: [ |
| 20 | ubuntu-22.04, |
| 21 | ubuntu-latest, |
| 22 | macos-14, |
| 23 | macos-latest, |
| 24 | macos-26, |
| 25 | windows-2022, |
| 26 | windows-latest, |
| 27 | ] |
| 28 | cpp_version: [11, 14, 17, 20] |
| 29 | |
| 30 | steps: |
| 31 | - name: Check out repository code |
| 32 | uses: actions/checkout@v6 |
| 33 | |
| 34 | - name: Configure CMake |
| 35 | # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. |
| 36 | # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type |
| 37 | # run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} |
| 38 | run: cmake -B ${{github.workspace}}/build -DBUILD_TESTING=ON -DCMAKE_CXX_STANDARD=${{matrix.cpp_version}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} |
| 39 | |
| 40 | - name: Build |
| 41 | # Build your program with the given configuration |
| 42 | # run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} |
| 43 | run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} |
| 44 | |
| 45 | - name: Test |
| 46 | working-directory: ${{github.workspace}}/build |
| 47 | # Execute tests defined by the CMake configuration. |
| 48 | # See https://cmake.org/help/latest/manual/ctest.1.html for more detail |
| 49 | run: ctest -C ${{env.BUILD_TYPE}} --verbose |
| 50 |