Skip to content

Commit

Permalink
measure and fail coverage with cargo-llvm-cov
Browse files Browse the repository at this point in the history
  • Loading branch information
mxfactorial committed Nov 4, 2023
1 parent 5d68baa commit 253c28a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 16 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/dev-crates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ jobs:
test:
name: crates
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:develop-nightly
options: --security-opt seccomp=unconfined
env:
CI: true
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
Expand All @@ -28,6 +23,16 @@ jobs:
cargo fmt -- --check
cargo clippy -- -Dwarnings
working-directory: crates/types
- name: crates/types unit tests and coverage report
run: cargo tarpaulin --fail-under 95
working-directory: crates/types
- name: install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: crates/types unit tests
run: cargo test
working-directory: crates/types
- name: crates/types coverage report
run: make rust-coverage RUST_PKG=types
- name: fail crates/types coverage under 97%
run: |
if [[ $(make rust-coverage-percent RUST_PKG=types) -lt 97 ]]; then
echo 'coverage dropped below 97%'
exit 1
fi
26 changes: 18 additions & 8 deletions .github/workflows/dev-rule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ on:
push:
paths:
- 'services/rule/**'
- 'crates/**'
branches-ignore:
- 'master'
workflow_run:
workflows: [dev-crates]
types:
- completed

jobs:
test:
name: rule
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:develop-nightly
options: --security-opt seccomp=unconfined
env:
CI: true
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
Expand All @@ -28,5 +26,17 @@ jobs:
run: |
cargo fmt -- --check
cargo clippy -- -Dwarnings
- name: unit tests and coverage
run: cargo tarpaulin
working-directory: services/rule
- name: install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: services/rule unit tests
run: cargo test
working-directory: services/rule
- name: services/rule coverage report
run: make rust-coverage RUST_PKG=rule
- name: fail services/rule coverage under 66%
run: |
if [[ $(make rust-coverage-percent RUST_PKG=rule) -lt 66 ]]; then
echo 'coverage dropped below 66%'
exit 1
fi

0 comments on commit 253c28a

Please sign in to comment.