Skip to content

Commit

Permalink
Merge pull request #5 from royaltm/grcov-test
Browse files Browse the repository at this point in the history
CI: Grcov test
  • Loading branch information
royaltm committed Jul 22, 2023
2 parents a78f2eb + aee7d71 commit 8bad87b
Showing 1 changed file with 46 additions and 4 deletions.
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

0 comments on commit 8bad87b

Please sign in to comment.