Skip to content

Commit

Permalink
Use cargo-llvm-cov
Browse files Browse the repository at this point in the history
  • Loading branch information
jayvdb committed Apr 26, 2024
1 parent 93a147c commit 5b3c2b1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 39 deletions.
53 changes: 17 additions & 36 deletions .github/workflows/deepsource.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,60 +18,41 @@ jobs:
deepsource:
name: Test and submit
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
# The checkout must be the PR 'head' sha for deepsource to work
- name: Checkout PR
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Checkout PUSH
if: ${{ github.event_name == 'push' }}
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1

- name: Install Rust stable with llvm-tools-preview
uses: actions-rust-lang/[email protected]
with:
components: llvm-tools-preview

- name: Install Rust nightly with rustfmt
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: rustfmt

- uses: actions/cache@v3
- name: Install cargo-llvm-cov
uses: taiki-e/[email protected]
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/advisory-dbs/
key: ${{ runner.os }}-coverage-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-coverage
tool: cargo-llvm-cov

# coverage needs a nightly toolchain
- name: Run test suite
run: |
rustup toolchain install nightly --allow-downgrade
cargo +nightly test --all-features --no-fail-fast ||:
env:
CARGO_INCREMENTAL: "0"
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=unwind"
RUSTDOCFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=unwind"

- name: Install grcov
run: |
cargo +stable install grcov || true
- name: Run coverage
id: coverage
uses: actions-rs/[email protected]
with:
config: .grcov.yaml

# DeepSource limits the size of the coverage data file to 50 MB
- name: Move coverage file
run: |
mv ${{ steps.coverage.outputs.report }} ./coverage.xml
ls -al ./coverage.xml
cargo llvm-cov test --cobertura --output-path coverage.xml --branch --workspace --no-fail-fast --all-features
- name: Install deepsource cli
run: |
Expand Down
3 changes: 0 additions & 3 deletions .grcov.yaml

This file was deleted.

0 comments on commit 5b3c2b1

Please sign in to comment.