Code Coverage Workflow #438
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
name: Code Coverage Workflow | |
on: | |
push: | |
branches: | |
- main | |
- release-* | |
schedule: | |
- cron: "0 1 * * 1" | |
workflow_dispatch: | |
jobs: | |
code-coverage: | |
runs-on: ubuntu-latest | |
timeout-minutes: 120 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Install Nix | |
uses: cachix/install-nix-action@V28 | |
- name: Enable Cachix | |
uses: cachix/cachix-action@v15 | |
# If PR is from a non-collaborator (e.g. dependabot) the secrets are missing and the login to cachix fails. | |
continue-on-error: true | |
with: | |
name: espresso-systems-private | |
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | |
extraPullNames: nix-community | |
skipPush: ${{ github.actor == 'dependabot[bot]' }} | |
- name: Cache cargo | |
uses: actions/cache@v4.0.2 | |
with: | |
path: | | |
~/.cargo/registry/index | |
~/.cargo/registry/cache | |
~/.cargo/git | |
target | |
key: hotshot-query-service-codecov-v1-${{ hashFiles('Cargo.lock') }} | |
- name: Generate coverage reports | |
run: | | |
git config --global --add safe.directory "$PWD" | |
nix run "github:NixOS/nix?ref=1849e6a1f64734c488c2b1469249d65ce08cef93" -- develop .#perfShell -c cargo llvm-cov --profile=release --all-features --all-targets --lcov --output-path lcov.info -- --test-threads 1 | |
- name: Coveralls upload | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: lcov.info | |
fail_ci_if_error: true |