Merge pull request #4 from acgetchell/docs/benchmark #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| fetch-depth: 0 # Needed for Codecov diff analysis | |
| - name: Install Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1.15.2 | |
| with: | |
| cache: true # toolchain/components are specified in rust-toolchain.toml | |
| - name: Cache tarpaulin | |
| uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 | |
| 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@50708e9ba8d7b6587a2cb575ddaa9a62e927bc06 # v2.62.63 | |
| 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@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.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@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| if: always() | |
| with: | |
| name: coverage-report | |
| path: coverage/ |