⬆️ Update 👷 GitHub Action crate-ci/typos to v1.24.5 (#364) #1053
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@692973e3d937129bcbf40652eb9f2f61becf3332 # 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@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # 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@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4 | |
with: | |
fail_ci_if_error: true | |
use_oidc: true | |
directory: ${{github.workspace}} | |
files: coverage.info | |
- name: Upload Code Coverage Artifact | |
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4 | |
with: | |
name: ${{matrix.os}}-coverage.info | |
path: coverage.info | |
if-no-files-found: error |