Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github: Report code coverage #5

Merged
merged 4 commits into from
May 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 34 additions & 7 deletions .github/workflows/primary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ on:
schedule:
- cron: "0 0 * * 6"
push:
branches: ["*"]
pull_request:
branches: [main]
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

jobs:
clippy:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
Expand All @@ -38,14 +38,41 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04]
os: [ubuntu-20.04, ubuntu-22.04]
steps:
- uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v1
- name: Build
run: cargo build --tests --verbose
- name: Run tests
run: cargo test --verbose
- uses: actions-rs/toolchain@v1
with:
components: llvm-tools-preview
override: true
toolchain: stable
- uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --no-fail-fast
env:
LLVM_PROFILE_FILE: "nldl-%p-%m.profraw"
RUSTFLAGS: '-Cinstrument-coverage'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh this flag is stable now? That's awesome.

- uses: actions-rs/cargo@v1
with:
command: install
args: grcov
- id: coverage
run: |
grcov \
--branch \
--ignore-not-existing \
--llvm \
--binary-path=target/debug/ \
--output-path=target/debug/lcov.info \
--output-type=lcov \
--source-dir=. \
.
echo '::set-output name=report::target/debug/lcov.info'
- uses: codecov/codecov-action@v2
with:
files: ${{ steps.coverage.outputs.report }}

check-readme:
runs-on: ubuntu-latest
Expand Down