From e61394a97a47221b244cd5213a323ed0afccb962 Mon Sep 17 00:00:00 2001 From: Denis Cornehl Date: Sat, 9 Apr 2022 02:20:24 +0200 Subject: [PATCH] ci: add test coverage reporting with codecov (#3848) --- .codecov.yml | 11 +++++++++++ .github/workflows/workflow.yml | 17 ++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 000000000..4266a7e4c --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,11 @@ +comment: false +coverage: + status: + project: + default: + target: auto + threshold: 5% + patch: + default: + target: auto + threshold: 5% diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 8fc7c77db..5def187af 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -177,9 +177,13 @@ jobs: uses: actions-rs/toolchain@v1.0.7 with: toolchain: ${{ matrix.rust }} + components: llvm-tools-preview profile: minimal override: true + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + # Install Mercurial (pre-installed on Linux and windows) - name: Setup | Mercurial (macos) if: matrix.os == 'macOS-latest' @@ -187,7 +191,18 @@ jobs: # Run the ignored tests that expect the above setup - 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: # Avoid -D warnings on nightly builds RUSTFLAGS: "" + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + files: lcov.info + fail_ci_if_error: true