⬆️ Update 👷 GitHub Action crate-ci/typos to v1.28.3 (#402) #1133
This file contains 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: 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@1bd1e32a3bdc45362d1e726936510720a7c30a57 # 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@7f8b4b4bde536c465e797be725718b88c5d95e0e # 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 |