-
Notifications
You must be signed in to change notification settings - Fork 72
60 lines (50 loc) · 1.43 KB
/
cover.yml
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
name: Coverage
on:
push:
branches: "main"
pull_request:
branches: "main"
jobs:
coverage:
name: Collect
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
statuses: write
steps:
- uses: actions/checkout@v4
- run: |
sudo apt-get install protobuf-compiler
- name: Install grcov
run: |
cargo install --locked grcov
grcov --version
- name: Tests
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "target/coverage/%p-%m.profraw"
run: |
sudo -E $(command -v cargo) test --all-features
# Fix permissions after sudo.
sudo chown -R $(whoami) target/coverage/
- name: Collect coverage data
run: |
grcov . \
--source-dir . \
--binary-path ./target/debug/ \
--branch \
--ignore-not-existing \
--output-types markdown,lcov \
--keep-only 'crates/*' \
--output-path ./target/coverage/
- name: Upload coverage data
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
files: ./target/coverage/lcov
verbose: true
- name: Publish job summary
run: |
echo "# Coverage" >> $GITHUB_STEP_SUMMARY
cat target/coverage/markdown.md >> $GITHUB_STEP_SUMMARY