ci: add test-coverage job #69
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 | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| merge_group: | |
| branches: | |
| - master | |
| concurrency: | |
| group: ${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| permissions: | |
| contents: read | |
| # Ensure scripts are run with pipefail. See: | |
| # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference | |
| # (note: does not have effect on the commands run inside devcontainer) | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| format: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Pull Devcontainer | |
| uses: ./.github/workflows/composite/run-in-devcontainer | |
| with: { run: uv sync --no-group build } | |
| - name: Check code formatting | |
| uses: ./.github/workflows/composite/run-in-devcontainer | |
| with: | |
| run: | | |
| uv run inv check.format \ | |
| --jobs $(nproc) | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| toolchain: [clang, gcc] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Pull Devcontainer | |
| uses: ./.github/workflows/composite/run-in-devcontainer | |
| with: { run: uv sync } | |
| - name: Build tests | |
| uses: ./.github/workflows/composite/run-in-devcontainer | |
| with: | |
| run: | | |
| uv run inv test --sanitizers \ | |
| --toolchain ${{ matrix.toolchain }} \ | |
| --jobs $(nproc) --cmake-jobs $(nproc) --no-run | |
| - name: Run tests | |
| uses: ./.github/workflows/composite/run-in-devcontainer | |
| timeout-minutes: 5 # TODO: check why it's hanging occasionally | |
| with: | |
| run: | | |
| uv run inv test --sanitizers \ | |
| --toolchain ${{ matrix.toolchain }} \ | |
| --jobs $(nproc) --skip-build | |
| test-coverage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Pull Devcontainer | |
| uses: ./.github/workflows/composite/run-in-devcontainer | |
| with: { run: uv sync } | |
| - name: Build tests | |
| uses: ./.github/workflows/composite/run-in-devcontainer | |
| with: | |
| run: | | |
| uv run inv test --coverage \ | |
| --toolchain clang \ | |
| --jobs $(nproc) --cmake-jobs $(nproc) --no-run | |
| - name: Run tests | |
| uses: ./.github/workflows/composite/run-in-devcontainer | |
| timeout-minutes: 5 # TODO: check why it's hanging occasionally | |
| with: | |
| run: | | |
| uv run inv test --coverage --report-coverage \ | |
| --toolchain clang \ | |
| --jobs $(nproc) --skip-build | |
| - name: Upload coverage | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: coverage-report | |
| path: out/coverage/ | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Pull Devcontainer | |
| uses: ./.github/workflows/composite/run-in-devcontainer | |
| with: { run: uv sync } | |
| - name: Build Vanadium tools | |
| uses: ./.github/workflows/composite/run-in-devcontainer | |
| with: | |
| run: | | |
| uv run inv build --target vanadium_tools --release \ | |
| --cmake-jobs $(nproc) | |
| - name: Install Vanadium tools | |
| uses: ./.github/workflows/composite/run-in-devcontainer | |
| with: | |
| run: | | |
| mkdir out/install | |
| uv run inv build.install --dir out/install --release | |
| - name: Strip binaries | |
| uses: ./.github/workflows/composite/run-in-devcontainer | |
| with: | |
| run: | | |
| ./scripts/strip_binaries.sh out/install out/symbols | |
| - name: Upload tools | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: release | |
| path: out/install/ | |
| - name: Upload symbols | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: release-symbols | |
| path: out/symbols/ |