Test Coverage #168
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: codecov | |
run-name: "Test Coverage" | |
# on: [push, workflow_dispatch] | |
on: | |
push: | |
branches: ["main"] | |
paths-ignore: | |
- '**/README.md' | |
- '**/*.png' | |
- 'rabbitmq_spec/**' | |
- 'prepare_release.sh' | |
- 'regression_test.sh' | |
workflow_dispatch: | |
pull_request: | |
branches: ["main"] | |
paths-ignore: | |
- '**/README.md' | |
- '**/*.png' | |
- 'rabbitmq_spec/**' | |
- 'prepare_release.sh' | |
- 'regression_test.sh' | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
# codecov: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - name: Start RabbitMQ server | |
# run: ./start_rabbitmq.sh | |
# - name: Cargo test instrumented | |
# run: LLVM_PROFILE_FILE="default_%m.profraw" RUSTFLAGS="-C instrument-coverage -C codegen-units=1" cargo test -p amqprs --all-features --tests | |
# - name: Merge coverage data | |
# run: llvm-profdata-14 merge -sparse amqprs/default_*.profraw -o amqprs.profdata | |
# - name: Generate coverage report | |
# run: | | |
# object_list=$(for file in $(LLVM_PROFILE_FILE="default_%m.profraw" RUSTFLAGS="-C instrument-coverage -C codegen-units=1" cargo test -p amqprs --all-features --tests --no-run --message-format=json | jq -r "select(.profile.test == true) | .filenames[]"); do printf "%s %s " --object $file; done) | |
# llvm-cov-14 report --use-color --ignore-filename-regex='/.cargo/registry' --ignore-filename-regex='rustc/' --ignore-filename-regex='tests/' --instr-profile=amqprs.profdata ${object_list} | |
codecov: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Start RabbitMQ server | |
run: ./start_rabbitmq.sh | |
- name: Install rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
override: true | |
default: true | |
components: llvm-tools | |
- name: Install cargo-llvm-cov | |
run: cargo install cargo-llvm-cov | |
- name: Cargo update | |
run: cargo update -p proc-macro2 | |
- name: Measure coverage | |
run: RUST_LOG=trace cargo llvm-cov --all-features --lcov --output-path ./lcov.info | |
- name: Report to codecov.io | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./lcov.info | |
fail_ci_if_error: true |