-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (76 loc) · 2.46 KB
/
coverage.yml
File metadata and controls
91 lines (76 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Coverage
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Rust cache
uses: swatinem/rust-cache@v2
- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
env:
JARVY_TEST_MODE: 1
JARVY_FAST_TEST: 1
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: false
verbose: true
- name: Generate HTML report
run: cargo llvm-cov --all-features --workspace --html
env:
JARVY_TEST_MODE: 1
JARVY_FAST_TEST: 1
- name: Upload HTML coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: target/llvm-cov/html/
retention-days: 7
coverage-check:
name: Coverage Threshold Check
runs-on: ubuntu-latest
needs: coverage
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Rust cache
uses: swatinem/rust-cache@v2
- name: Check coverage threshold (80%)
run: |
COVERAGE=$(cargo llvm-cov --all-features --workspace --json 2>/dev/null | jq -r '.data[0].totals.lines.percent // 0')
echo "Current coverage: ${COVERAGE}%"
if (( $(echo "$COVERAGE < 50" | bc -l) )); then
echo "::warning::Coverage is below 50% (${COVERAGE}%). Target is 80%."
fi
# Note: Threshold enforcement will be enabled once coverage improves
# if (( $(echo "$COVERAGE < 80" | bc -l) )); then
# echo "::error::Coverage ${COVERAGE}% is below required 80% threshold"
# exit 1
# fi
env:
JARVY_TEST_MODE: 1
JARVY_FAST_TEST: 1