Skip to content

Coverage

Coverage #287

Workflow file for this run

name: Coverage
on:
schedule:
- cron: "0 0 * * 1"
push:
branches:
- main
- release-*
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
COVERAGE_RUSTFLAGS: >
-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort
-Zpanic_abort_tests -Cdebuginfo=2 --cfg async_executor_impl="async-std" --cfg async_channel_impl="async-std" --cfg
hotshot_example
COVERAGE_RUSTDOCFLAGS: >
-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort
-Zpanic_abort_tests
CARGO_TEST_CMD: >
cargo +nightly test --locked --all-features --no-fail-fast --release --workspace --exclude contract-bindings
--exclude gen-vk-contract --exclude hotshot-contract-adapter --exclude diff-test-hotshot
jobs:
code-coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- uses: dtolnay/rust-toolchain@nightly
- name: Enable Rust Caching
uses: Swatinem/rust-cache@v2
# Separate build step for easier identification of failures and timings.
- name: Build tests for coverage
run: |
$CARGO_TEST_CMD --no-run
env:
# Do not exceed the memory limit of the public github runner during cargo build.
CARGO_BUILD_JOBS: "2"
CARGO_INCREMENTAL: "0"
RUSTFLAGS: ${{ env.COVERAGE_RUSTFLAGS }}
RUSTDOCFLAGS: ${{ env.COVERAGE_RUSTDOCFLAGS }}
- name: Run tests with coverage
run: |
$CARGO_TEST_CMD -- --skip service::test::test_
env:
CARGO_INCREMENTAL: "0"
RUSTFLAGS: ${{ env.COVERAGE_RUSTFLAGS }}
RUSTDOCFLAGS: ${{ env.COVERAGE_RUSTDOCFLAGS }}
- uses: alekitto/[email protected]
with:
config: .github/grcov.yml
id: coverage
- name: Coveralls upload
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ steps.coverage.outputs.report }}