Skip to content

deps(deps): bump the production-dependencies group across 1 directory with 17 updates #378

deps(deps): bump the production-dependencies group across 1 directory with 17 updates

deps(deps): bump the production-dependencies group across 1 directory with 17 updates #378

Workflow file for this run

name: Code Coverage
# Generates code coverage reports and uploads to Codecov
# Runs on: PR (with comment), Push to main, Manual trigger
on:
pull_request:
branches: [main, master]
paths:
- 'src/**'
- 'tests/**'
- 'Cargo.toml'
- 'Cargo.lock'
push:
branches: [main, master]
workflow_dispatch:
permissions:
contents: read
pull-requests: write
env:
CARGO_TERM_COLOR: always
jobs:
coverage:
name: Generate Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: coverage
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Initialize project for tests
run: |
# Initialize project for tests
cargo run --bin ie -- doctor
- name: Generate coverage
run: |
# Run coverage on unit tests and current integration tests only
# Do NOT use --all-features: it enables test-removed-cli-commands which runs
# tests for CLI commands removed in v0.10.0 (task, event, current, etc.)
cargo llvm-cov --lib --bins --lcov --output-path lcov.info
cargo llvm-cov --test interface_spec_test --no-clean --lcov --output-path lcov.info
- name: Upload to Codecov
uses: codecov/codecov-action@v5
with:
files: lcov.info
flags: unittests
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
- name: Generate coverage summary
if: github.event_name == 'pull_request'
id: coverage
run: |
# Generate text report and extract percentage (using already collected coverage data)
COVERAGE=$(cargo llvm-cov report --lcov --input-path lcov.info 2>&1 | grep -oP 'TOTAL.*?\K[\d.]+(?=%)' || echo "0")
echo "percent=$COVERAGE" >> $GITHUB_OUTPUT
echo "Coverage: $COVERAGE%"
- name: Comment on PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v8
with:
script: |
const coverage = '${{ steps.coverage.outputs.percent }}';
const emoji = coverage >= 80 ? '🎉' : coverage >= 60 ? '✅' : '⚠️';
const comment = `## ${emoji} Code Coverage Report
**Total Coverage**: ${coverage}%
${coverage >= 80 ? '🎉 Excellent coverage!' : coverage >= 60 ? '✅ Good coverage' : '⚠️ Coverage could be improved'}
[View detailed report on Codecov](https://codecov.io/gh/${{ github.repository }}/pull/${{ github.event.pull_request.number }})
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
- name: Upload coverage artifact
uses: actions/upload-artifact@v5
with:
name: coverage-report
path: lcov.info
retention-days: 30