ci: add test coverage reporting with codecov (#3848)

This commit is contained in:
Denis Cornehl 2022-04-09 02:20:24 +02:00 committed by GitHub
parent 21dfe7f2fc
commit e61394a97a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 1 deletions

11
.codecov.yml Normal file
View File

@ -0,0 +1,11 @@
comment: false
coverage:
status:
project:
default:
target: auto
threshold: 5%
patch:
default:
target: auto
threshold: 5%

View File

@ -177,9 +177,13 @@ jobs:
uses: actions-rs/toolchain@v1.0.7 uses: actions-rs/toolchain@v1.0.7
with: with:
toolchain: ${{ matrix.rust }} toolchain: ${{ matrix.rust }}
components: llvm-tools-preview
profile: minimal profile: minimal
override: true override: true
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
# Install Mercurial (pre-installed on Linux and windows) # Install Mercurial (pre-installed on Linux and windows)
- name: Setup | Mercurial (macos) - name: Setup | Mercurial (macos)
if: matrix.os == 'macOS-latest' if: matrix.os == 'macOS-latest'
@ -187,7 +191,18 @@ jobs:
# Run the ignored tests that expect the above setup # Run the ignored tests that expect the above setup
- name: Build | Test - name: Build | Test
run: cargo test --workspace --locked --all-features -- -Z unstable-options --include-ignored run: "cargo llvm-cov
--all-features
--locked
--workspace
--lcov --output-path lcov.info
-- --include-ignored"
env: env:
# Avoid -D warnings on nightly builds # Avoid -D warnings on nightly builds
RUSTFLAGS: "" RUSTFLAGS: ""
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: lcov.info
fail_ci_if_error: true