Skip to content

Commit c622095

Browse files
committed
Add code coverage job to CI
1 parent d781d04 commit c622095

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

.github/workflows/matroska.yml

+46
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,52 @@ jobs:
2727
clippy_flags: --all-targets -- -D warnings
2828
reporter: github-pr-review
2929

30+
code-coverage:
31+
32+
runs-on: ubuntu-latest
33+
34+
steps:
35+
- uses: actions/checkout@v3
36+
37+
- name: Install Rust stable
38+
uses: dtolnay/rust-toolchain@stable
39+
with:
40+
toolchain: stable
41+
42+
- name: Install grcov
43+
env:
44+
GRCOV_LINK: https://github.com/mozilla/grcov/releases/download
45+
GRCOV_VERSION: v0.8.13
46+
run: |
47+
curl -L "$GRCOV_LINK/$GRCOV_VERSION/grcov-x86_64-unknown-linux-musl.tar.bz2" |
48+
tar xj -C $HOME/.cargo/bin
49+
50+
- name: Install llvm-tools-preview
51+
run: |
52+
rustup component add llvm-tools-preview
53+
54+
# Not necessary on a newly created image, but strictly advised
55+
- name: Run cargo clean
56+
run: |
57+
cargo clean
58+
59+
- name: Run tests
60+
env:
61+
RUSTFLAGS: "-Cinstrument-coverage"
62+
LLVM_PROFILE_FILE: "matroska-%p-%m.profraw"
63+
run: |
64+
cargo test --all-features --verbose
65+
66+
- name: Get coverage data for codecov
67+
run: |
68+
grcov . --binary-path ./target/debug/ -s . -t lcov --branch \
69+
--ignore-not-existing --ignore "/*" --ignore "../*" -o lcov.info
70+
71+
- name: Codecov upload
72+
uses: codecov/codecov-action@v3
73+
with:
74+
files: lcov.info
75+
3076
tests:
3177
strategy:
3278
matrix:

0 commit comments

Comments
 (0)