Skip to content

Commit a240bdb

Browse files
committed
ci: add code coverage workflow
1 parent 338857f commit a240bdb

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Code Coverage
2+
3+
on: [push, pull_request]
4+
5+
permissions: {}
6+
7+
jobs:
8+
Codecov:
9+
name: Code Coverage
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
with:
15+
persist-credentials: false
16+
- name: Install lcov tools
17+
run: sudo apt-get install lcov -y
18+
- name: Install Rust toolchain
19+
uses: dtolnay/rust-toolchain@v1
20+
with:
21+
toolchain: nightly
22+
components: llvm-tools-preview
23+
- name: Rust Cache
24+
uses: Swatinem/rust-cache@v2
25+
- name: Install cargo-llvm-cov
26+
run: if [[ ! -e ~/.cargo/bin/cargo-llvm-cov ]]; then cargo install cargo-llvm-cov; fi
27+
- name: Make coverage directory
28+
run: mkdir coverage
29+
- name: Test and report coverage
30+
run: cargo +nightly llvm-cov -q --doctests --branch --all --ignore-filename-regex "(example*)" --all-features --lcov --output-path ./coverage/lcov.info
31+
- name: Generate HTML coverage report
32+
run: genhtml -o coverage-report.html --ignore-errors unmapped ./coverage/lcov.info
33+
- name: Coveralls upload
34+
uses: coverallsapp/github-action@master
35+
with:
36+
github-token: ${{ secrets.GITHUB_TOKEN }}
37+
- name: Upload artifact
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: coverage-report
41+
path: coverage-report.html

0 commit comments

Comments
 (0)