Skip to content

⬆️ Update 👷 GitHub Action crate-ci/typos to v1.16.18 #759

⬆️ Update 👷 GitHub Action crate-ci/typos to v1.16.18

⬆️ Update 👷 GitHub Action crate-ci/typos to v1.16.18 #759

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]
steps:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- name: Authenticate GitHub CLI
run: echo ${{github.token}} | gh auth login --with-token
- name: Setup Rust Toolchain
uses: dtolnay/rust-toolchain@master # renovate: tag=v1
with:
toolchain: nightly
components: llvm-tools-preview
- name: Setup Shared Compilation Cache
uses: baptiste0928/cargo-install@21a18ba3bf4a184d1804e8b759930d3471b1c941 # v2
with:
crate: sccache
- name: Setup Cargo hack
uses: bruxisma/setup-cargo-hack@1d7117a0b3be8457283a783e4065b7ba649c5d54 # renovate: tag=v1
- name: Setup grcov
uses: baptiste0928/cargo-install@21a18ba3bf4a184d1804e8b759930d3471b1c941 # v2
with:
crate: grcov
- 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 Cargo Cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3
with:
restore-keys: ${{runner.os}}-cargo-
key: ${{runner.os}}-cargo-${{hashFiles('**/Cargo.lock')}}
path: |
${{github.workspace}}/target
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git
- name: Restore sccache build artifacts
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3
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 --locked --each-feature
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@c4cf8a4f03f0ac8585acb7c1b7ce3460ec15782f # v4
with:
fail_ci_if_error: true
directory: ${{github.workspace}}
files: coverage.info
- name: Upload Code Coverage Artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
with:
name: ${{matrix.os}}-coverage.info
path: coverage.info
if-no-files-found: error