Skip to content

Commit

Permalink
Merge pull request #416 from Universal-Debloater-Alliance/feat/upload…
Browse files Browse the repository at this point in the history
…-test-coverage-to-DeepSouce-in-CI

feat(ci): run test coverage in CI and upload to DeepSource
  • Loading branch information
lavafroth authored Apr 13, 2024
2 parents 9b82148 + e955dad commit 8df133c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:

jobs:
lint:
name: lint
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down Expand Up @@ -55,3 +56,29 @@ jobs:
with:
components: clippy,rustfmt
- run: cargo ${{ matrix.lint }}${{ matrix.args }}

coverage:
name: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Download grcov
run: |
mkdir -p "${HOME}/.local/bin"
curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.19/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "${HOME}/.local/bin"
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Set up DeepSource CLI
run: curl https://deepsource.io/cli | sh
- name: Install LLVM-profdata
run: rustup component add llvm-tools-preview
- name: Run tests
run: CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE='cargo-test-%p-%m.profraw' cargo test
- name: make coverage directory
run: mkdir ./target/coverage
- name: Run GRCOV
run: grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o ./target/coverage/tests.lcov
- name: Upload to DeepSource
env:
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
run: ./bin/deepsource report --analyzer test-coverage --key rust --value-file ./target/coverage/tests.lcov

0 comments on commit 8df133c

Please sign in to comment.