Skip to content

Merge pull request #173 from acgetchell/dependabot/github_actions/ziz… #360

Merge pull request #173 from acgetchell/dependabot/github_actions/ziz…

Merge pull request #173 from acgetchell/dependabot/github_actions/ziz… #360

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:
CARGO_LLVM_COV_VERSION: "0.8.7"
JUST_VERSION: "1.51.0"
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0 # Needed for Codecov diff analysis
persist-credentials: false
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1.16.1
with:
cache: true # toolchain/components are specified in rust-toolchain.toml
- name: Install LLVM coverage tools
run: rustup component add llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/cache-cargo-install-action@417450f3c33ee20393705369577571770643d4c7 # v3.0.7
with:
tool: cargo-llvm-cov@${{ env.CARGO_LLVM_COV_VERSION }}
- name: Install just
uses: taiki-e/cache-cargo-install-action@417450f3c33ee20393705369577571770643d4c7 # v3.0.7
with:
tool: just@${{ env.JUST_VERSION }}
- 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. cargo-llvm-cov 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@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
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/