-
Notifications
You must be signed in to change notification settings - Fork 3
65 lines (55 loc) · 1.52 KB
/
test.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
61
62
63
64
65
name: Test coverage
on:
push:
branches: [ "*" ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
toolchain:
- stable
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: llvm-tools-preview
- name: Install Protoc
run: sudo apt-get install -y protobuf-compiler
- name: Activate cache
uses: Swatinem/[email protected]
- name: Install grcov
uses: taiki-e/install-action@v2
with:
tool: grcov
- name: Build crate
run: cargo build --verbose --all-targets
env:
RUSTFLAGS: "-Cinstrument-coverage"
- name: Test crate
run: cargo test --verbose
env:
LLVM_PROFILE_FILE: "target/coverage/prof/%p-%m.profraw"
RUSTFLAGS: "-Cinstrument-coverage"
- name: Create coverage report
run: |
grcov \
--source-dir . \
--binary-path target/debug \
--branch \
--excl-start 'mod tests \{' \
--ignore 'tests/*' \
-t lcov \
-o lcov.info \
target/coverage/prof
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: lcov.info
fail_ci_if_error: false