Skip to content

chore: Improve test coverage a bit. #39

chore: Improve test coverage a bit.

chore: Improve test coverage a bit. #39

Workflow file for this run

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' \
--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