Skip to content

Updated coverage

Updated coverage #65

Workflow file for this run

name: Code Coverage
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
code-coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: llvm-tools-preview
- name: Install grcov
run: cargo install grcov
working-directory: ./rust
- name: Install x86_64-unknown-linux-gnu target
run: rustup target add x86_64-unknown-linux-gnu
working-directory: ./rust
- name: Set up coverage configuration
run: |
mkdir -p .cargo
echo "[build]" > .cargo/config.toml
echo 'rustflags = ["-Zinstrument-coverage","-Ccodegen-units=1","-Cinline-threshold=0","-Clink-dead-code","-Coverflow-checks=off","-Zno-profiler-runtime"]' >> .cargo/config.toml
echo "[unstable]" >> .cargo/config.toml
echo 'build-std = ["std"]' >> .cargo/config.toml
working-directory: ./rust
- name: Run tests with coverage
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Zinstrument-coverage"
LLVM_PROFILE_FILE: "coverage-%p-%m.profraw"
run: cargo test --target x86_64-unknown-linux-gnu
working-directory: ./rust
- name: Generate coverage report
run: |
grcov . -s . -t html --llvm --branch --ignore-not-existing -o ./coverage
mkdir -p coverage-report
cp -r ./coverage/* coverage-report/
working-directory: ./rust
- name: Upload coverage report
uses: actions/upload-artifact@v2
with:
name: coverage-report
path: coverage-report