Skip to content

#[builder(field)]

#[builder(field)] #720

Workflow file for this run

name: ci
on:
workflow_dispatch:
merge_group:
pull_request:
push:
branches:
- master
- hotfix/*
defaults:
run:
shell: bash
env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
RUSTDOCFLAGS: --deny warnings
RUSTFLAGS: --deny warnings
# This disables incremental compilation for workspace packages and path deps.
# All other dependencies including registry deps will still use the incremental cache.
CARGO_INCREMENTAL: 0
jobs:
# Sanity-check that benchmarks work
runtime-benchmarks:
runs-on: ubuntu-latest
strategy:
matrix:
benchmark:
- args_3
- args_5
- args_10_alloc
- args_10_structs
- args_10
- args_20
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: sudo apt-get install -y valgrind
- run: cd ./benchmarks/runtime && ./run.sh ${{ matrix.benchmark }}
compilation-benchmarks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: ./scripts/install/hyperfine.sh
- run: cd ./benchmarks/compilation && ./run.sh
version-sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ./scripts/sync-version.sh
env:
# Use `cargo` pre-installed in the Github Managed runner image
RUSTUP_TOOLCHAIN: stable
- run: >-
git diff --exit-code --color=always || ( echo "Version is not
synchronized in other files. See diff above" && exit 1 )
cargo-lock:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# There is a pre-installed cargo in the Github Managed runner image
# which is totally fine for simple `cargo fetch` usage.
- run: cargo +stable fetch
# Manually validate that Cargo.lock is not changed by cargo fetch
# We do this manually because `cargo fetch --locked` doesn't show
# the diff that it wants to apply to Cargo.lock and so it may not
# be obvious what's going on. For example, there may be a tricky
# scenario when `Cargo.lock` is up-to-date on the current branch,
# but when rebased on `master` it is out-of-date because.
- name: Validate Cargo.lock is up-to-date
run: >-
git diff --exit-code --color=always || ( echo "Cargo.lock is
out-of-date. See the diff above. Try rebasing on master" && exit 1 )
test-stable:
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
# rust-src is required to make sure compile errors on CI are rendered
# the same as locally. The `rust-src` component is installed by default
# locally, and with its presence compile error messages can show snippets
# of rust standard library code.
components: rust-src
- run: cargo clippy --all-features --all-targets --locked
- run: cargo test --locked --all-features --all-targets
- run: cargo test --locked --all-features --doc
- run: cd bon && cargo test --locked --no-default-features --features=experimental-overwritable
- run: cd bon && cargo test --locked --no-default-features --features=experimental-overwritable,alloc
- run: cd bon && cargo test --locked --no-default-features --features=experimental-overwritable,implied-bounds
- run: cd bon && cargo test --locked --no-default-features --features=experimental-overwritable,alloc,implied-bounds
test-msrv:
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
toolchain: 1.59.0
- run: ./scripts/test-msrv.sh
test-unstable:
runs-on: ubuntu-latest
# This job is optional to pass. It notifies us about the potential breakages
# in the future Rust toolchain versions.
continue-on-error: true
strategy:
fail-fast: false
matrix:
toolchain: [beta, nightly]
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
- run: |
cargo +${{ matrix.toolchain }} clippy --all-features --all-targets --locked \
-- \
--allow edition-2024-expr-fragment-specifier \
--allow if_let_rescope \
--allow impl-trait-overcaptures
cargo-miri:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly-2024-10-30
components: miri, rust-src
- run: |
cargo miri test --locked --all-features --all-targets \
--workspace --exclude runtime-benchmarks
env:
RUSTFLAGS: >-
--deny warnings
--allow edition-2024-expr-fragment-specifier
--allow if_let_rescope
--allow impl-trait-overcaptures
cargo-doc:
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo doc --no-deps
cargo-fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo fmt --check
# Check for unused dependencies that uses simple regex search,
# meaning it's ⚡️ blazingly ⚡️ fast
cargo-machete:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: scripts/install/cargo-machete.sh
- run: cargo-machete
# Check the formatting of TOML files in the repository
taplo-fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: scripts/install/taplo.sh
- run: taplo fmt --check
# Check the formatting of Markdown, TS, JS, JSON, YAML files in the repository
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npx prettier --check .
# Check for typos in the repository based on a static dictionary
typos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crate-ci/[email protected]
website-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Needed for "lastUpdated" property in VitePress
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: website/package-lock.json
- run: cd website && npm ci
- run: scripts/validate-links.sh