Do not run CI twice for branches with an open pull request #448
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 Builds | |
| # Only master on push: branches are covered by the pull_request event, which | |
| # additionally tests the result of merging into master. Running on every push | |
| # would build a branch with an open pull request twice. | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| jobs: | |
| builds: | |
| name: ${{ matrix.config.name }} | |
| runs-on: ${{ matrix.config.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - name: "Windows 2025 (x64)" | |
| os: windows-2025 | |
| - name: "Ubuntu 24.04 (x64)" | |
| os: ubuntu-24.04 | |
| - name: "Ubuntu 24.04 (arm64)" | |
| os: ubuntu-24.04-arm | |
| - name: "macOS 15 (arm64)" | |
| os: macos-15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install Conan | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install conan | |
| conan --version | |
| conan profile detect | |
| - name: "Build: compiled, shared, boost" | |
| run: conan create CDT/ -o as_compiled_library=True -o shared=True -o use_boost=True -o enable_testing=True --build missing | |
| - name: "Build: compiled, shared, without boost" | |
| run: conan create CDT/ -o as_compiled_library=True -o shared=True -o use_boost=False -o enable_testing=True | |
| - name: "Build: compiled, static, boost" | |
| run: conan create CDT/ -o as_compiled_library=True -o use_boost=True -o enable_testing=True --build missing | |
| - name: "Build: compiled, static, without boost" | |
| run: conan create CDT/ -o as_compiled_library=True -o use_boost=False -o enable_testing=True | |
| - name: "Build: header-only, boost" | |
| run: conan create CDT/ -o use_boost=True -o enable_testing=True --build missing | |
| - name: "Build: header-only, without boost, with callbacks" | |
| run: conan create CDT/ -o use_boost=False -o enable_testing=True -o enable_callback_handler=True | |
| standards: | |
| name: "C++${{ matrix.std }} (${{ matrix.cxx }})" | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # oldest supported standard: Boost stands in for the c++11 features | |
| - std: 98 | |
| cxx: g++-13 | |
| boost: "ON" | |
| - std: 11 | |
| cxx: g++-13 | |
| boost: "OFF" | |
| - std: 14 | |
| cxx: g++-13 | |
| boost: "OFF" | |
| - std: 17 | |
| cxx: g++-13 | |
| boost: "OFF" | |
| - std: 20 | |
| cxx: g++-13 | |
| boost: "OFF" | |
| - std: 23 | |
| cxx: g++-13 | |
| boost: "OFF" | |
| # newest standard: g++-13 does not know -std=c++26 | |
| - std: 26 | |
| cxx: g++-14 | |
| boost: "OFF" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install compiler | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ${{ matrix.cxx }} | |
| - name: Install Conan and fetch Boost | |
| if: matrix.boost == 'ON' | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install conan | |
| conan profile detect | |
| conan install --requires=boost/1.83.0 -o "boost/*:header_only=True" \ | |
| -g CMakeDeps --output-folder=boost-dep --build=missing | |
| - name: "Header-only: build and run" | |
| run: | | |
| cmake -S CDT -B build-header-only \ | |
| -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \ | |
| -DCMAKE_CXX_STANDARD=${{ matrix.std }} \ | |
| -DCMAKE_CXX_STANDARD_REQUIRED=ON \ | |
| -DCMAKE_PREFIX_PATH="$PWD/boost-dep" \ | |
| -DCDT_USE_BOOST=${{ matrix.boost }} \ | |
| -DCDT_ENABLE_STANDARDS_CHECK=ON \ | |
| -DCMAKE_BUILD_TYPE=Release | |
| cmake --build build-header-only -j | |
| ./build-header-only/CDT-standards-check | |
| - name: "Compiled library: build and run" | |
| run: | | |
| cmake -S CDT -B build-compiled \ | |
| -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \ | |
| -DCMAKE_CXX_STANDARD=${{ matrix.std }} \ | |
| -DCMAKE_CXX_STANDARD_REQUIRED=ON \ | |
| -DCMAKE_PREFIX_PATH="$PWD/boost-dep" \ | |
| -DCDT_USE_BOOST=${{ matrix.boost }} \ | |
| -DCDT_USE_AS_COMPILED_LIBRARY=ON \ | |
| -DCDT_ENABLE_STANDARDS_CHECK=ON \ | |
| -DCMAKE_BUILD_TYPE=Release | |
| cmake --build build-compiled -j | |
| ./build-compiled/CDT-standards-check |