Bump codecov/codecov-action from 3 to 4 #27
Workflow file for this run
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: CI # Continuous Integration | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
test: | |
name: Test Suite | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
override: true | |
- uses: Swatinem/rust-cache@v2 | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --all-features --workspace | |
rustfmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
override: true | |
components: rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
- name: Check formatting | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
clippy: | |
name: Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
override: true | |
components: clippy | |
- uses: Swatinem/rust-cache@v2 | |
- name: Clippy check | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --all-targets --all-features --workspace -- -D warnings | |
docs: | |
name: Docs | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
override: true | |
- uses: Swatinem/rust-cache@v2 | |
- name: Check documentation | |
env: | |
RUSTDOCFLAGS: -D warnings | |
uses: actions-rs/cargo@v1 | |
with: | |
command: doc | |
coverage: | |
name: Code Coverage | |
runs-on: ${{ matrix.job.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
job: | |
- { os: ubuntu-latest , features: unix } | |
- { os: macos-latest , features: macos } | |
- { os: windows-latest , features: windows } | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Initialize workflow variables | |
id: vars | |
shell: bash | |
run: | | |
## VARs setup | |
outputs() { step_id="vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; } | |
# toolchain | |
TOOLCHAIN="nightly" ## default to "nightly" toolchain (required for certain required unstable compiler flags) ## !maint: refactor when stable channel has needed support | |
# * specify gnu-type TOOLCHAIN for windows; `grcov` requires gnu-style code coverage data files | |
case ${{ matrix.job.os }} in windows-*) TOOLCHAIN="$TOOLCHAIN-x86_64-pc-windows-gnu" ;; esac; | |
# * use requested TOOLCHAIN if specified | |
if [ -n "${{ matrix.job.toolchain }}" ]; then TOOLCHAIN="${{ matrix.job.toolchain }}" ; fi | |
outputs TOOLCHAIN | |
# target-specific options | |
# * CARGO_FEATURES_OPTION | |
CARGO_FEATURES_OPTION='--all -- --check' ; ## default to '--all-features' for code coverage | |
# * CODECOV_FLAGS | |
CODECOV_FLAGS=$( echo "${{ matrix.job.os }}" | sed 's/[^[:alnum:]]/_/g' ) | |
outputs CODECOV_FLAGS | |
- name: rust toolchain ~ install | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ steps.vars.outputs.TOOLCHAIN }} | |
default: true | |
profile: minimal # minimal component installation (ie, no documentation) | |
- name: Test | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} --no-fail-fast | |
env: | |
CARGO_INCREMENTAL: "0" | |
RUSTC_WRAPPER: "" | |
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" | |
RUSTDOCFLAGS: "-Cpanic=abort" | |
- name: "`grcov` ~ install" | |
id: build_grcov | |
shell: bash | |
run: | | |
git clone https://github.com/mozilla/grcov.git ~/grcov/ | |
cd ~/grcov | |
# Hardcode the version of crossbeam-epoch. See | |
# https://github.com/uutils/coreutils/issues/3680 | |
sed -i -e "s|tempfile =|crossbeam-epoch = \"=0.9.8\"\ntempfile =|" Cargo.toml | |
cargo install --path . | |
cd - | |
# Uncomment when the upstream issue | |
# https://github.com/mozilla/grcov/issues/849 is fixed | |
# uses: actions-rs/[email protected] | |
# with: | |
# crate: grcov | |
# version: latest | |
# use-tool-cache: false | |
- name: Generate coverage data (via `grcov`) | |
id: coverage | |
shell: bash | |
run: | | |
## Generate coverage data | |
COVERAGE_REPORT_DIR="target/debug" | |
COVERAGE_REPORT_FILE="${COVERAGE_REPORT_DIR}/lcov.info" | |
mkdir -p "${COVERAGE_REPORT_DIR}" | |
# display coverage files | |
grcov . --output-type files --ignore build.rs --ignore "vendor/*" --ignore "/*" --ignore "[a-zA-Z]:/*" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()" | sort --unique | |
# generate coverage report | |
grcov . --output-type lcov --output-path "${COVERAGE_REPORT_FILE}" --branch --ignore build.rs --ignore "vendor/*" --ignore "/*" --ignore "[a-zA-Z]:/*" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()" | |
echo ::set-output name=report::${COVERAGE_REPORT_FILE} | |
- name: Upload coverage results (to Codecov.io) | |
uses: codecov/codecov-action@v4 | |
# if: steps.vars.outputs.HAS_CODECOV_TOKEN | |
with: | |
# token: ${{ secrets.CODECOV_TOKEN }} | |
file: ${{ steps.coverage.outputs.report }} | |
## flags: IntegrationTests, UnitTests, ${{ steps.vars.outputs.CODECOV_FLAGS }} | |
flags: ${{ steps.vars.outputs.CODECOV_FLAGS }} | |
name: codecov-umbrella | |
fail_ci_if_error: false |