diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5032b38d..a80a551a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,7 @@ on: jobs: lint: + name: lint runs-on: ${{ matrix.os }} strategy: matrix: @@ -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 \ No newline at end of file