chore(deps): update rust crate rstest to v0.24.0 #888
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: Build and Check | |
on: | |
push: | |
branches: ["main", "cicd", "release", "develop", "develop-gamma"] | |
pull_request: | |
branches: ["main"] | |
schedule: | |
- cron: "00 01 * * *" | |
workflow_dispatch: | |
inputs: | |
resetBenchmarks: | |
description: "Reset the benchmark data" | |
required: true | |
type: boolean | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: "1" | |
BENCHMARK_REGRESSION_PERCENT_FAIL: 10 | |
FEATURES: standard,custom,time,chrono,serde,base | |
jobs: | |
deny: | |
name: Check dependencies/ubuntu-latest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: EmbarkStudios/cargo-deny-action@v2 | |
with: | |
rust-version: "1.66.0" | |
minimal_versions: | |
needs: [deny] | |
name: Build and check with minimal versions | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
toolchain: | |
- "1.66.0" # MSRV | |
- stable | |
- nightly | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.toolchain }} | |
- uses: taiki-e/install-action@cargo-hack | |
- uses: taiki-e/install-action@cargo-minimal-versions | |
# This'll run without checking dev-dependencies | |
- name: Build with minimal versions | |
run: cargo minimal-versions check --workspace --ignore-private --all-features --lib --bins | |
format: | |
name: Check format with nightly rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt | |
- run: cargo fmt --check | |
base: | |
needs: [format] | |
name: Build, check and test | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
toolchain: | |
- "1.66.0" # MSRV | |
- stable | |
- nightly | |
include: | |
- components: clippy | |
toolchain: stable | |
- features: standard,custom,time,chrono,serde,base,with-iai,with-flamegraph | |
- features: standard,custom,time,chrono,serde,base | |
os: windows-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
components: ${{ matrix.components }} | |
- name: Prepare | |
if: matrix.toolchain != 'stable' | |
run: | | |
rustup toolchain install stable --no-self-update --component clippy | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: "${{ matrix.os }}_${{ matrix.toolchain }}" | |
- name: Info if unix | |
if: ${{ matrix.os != 'windows-latest' }} | |
run: | | |
set -x | |
uname -a | |
pwd | |
rustup --version | |
rustup show | |
rustup component list --installed | |
- name: Info if windows | |
if: ${{ matrix.os == 'windows-latest' }} | |
shell: bash | |
run: | | |
set -x | |
rustup show | |
rustup component list --installed | |
- name: Update locked dependencies | |
if: matrix.toolchain == 'stable' || matrix.toolchain == 'nightly' | |
run: | | |
cargo update | |
- name: Build | |
run: cargo build --features ${{ matrix.features }} | |
- name: Lint | |
run: cargo +stable clippy --features ${{ matrix.features }} --all-targets -- -D warnings | |
- name: Test | |
run: cargo test --features ${{ matrix.features }} | |
cross: | |
needs: [format] | |
name: Cross build and test | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
##### big endian targets ##### | |
- s390x-unknown-linux-gnu | |
# - sparc64-unknown-linux-gnu | |
# - powerpc-unknown-linux-gnu | |
- mips-unknown-linux-gnu | |
##### little endian targets ##### | |
- i686-unknown-linux-gnu | |
- i586-unknown-linux-gnu | |
- aarch64-unknown-linux-gnu | |
- arm-unknown-linux-gnueabihf | |
# - riscv64gc-unknown-linux-gnu | |
# dependency errors: quick-xml | |
# - wasm32-unknown-emscripten | |
# dependency errors: criterion | |
# - x86_64-linux-android | |
- x86_64-unknown-linux-musl | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: "1.66.0" | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: "${{ matrix.target }}" | |
- uses: taiki-e/install-action@cross | |
- name: Configure cross | |
run: | | |
cat <<EOF | tee Cross.toml | |
[build.env] | |
passthrough = ["CI", "RUST_BACKTRACE", "CARGO_TERM_COLOR", "CARGO_REGISTRIES_CRATES_IO_PROTOCOL", "CARGO_INCREMENTAL"] | |
EOF | |
- name: Info | |
run: | | |
set -x | |
pwd | |
rustup --version | |
rustup show | |
rustup component list --installed | |
cargo --list | |
cross --version | |
- name: Build | |
run: cross build --features ${{ env.FEATURES }} --target ${{ matrix.target }} | |
- name: Test | |
run: cross test --features ${{ env.FEATURES }} --target ${{ matrix.target }} | |
docs: | |
needs: [base, cross] | |
name: Docs/ubuntu-latest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- name: Run doc tests | |
run: cargo test --all-features --doc -- --show-output | |
- name: Check Documentation | |
run: cargo doc --all-features --no-deps --document-private-items | |
coverage: | |
needs: [base, cross] | |
name: Coverage/ubuntu-latest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
components: llvm-tools-preview | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install llvm | |
run: sudo apt-get -y update && sudo apt-get -y install llvm | |
- uses: taiki-e/install-action@grcov | |
- name: Info | |
run: | | |
set -x | |
uname -a | |
printenv | grep -i -e cargo -e rust -e llvm | |
cargo -V | |
rustup -V | |
rustup show | |
rustup component list --installed | |
- name: Create coverage profile | |
run: | | |
cat <<EOF | tee ~/.cargo/config | |
[profile.coverage] | |
inherits = "dev" | |
lto = false | |
debug = true | |
opt-level = 0 | |
EOF | |
- name: Clean | |
run: cargo clean | |
- name: Build | |
run: cargo build --features ${{ env.FEATURES }} --profile coverage | |
- name: Test | |
run: cargo test --features ${{ env.FEATURES }} --tests --profile coverage | |
- name: Generate code coverage | |
run: | | |
~/.cargo/bin/grcov . \ | |
--llvm-path /usr/bin \ | |
--binary-path target/coverage \ | |
--ignore-not-existing \ | |
--output-type files \ | |
--excl-start 'cov:\s*excl-start' \ | |
--excl-stop 'cov:\s*excl-stop' \ | |
--excl-line '^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\(|.*cov:\s*excl-line)' \ | |
--ignore '**/examples/*' \ | |
--ignore '/*' \ | |
--ignore '[a-zA-Z]:/*' \ | |
--source-dir . | sort -u | |
~/.cargo/bin/grcov . \ | |
--branch \ | |
--llvm-path /usr/bin \ | |
--binary-path target/coverage \ | |
--ignore-not-existing \ | |
--output-type lcov \ | |
--source-dir . \ | |
--excl-start 'cov:\s*excl-start' \ | |
--excl-stop 'cov:\s*excl-stop' \ | |
--excl-line '^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\(|.*cov:\s*excl-line)' \ | |
--ignore '**/examples/*' \ | |
--ignore '/*' \ | |
--ignore '[a-zA-Z]:/*' \ | |
--output-path lcov.info && test -e lcov.info | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@v4 | |
with: | |
files: lcov.info | |
fail_ci_if_error: false | |
env: | |
RUSTFLAGS: "-C instrument-coverage" | |
LLVM_PROFILE_FILE: "fundu_coverage-%p-%m.profraw" | |
RUST_BACKTRACE: "0" | |
fuzzing: | |
needs: [base, cross] | |
name: Fuzzy testing/ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
test: | |
- package: fundu | |
fuzz_target: f64_like_input | |
- package: fundu | |
fuzz_target: parse_single | |
- package: fundu-gnu | |
fuzz_target: parsing | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: "${{ matrix.test.package }}/fuzz" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly | |
components: llvm-tools | |
- name: Prepare | |
run: cargo install cargo-fuzz rustfilt | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.test.fuzz_target }} | |
workspaces: | | |
${{ matrix.test.package }}/fuzz -> target | |
cache-on-failure: true | |
- name: Run fuzzing for 5 minutes | |
run: | | |
dict="dicts/${{ matrix.test.fuzz_target }}.dict" | |
if test -e "$dict"; then | |
cargo fuzz run --all-features ${{ matrix.test.fuzz_target }} -- \ | |
-max_total_time=300 \ | |
-print_final_stats=1 \ | |
-print_corpus_stats=1 \ | |
-verbosity=2 \ | |
-dict="$dict" | |
else | |
cargo fuzz run --all-features ${{ matrix.test.fuzz_target }} -- \ | |
-max_total_time=300 \ | |
-print_final_stats=1 \ | |
-print_corpus_stats=1 \ | |
-verbosity=2 | |
fi | |
- name: Create coverage.profdata | |
run: cargo fuzz coverage ${{ matrix.test.fuzz_target }} | |
- name: Create lcov coverage report | |
run: | | |
llvm_cov_bin=$(realpath -e $(rustc --print target-libdir)/../bin/llvm-cov) | |
$llvm_cov_bin export \ | |
target/x86_64-unknown-linux-gnu/coverage/x86_64-unknown-linux-gnu/release/${{ matrix.test.fuzz_target }} \ | |
--instr-profile=coverage/${{ matrix.test.fuzz_target }}/coverage.profdata \ | |
--format=lcov \ | |
--ignore-filename-regex='/rustc/.*|\.cargo/registry/.*|fuzz/fuzz_targets/.*' \ | |
-Xdemangler='rustfilt' > lcov.info | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@v4 | |
with: | |
files: lcov.info | |
name: ${{ matrix.test.package }}-${{ matrix.test.fuzz_target }} | |
override_branch: fuzzy-testing | |
fail_ci_if_error: false | |
env: | |
RUSTFLAGS: "-C instrument-coverage" | |
LLVM_PROFILE_FILE: "fundu_fuzzy_coverage-%p-%m.profraw" | |
benchmarks: | |
needs: [base, cross] | |
name: Benchmarks/ubuntu-latest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: "1.66.0" | |
- uses: taiki-e/install-action@cargo-binstall | |
- name: Install iai-callgrind-runner | |
run: | | |
version=$(cargo metadata --format-version=1 |\ | |
jq '.packages[] | select(.name == "iai-callgrind").version' |\ | |
tr -d '"' | |
) | |
cargo binstall --no-confirm iai-callgrind-runner@$version | |
- uses: Swatinem/rust-cache@v2 | |
- name: Prepare | |
run: | | |
sudo apt-get -y update && sudo apt-get -y install valgrind | |
- name: Download reference benchmarks | |
if: ${{ !inputs.resetBenchmarks }} | |
uses: dawidd6/action-download-artifact@v6 | |
with: | |
workflow_conclusion: success | |
name: iai-callgrind-benchmarks | |
check_artifacts: true | |
if_no_artifact_found: warn | |
- name: Run iai-callgrind benchmarks | |
run: | | |
benches=$(cargo metadata --no-deps --format-version=1 |\ | |
jq '.packages[].targets[] | select(any(.kind[]; . == "bench") and (."required-features" and any(."required-features"[]; . == "with-iai"))) | .name' |\ | |
tr -d '"' | |
) | |
args=() | |
while IFS=$'\n' read -r bench; do args+=(--bench); args+=("$bench"); done <<<"$benches" | |
cargo bench --all-features ${args[@]} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: iai-callgrind-benchmarks | |
path: "target/iai" | |
miri: | |
needs: [base, cross] | |
name: Tests/Miri | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- x86_64-unknown-linux-gnu | |
- i686-unknown-linux-gnu # 32-bit | |
- mips64-unknown-linux-gnuabi64 # big-endian | |
- aarch64-unknown-linux-gnu | |
- arm-unknown-linux-gnueabihf | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: miri | |
# - uses: Swatinem/rust-cache@v2 | |
# with: | |
# key: ${{ matrix.target }} | |
# cache-directories: /home/runner/.cache/miri | |
- uses: taiki-e/install-action@cross | |
if: matrix.target != 'x86_64-unknown-linux-gnu' | |
- name: Info | |
run: | | |
set -x | |
pwd | |
rustup --version | |
rustup show | |
rustup component list --installed | |
cargo --list | |
- name: Setup cross/miri | |
run: | | |
cargo miri setup | |
case ${{ matrix.target }} in | |
x86_64-unknown-linux-gnu ) | |
;; | |
* ) | |
cat <<EOF | tee Cross.toml | |
[build.env] | |
passthrough = ["CI", "RUST_BACKTRACE", "CARGO_TERM_COLOR", "CARGO_REGISTRIES_CRATES_IO_PROTOCOL", "CARGO_INCREMENTAL"] | |
EOF | |
;; | |
esac | |
- name: Test with miri | |
run: | | |
case ${{ matrix.target }} in | |
x86_64-unknown-linux-gnu ) | |
cargo miri test --features ${{ env.FEATURES }} | |
;; | |
* ) | |
cross miri test --features ${{ env.FEATURES }} --target ${{ matrix.target }} | |
;; | |
esac |