-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (52 loc) · 1.69 KB
/
coverage.yaml
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
name: Code coverage report
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- rel-v*
env:
CARGO_TERM_COLOR: always
jobs:
codecov:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup for testing
run: |
mkdir grcov
curl -sL https://github.com/mozilla/grcov/releases/latest/download/grcov-x86_64-unknown-linux-gnu.tar.bz2 | (cd grcov ; tar jxf -)
rustup toolchain add nightly --component llvm-tools-preview
rustup override set nightly
- uses: Swatinem/rust-cache@v2
- uses: nolar/setup-k3d-k3s@v1
with:
version: latest
k3d-name: kube
github-token: ${{ secrets.GITHUB_TOKEN }}
k3d-args: "--no-lb --no-rollback --k3s-arg --disable=traefik,servicelb,metrics-server@server:*"
- name: Test
env:
CI: true
RUSTFLAGS: -Cinstrument-coverage
LLVM_PROFILE_FILE: kube-lease-manager-%p-%m.profraw
RUST_LOG: kube_lease_manager=debug
run: cargo test --all -- --include-ignored
- name: Generate coverage
run: |
grcov/grcov $(find . -name "kube-lease-manager-*.profraw" -print) \
--branch \
--ignore-not-existing \
--binary-path ./target/debug/ \
-s src \
-t lcov \
--ignore "/*" \
--excl-line '^\s*\.await\??;?$' --excl-br-line '^\s*\.await\??;?$' \
-o lcov.info
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
file: ./lcov.info