Bump codecov/codecov-action from 4 to 5 #205
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
# Copyright (C) 2022-2024 Daniel Mueller <[email protected]> | |
# SPDX-License-Identifier: GPL-3.0-or-later | |
name: Test | |
on: | |
pull_request: | |
push: | |
workflow_call: | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: 1 | |
# Build without debug information enabled to decrease compilation time | |
# and binary sizes in CI. This option is assumed to only have marginal | |
# effects on the generated code, likely only in terms of section | |
# arrangement. See | |
# https://doc.rust-lang.org/cargo/reference/environment-variables.html | |
# https://doc.rust-lang.org/rustc/codegen-options/index.html#debuginfo | |
RUSTFLAGS: '-C debuginfo=0' | |
jobs: | |
build: | |
name: Build [${{ matrix.rust }}, ${{ matrix.profile }}] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
rust: [stable] | |
profile: [dev, release] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Build ${{ matrix.profile }} | |
run: | | |
cargo build --profile=${{ matrix.profile }} --bins --tests --examples --features=test | |
build-minimum: | |
name: Build using minimum versions of dependencies | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Nightly Rust | |
uses: dtolnay/rust-toolchain@nightly | |
- run: cargo +nightly -Z minimal-versions update | |
- name: Install minimum Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
# Please adjust README and rust-version field in Cargo.toml files when | |
# bumping version. | |
toolchain: 1.66.0 | |
- name: Build | |
run: | | |
cargo build --locked | |
cargo build --locked --features=coredump | |
cargo build --locked --features=readline | |
test: | |
name: Test and coverage | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Test and gather coverage | |
# We lack a TTY, so we hack one with `script`. | |
shell: script --quiet --return --command "bash --noprofile --norc -e -o pipefail {0}" | |
run: | |
cargo llvm-cov --lcov --output-path lcov.info --features=test | |
- name: Upload code coverage results | |
uses: codecov/codecov-action@v5 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
files: lcov.info | |
bench: | |
name: Benchmark | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
- run: | | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
cargo bench --features=nightly --quiet -- bench_ >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
clippy: | |
name: Lint with clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- run: | | |
cargo clippy --no-deps --tests -- -A unknown_lints -D warnings | |
cargo clippy --no-deps --features=readline -- -A unknown_lints -D warnings |