From a2013c31e94c3ae1723b34f47ec8bb2b40224119 Mon Sep 17 00:00:00 2001 From: Joe Grund Date: Tue, 7 May 2024 14:00:28 -0400 Subject: [PATCH] Add coverage Signed-off-by: Joe Grund --- .github/workflows/rust.yml | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index dfd2984..7530351 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -12,7 +12,7 @@ jobs: name: Check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: toolchain: stable @@ -26,7 +26,7 @@ jobs: name: Test Suite runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: toolchain: stable @@ -39,7 +39,7 @@ jobs: name: Rustfmt runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: toolchain: stable @@ -54,7 +54,7 @@ jobs: name: Clippy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: toolchain: stable @@ -63,3 +63,29 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} args: --locked -- -D warnings -D clippy::unwrap_used + + coverage: + name: coverage + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + + - name: Install `cargo-llvm-cov` + uses: taiki-e/install-action@cargo-llvm-cov + + - name: Measure code coverage for all tests + run: | + # Fail if any tests fail + set -e + set -o pipefail + cargo llvm-cov --all-features --workspace --codecov --output-path codecov.json + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: codecov.json + fail_ci_if_error: true