-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (40 loc) · 1.41 KB
/
rust.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
name: Rust
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: -D warnings -C instrument-coverage
LLVM_PROFILE_FILE: /tmp/nvmetcfg-%p-%8m.profraw
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: llvm-tools-preview
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Merge profile data and export LCOV
run: |
PATH="$(rustc --print sysroot)/lib/rustlib/x86_64-unknown-linux-gnu/bin:$PATH"
llvm-cov --version
llvm-profdata merge --sparse -o /tmp/nvmetcfg.profdata /tmp/nvmetcfg-*.profraw
llvm-cov export -format=lcov -instr-profile=/tmp/nvmetcfg.profdata \
--ignore-filename-regex=/.cargo/registry --ignore-filename-regex=src/lib.rs --ignore-filename-regex=src/state/mod.rs \
--show-instantiation-summary \
$(cargo test --tests --no-run --message-format=json | jq -r "select(.profile.test == true) | .filenames[]" | xargs -I {} printf "-object {} ") > nvmetcfg.lcov
- name: Upload to codecov.io
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: nvmetcfg.lcov
name: unit-tests