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

CI: Grcov test #5

Merged
merged 2 commits into from
Jul 22, 2023
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
50 changes: 46 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,29 @@ jobs:
- beta
- nightly
include:
- rust: 1.63.0
- rust: nightly
coverage: 'send'
components: llvm-tools
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install ${{ matrix.rust }} toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
components: ${{ matrix.components }}
override: true

- name: Install grcov
if: matrix.coverage == 'send'
uses: actions-rs/install@v0.1
with:
crate: grcov
version: latest
use-tool-cache: true

- name: Tests
env:
RUSTFLAGS: '-D warnings'
Expand All @@ -45,9 +57,39 @@ jobs:
cargo test --verbose --no-default-features --features=lh1
cargo build --verbose --all-features
cargo test --verbose --all-features

- name: Coverage
if: matrix.coverage == 'send'
uses: actions-rs/tarpaulin@v0.1
env:
LLVM_PROFILE_FILE: "delharc-%p-%m.profraw"
RUSTFLAGS: "-Cinstrument-coverage"
run: |
cargo build --verbose --all-features
cargo test --verbose --all-features
grcov . \
--binary-path ./target/debug/ \
--branch \
--output-types lcov \
--source-dir . \
--output-path ./lcov.info \
--ignore-not-existing \
--keep-only 'src/*' \
--commit-sha ${{ github.sha }} \
--service-job-id ${{ github.job }} \
--service-name "GitHub Actions" \
--service-number ${{ github.run_id }}

- name: Upload coverage as artifact
if: matrix.coverage == 'send'
uses: actions/upload-artifact@v2
with:
name: lcov.info
path: ./lcov.info
if-no-files-found: error

- name: Upload coverage to Coveralls
if: matrix.coverage == 'send'
uses: coverallsapp/github-action@v2
with:
version: '0.22.0'
args: --verbose --all-features --exclude-files examples/*.rs tests/*.rs tests/*/*.rs --coveralls ${{secrets.COVERALLS_KEY}}
file: lcov.info
format: lcov
Loading