This repository has been archived by the owner on Aug 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use yet another approach for coverage
- Loading branch information
Showing
2 changed files
with
53 additions
and
35 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,59 @@ | ||
name: coverage | ||
on: [push, pull_request] | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
name: Code Coverage | ||
jobs: | ||
coverage: | ||
name: Run test coverage | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Cache cargo registry | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.cargo/registry | ||
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | ||
|
||
- name: Cache cargo index | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.cargo/git | ||
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} | ||
|
||
- name: Cache cargo binaries | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.cargo/bin | ||
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('**/Cargo.lock') }} | ||
|
||
- name: Toolchain setup | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
override: true | ||
components: llvm-tools-preview | ||
|
||
- name: Install grcov | ||
run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install grcov; fi | ||
|
||
- name: Run tests | ||
run: cargo test | ||
env: | ||
RUSTFLAGS: '-Zinstrument-coverage' | ||
LLVM_PROFILE_FILE: 'report-%p-%m.profraw' | ||
|
||
- name: Run grcov | ||
run: grcov . --binary-path target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../**' --ignore '/*' --ignore 'target/*' -o coverage.lcov | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
override: true | ||
|
||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --no-default-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 | ||
|
||
- name: Push grcov results to Coveralls via GitHub Action | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
path-to-lcov: "./lcov.info" | ||
- name: Coveralls upload | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
path-to-lcov: coverage.lcov |