Skip to content

⬆️ Update 👷 GitHub Action codecov/codecov-action to 985343d #1105

⬆️ Update 👷 GitHub Action codecov/codecov-action to 985343d

⬆️ Update 👷 GitHub Action codecov/codecov-action to 985343d #1105

Workflow file for this run

name: Code Coverage
on:
pull_request:
types: [opened, edited, synchronize]
push:
branches: main
jobs:
coverage:
name: Code Coverage
runs-on: ${{matrix.os}}-latest
strategy:
matrix:
os: [ubuntu, windows, macos]
permissions:
id-token: write
checks: read
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Authenticate GitHub CLI
run: echo ${{github.token}} | gh auth login --with-token
- name: Setup Rust Toolchain and Tools
uses: moonrepo/setup-rust@e013866c4215f77c925f42f60257dec7dd18836e # v1
with:
bins: sccache, grcov, cargo-hack
channel: nightly
components: llvm-tools-preview
cache-target: coverage
- name: Setup Shared Cache Directory
shell: bash
run: |
declare path="${HOME}/.cache/sccache"
if test "${RUNNER_OS}" = "Windows"; then
path=$(cygpath --windows "${path}")
fi
echo "SCCACHE_DIR=${path}" >> "${GITHUB_ENV}"
- name: Restore sccache build artifacts
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
with:
restore-keys: ${{runner.os}}-nightly-coverage-
key: ${{runner.os}}-nightly-coverage-${{hashFiles('**/Cargo.lock')}}
path: ${{env.SCCACHE_DIR}}
- name: Run Tests (coverage)
run: cargo hack test --profile=coverage --feature-powerset
env:
LLVM_PROFILE_FILE: target/coverage/outcome-%p-%m.profraw
RUSTC_WRAPPER: sccache
RUSTDOCFLAGS: >-
-C instrument-coverage
-Zunstable-options
--persist-doctests ${{github.workspace}}/target/coverage
RUSTFLAGS: -C instrument-coverage
- name: Collect Coverage
run: >-
grcov ${{github.workspace}}
--binary-path ${{github.workspace}}/target/coverage
--output-path ${{github.workspace}}/coverage.info
--output-type lcov
--source-dir ${{github.workspace}}
--ignore "/*"
--ignore "C:/*"
--ignore "../*"
--ignore-not-existing
--branch
- name: Check coverage.info exists
run: test -f ${{github.workspace}}/coverage.info
- name: Upload Code Coverage
uses: codecov/codecov-action@985343d70564a82044c1b7fcb84c2fa05405c1a2 # v5
with:
fail_ci_if_error: true
use_oidc: true
directory: ${{github.workspace}}
files: coverage.info
- name: Upload Code Coverage Artifact
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
with:
name: ${{matrix.os}}-coverage.info
path: coverage.info
if-no-files-found: error