name: CMake on: push: branches: [ master ] pull_request: branches: [ master ] workflow_dispatch: env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: Release defaults: run: shell: bash jobs: build-ubuntu: strategy: matrix: os: [ ubuntu-22.04, ubuntu-24.04 ] compiler: [ g++-9, g++-10, clang++ ] name: Build and Test on Ubuntu runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v4 - name: Setup g++-9 if not exists if: matrix.compiler == 'g++-9' run: which g++-9 || (sudo apt-get update && sudo apt-get -y install g++-9) - name: Setup g++10 if not exists if: matrix.compiler == 'g++-10' run: which g++10 || (sudo apt-get update && sudo apt-get -y install g++-10) - name: Configure CMake run: cmake -S "${{github.workspace}}" -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_COMPILER=${{matrix.compiler}} - name: Build run: cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE - name: Test working-directory: ${{github.workspace}}/build/test run: ctest -C $BUILD_TYPE --output-on-failure build-macos: name: Build and Test on MacOS strategy: matrix: os: [macos-latest] runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v4 - name: Configure CMake run: cmake -S "${{github.workspace}}" -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - name: Show compile commands run: cat build/compile_commands.json - name: Build run: cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE - name: Test working-directory: ${{github.workspace}}/build/test shell: bash run: ctest -C $BUILD_TYPE --output-on-failure build-windows: name: Build and Test on Windows runs-on: windows-latest steps: - uses: actions/checkout@v4 - uses: ilammy/msvc-dev-cmd@v1 - name: Configure CMake run: cmake -S "${{github.workspace}}" -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -T "ClangCl" - name: Build run: cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE - name: Test working-directory: ${{github.workspace}}/build/test run: cd $BUILD_TYPE && ./link_test && ./options_test