chore(tests): Test state no config/change cases. #42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |