From bcdad1141e46cd2cf39d00de964d01bbe8005b69 Mon Sep 17 00:00:00 2001 From: Giuliano Bellini s294739 Date: Sun, 11 Feb 2024 21:35:50 +0100 Subject: [PATCH] added code coverage in CI --- .github/workflows/rust.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d4f179c7..10ad0e63 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -11,6 +11,8 @@ on: secrets: NPCAP_OEM_URL: required: true + CODECOV_TOKEN: + required: true env: CARGO_TERM_COLOR: always @@ -50,12 +52,31 @@ jobs: - name: fmt run: cargo fmt --all -- --check + - name: build if: matrix.os != 'windows' || github.event_name != 'pull_request' run: cargo build --verbose + - name: clippy if: matrix.os != 'windows' || github.event_name != 'pull_request' run: cargo clippy -- -D warnings + - name: test if: matrix.os != 'windows' || github.event_name != 'pull_request' run: cargo test --verbose -- --nocapture + + - name: Install cargo-llvm-cov + if: matrix.os == 'ubuntu' + uses: taiki-e/install-action@cargo-llvm-cov + + - name: Generate code coverage + if: matrix.os == 'ubuntu' + run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info + + - name: Upload coverage to Codecov + if: matrix.os == 'ubuntu' + uses: codecov/codecov-action@v4 + with: + files: lcov.info + fail_ci_if_error: false + token: ${{ secrets.CODECOV_TOKEN }}