refactor: cleanup main #150
This file contains 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
# This is the main CI workflow that runs the test suite on all pull requests. | |
# It runs the following inside a Nix development shell and ubuntu-22.04 runner: | |
# - a debug build | |
# - with code coverage enabled | |
# - using the GCC compiler | |
# - on amd64 and aarch64 architectures | |
# - and runs the test suite (e2e, unit, approval) | |
permissions: | |
contents: read | |
on: | |
schedule: | |
# run on midnight every day | |
- cron: '0 0 * * *' | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
name: test | |
jobs: | |
test: | |
runs-on: ${{ matrix.runs-on }} | |
name: ${{ matrix.compiler }} / ${{ matrix.runs-on }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# run on stable and beta to ensure that tests won't break on the next version of the rust | |
# toolchain | |
compiler: [ gcc ] | |
runs-on: [ buildjet-4vcpu-ubuntu-2204, buildjet-4vcpu-ubuntu-2204-arm ] | |
steps: | |
- name: checkout source | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: extractions/setup-just@v1 | |
- uses: cachix/install-nix-action@v26 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
github_access_token: ${{ secrets.GH_TOKEN }} | |
- name: fix git config | |
run: | | |
git config --global --unset http.proxy | |
git config --global --unset https.proxy | |
- name: Build and run tests | |
run: nix develop --command bash -c "cmake -S . -B ./build -DCODE_COVERAGE:BOOL=ON -DCMAKE_BUILD_TYPE:STRING=Debug --log-context && cmake --build ./build --parallel 4 && ctest --test-dir ./build/test --parallel --output-on-failure" | |
- name: Gather code coverage | |
if: ${{ matrix.runs-on == 'buildjet-4vcpu-ubuntu-2204' }} | |
run: nix develop --command bash -c "cd build && gcovr -j 1 --delete --root ../ --print-summary --xml-pretty --xml coverage.xml . --gcov-executable gcov --gcov-ignore-parse-errors=negative_hits.warn_once_per_file" | |
- name: Upload coverage reports to Codecov | |
if: ${{ matrix.runs-on == 'buildjet-4vcpu-ubuntu-2204' }} | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
slug: dasch-swiss/sipi |