Skip to content

Merge pull request #88 from acgetchell/dependabot/github_actions/astr… #226

Merge pull request #88 from acgetchell/dependabot/github_actions/astr…

Merge pull request #88 from acgetchell/dependabot/github_actions/astr… #226

Workflow file for this run

name: Codecov
concurrency:
# Ensure only one Codecov analysis runs per branch/ref
group: codecov-${{ github.ref_name }}
cancel-in-progress: true
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
# Least-privilege permissions
permissions:
contents: read
checks: write
pull-requests: write
jobs:
coverage:
name: Code Coverage
runs-on: ubuntu-latest
env:
TARPAULIN_VERSION: "0.32.8"
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0 # Needed for Codecov diff analysis
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@2b1f5e9b395427c92ee4e3331786ca3c37afe2d7 # v1.16.0
with:
cache: true # toolchain/components are specified in rust-toolchain.toml
- name: Cache tarpaulin
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.cargo/bin/cargo-tarpaulin
key: tarpaulin-${{ runner.os }}-${{ env.TARPAULIN_VERSION }}
restore-keys: |
tarpaulin-${{ runner.os }}-
- name: Install tarpaulin
run: |
if ! command -v cargo-tarpaulin &> /dev/null; then
cargo install cargo-tarpaulin --locked --version "${TARPAULIN_VERSION}"
fi
- name: Install just
uses: taiki-e/install-action@055f5df8c3f65ea01cd41e9dc855becd88953486 # v2.75.18
with:
tool: just
- name: Run coverage
run: |
mkdir -p coverage
chmod 755 coverage
echo "::group::Running coverage"
# Single source of truth: coverage configuration lives in justfile
just coverage-ci
echo "::endgroup::"
echo "::group::Coverage verification"
ls -la coverage/ || true
if [ ! -f coverage/cobertura.xml ]; then
echo "::error::coverage/cobertura.xml not found. Tarpaulin failed to generate XML output."
exit 2
fi
echo "::notice::Coverage report generated successfully: $(wc -l < coverage/cobertura.xml) lines"
echo "::endgroup::"
env:
RUST_BACKTRACE: 1
- name: Upload coverage to Codecov
if: ${{ success() && hashFiles('coverage/cobertura.xml') != '' }}
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
with:
files: coverage/cobertura.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Archive coverage results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: always()
with:
name: coverage-report
path: coverage/