Skip to content
This repository has been archived by the owner on Aug 26, 2023. It is now read-only.

Commit

Permalink
Use yet another approach for coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
lwagner94 committed Dec 5, 2021
1 parent d66c598 commit 0685929
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 35 deletions.
6 changes: 0 additions & 6 deletions .github/actions-rs/grcov.yml

This file was deleted.

82 changes: 53 additions & 29 deletions .github/workflows/coverage.yml
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

0 comments on commit 0685929

Please sign in to comment.