Skip to content

Commit

Permalink
Merge pull request #1 from xcp-ng/ydi/grcov-html
Browse files Browse the repository at this point in the history
ci: store HTML coverage report
  • Loading branch information
TSnake41 authored Aug 22, 2023
2 parents ea60049 + 31b177b commit fb91f25
Showing 1 changed file with 35 additions and 16 deletions.
51 changes: 35 additions & 16 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,47 @@ jobs:
runs-on: ubuntu-latest
#container:
# image: centos8

steps:
- uses: dtolnay/rust-toolchain@1.69.0
- uses: actions/checkout@v3
- name: Preparing
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.69.0
override: true
- name: Installing dependency packages
run: sudo apt update && sudo apt install -y libxen-dev protobuf-compiler

- name: Build
run: cargo build --verbose

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --codecov --output-path cov.json

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: cov.json
fail_ci_if_error: true

toolchain: nightly
override: true
- name: Installing dependency packages
run: sudo apt update && sudo apt install -y libxen-dev protobuf-compiler

- name: Run tests
run: cargo test --verbose
run: |
cargo clean
cargo test --verbose
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'

- name: Install grcov
run: cargo install grcov
- name: Test coverage report
run: grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing -o ./target/debug/coverage/

- name: Upload test coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-html
path: ./target/debug/coverage/

0 comments on commit fb91f25

Please sign in to comment.