Dockerize CI to pin compiler dependencies and fix coverage pipeline #91
Workflow file for this run
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
| # modified version of: | |
| # https://gist.github.com/NickNaso/0d478f1481686d5bcc868cac06620a60 | |
| name: CI | |
| on: | |
| push: | |
| pull_request: | |
| release: | |
| schedule: | |
| - cron: '0 0 * * 1' # Every Monday at midnight UTC | |
| jobs: | |
| build-linux: | |
| name: ${{ matrix.config.name }} | |
| runs-on: ubuntu-latest | |
| container: ghcr.io/mitchellthompkins/gcem/ci:eb24b0547d0f | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - { | |
| name: "gcc12_cxx11", | |
| build_type: "Release", | |
| cc: "gcc-12", | |
| cxx: "g++-12", | |
| cxxstd: "11" | |
| } | |
| - { | |
| name: "gcc12_cxx11_coverage", | |
| build_type: "Coverage", | |
| cc: "gcc-12", | |
| cxx: "g++-12", | |
| cxxstd: "11" | |
| } | |
| - { | |
| name: "gcc9_cxx14", | |
| build_type: "Release", | |
| cc: "gcc-9", | |
| cxx: "g++-9", | |
| cxxstd: "14" | |
| } | |
| - { | |
| name: "gcc10_cxx14", | |
| build_type: "Release", | |
| cc: "gcc-10", | |
| cxx: "g++-10", | |
| cxxstd: "14" | |
| } | |
| - { | |
| name: "gcc11_cxx17", | |
| build_type: "Release", | |
| cc: "gcc-11", | |
| cxx: "g++-11", | |
| cxxstd: "17" | |
| } | |
| - { | |
| name: "gcc11_cxx20", | |
| build_type: "Release", | |
| cc: "gcc-11", | |
| cxx: "g++-11", | |
| cxxstd: "20" | |
| } | |
| - { | |
| name: "clang11_cxx11", | |
| build_type: "Release", | |
| cc: "clang-11", | |
| cxx: "clang++-11", | |
| cxxstd: "11" | |
| } | |
| - { | |
| name: "clang11_cxx14", | |
| build_type: "Release", | |
| cc: "clang-11", | |
| cxx: "clang++-11", | |
| cxxstd: "14" | |
| } | |
| - { | |
| name: "clang12_cxx14", | |
| build_type: "Release", | |
| cc: "clang-12", | |
| cxx: "clang++-12", | |
| cxxstd: "14" | |
| } | |
| - { | |
| name: "clang13_cxx17", | |
| build_type: "Release", | |
| cc: "clang-13", | |
| cxx: "clang++-13", | |
| cxxstd: "17" | |
| } | |
| - { | |
| name: "clang14_cxx20", | |
| build_type: "Release", | |
| cc: "clang-14", | |
| cxx: "clang++-14", | |
| cxxstd: "20" | |
| } | |
| - { | |
| name: "gcc13_cxx23", | |
| build_type: "Release", | |
| cc: "gcc-13", | |
| cxx: "g++-13", | |
| cxxstd: "23" | |
| } | |
| - { | |
| name: "clang16_cxx23", | |
| build_type: "Release", | |
| cc: "clang-16", | |
| cxx: "clang++-16", | |
| cxxstd: "2b" | |
| } | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # actions/checkout@v6.0.3 | |
| - name: Print env | |
| run: | | |
| echo github.event.action: ${{ github.event.action }} | |
| echo github.event_name: ${{ github.event_name }} | |
| - name: Tests | |
| shell: bash | |
| working-directory: tests | |
| run: | | |
| export CC=${{ matrix.config.cc }} | |
| export CXX=${{ matrix.config.cxx }} | |
| export GCEM_CXX_STD="-std=c++${{ matrix.config.cxxstd }}" | |
| export COVERAGE=${{ matrix.config.build_type == 'Coverage' && '1' || '' }} | |
| make | |
| ./run_tests | |
| - name: Coverage | |
| if: matrix.config.build_type == 'Coverage' | |
| shell: bash | |
| working-directory: tests | |
| run: | | |
| CC="${{ matrix.config.cc }}" | |
| lcov --gcov-tool "${CC/gcc/gcov}" --directory . --capture --output-file coverage.info | |
| - name: Upload coverage to Codecov | |
| if: matrix.config.build_type == 'Coverage' | |
| uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # codecov/codecov-action@v7 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: true | |
| name: gcem | |
| files: ${{ github.workspace }}/tests/coverage.info | |
| verbose: true | |
| build-macos: | |
| name: macos_latest_clang_cxx${{ matrix.cxxstd }} | |
| runs-on: macos-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| cxxstd: ["11", "14", "17", "20", "23"] | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # actions/checkout@v6.0.3 | |
| - name: Print env | |
| run: | | |
| echo github.event.action: ${{ github.event.action }} | |
| echo github.event_name: ${{ github.event_name }} | |
| - name: Tests | |
| shell: bash | |
| working-directory: tests | |
| run: | | |
| export CC=clang | |
| export CXX=clang++ | |
| export GCEM_CXX_STD="-std=c++${{ matrix.cxxstd }}" | |
| make clean | |
| make | |
| ./run_tests |