Skip to content

Update code coverage tool to use 'Code Coverage Summary' instead of Codecov #68

Update code coverage tool to use 'Code Coverage Summary' instead of Codecov

Update code coverage tool to use 'Code Coverage Summary' instead of Codecov #68

Workflow file for this run

name: Generate Rust Code Coverage
on:
workflow_dispatch:
pull_request:
branches:
- "main"
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
jobs:
core_code_coverage:
name: Generate Code Coverage for drasi-core
runs-on: ubuntu-latest
permissions:
pull-requests: write
services:
redis:
image: redis:7-alpine
ports:
- 6379:6379
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Cache Cargo registry
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache Cargo index
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-index-
- name: Cache Cargo build
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-
- name: Install Rust and Cargo tarpaulin
run: |
rustup update stable
cargo install cargo-tarpaulin
- name: Generate Code Coverage
env:
REDIS_URL: redis://localhost:6379
run: |
cargo tarpaulin --out Xml
mv cobertura.xml drasi-core-tarpaulin-report.xml
echo "Code coverage report generated"
- name: Code Coverage Report
uses: irongut/[email protected]
with:
filename: drasi-core-tarpaulin-report.xml
badge: true
fail_below_min: true
format: markdown
indicators: true
output: both
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
recreate: true
path: code-coverage-results.md
- name: Write to Job Summary
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY