Repository navigation
61 lines (50 loc) · 1.67 KB
/
Copy pathcoverage.yml
File metadata and controls
61 lines (50 loc) · 1.67 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
# Code coverage workflow for pull requests and main branch
# Runs test coverage with cargo-llvm-cov and uploads results to Codecov
name: Coverage
permissions:
contents: read
on:
pull_request:
paths-ignore:
- 'webdocs/**'
- 'website/**'
push:
branches: [main]
paths-ignore:
- 'webdocs/**'
- 'website/**'
jobs:
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
- name: Install LLVM coverage tools
run: rustup component add llvm-tools-preview
- name: Install cargo-llvm-cov
run: cargo install cargo-llvm-cov --locked
- name: Install cargo-nextest
run: cargo install cargo-nextest --locked
- name: Run tests with coverage
env:
NEXTEST_THREADS: "2"
run: cargo llvm-cov nextest --all-features -E 'not test(install_e2e_tests)' --no-report
- name: Generate coverage reports
run: |
cargo llvm-cov report --lcov --output-path lcov.info
cargo llvm-cov report --json --summary-only --output-path coverage-summary.json
- name: Enforce modified Rust file coverage
if: github.event_name == 'pull_request'
run: >-
python3 scripts/check-modified-rust-coverage.py
"${{ github.event.pull_request.base.sha }}"
coverage-summary.json
90
- name: Upload to Codecov
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
with:
files: lcov.info
fail_ci_if_error: false