Add grcov workflow

grcov
Manos Pitsidianakis 2023-04-24 20:17:36 +03:00
parent 9ceb11c761
commit 1f86d3133b
Signed by: Manos Pitsidianakis
GPG Key ID: 7729C7707F7E09D0
2 changed files with 79 additions and 0 deletions

5
.github/grcov.yml vendored 100644
View File

@ -0,0 +1,5 @@
ignore-not-existing: true
branch: true
output-type: html
binary-path: ./target/debug/
output-path: ./target/debug/coverage/

74
.github/workflows/grcov.yaml vendored 100644
View File

@ -0,0 +1,74 @@
name: Code coverage
env:
RUST_BACKTRACE: 1
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
on:
workflow_dispatch:
workflow_run:
workflows: [Tests]
types: [completed]
branches: [main]
jobs:
on-success:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v1
- id: cache-rustup
name: Cache Rust toolchain
uses: actions/cache@v3
with:
path: ~/.rustup
key: toolchain-grcov
- id: cache-cargo
name: Cache Cargo
uses: actions/cache@v3
with:
path: ~/.cargo
key: cargo-grcov
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- uses: actions-rs/cargo@v1
with:
command: test
args: --all --all-features --no-fail-fast
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'
- uses: actions-rs/grcov@v0.1
with:
config: .github/grcov.yml
- name: Copy artifacts
run: |
mkdir -p "_site"
cp -r target/debug/coverage _site/
- name: Upload report
uses: actions/upload-pages-artifact@v1
deploy:
# Add a dependency to the build job
needs: on-success
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2 # or the latest "vX.X.X" version tag for this action