added code coverage in CI

This commit is contained in:
Giuliano Bellini s294739 2024-02-11 21:35:50 +01:00
parent c8071cbe1a
commit bcdad1141e

View file

@ -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 }}