Coverage #1
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: Coverage | |
on: | |
workflow_dispatch: | |
jobs: | |
coverage: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install grcov | |
run: | | |
cargo install grcov | |
rustup component add llvm-tools-preview | |
- name: Run tests | |
env: | |
CARGO_INCREMENTAL: 0 | |
RUSTFLAGS: -Cinstrument-coverage | |
LLVM_PROFILE_FILE: cargo-test-%p-%m.profraw | |
run: cargo test | |
- name: Generate coverage report | |
run: | | |
grcov . \ | |
--binary-path ./target/debug/deps/ \ | |
-s . -t html \ | |
--branch \ | |
--ignore-not-existing \ | |
--ignore '../*' \ | |
--ignore "/*" \ | |
-o target/coverage | |
ls target/coverage | |
jq < target/coverage/coverage.json | |
- name: Generate docs | |
run: | | |
cargo doc --workspace --no-deps | |
- name: Prepare deploy | |
run: | | |
mkdir public | |
mv target/coverage public/ | |
mv target/doc public/ | |
- name: Deploy artifacts | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public | |
publish_branch: docs-coverage | |