Skip to content

perf: small optimizations #64

perf: small optimizations

perf: small optimizations #64

Workflow file for this run

on:
push:
branches:
- main
pull_request:
branches:
- main
name: ci
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
RUST_BACKTRACE: 1
# Pin the nightly toolchain to prevent breakage.
# This should be occasionally updated.
RUST_NIGHTLY_TOOLCHAIN: nightly-2024-11-19
jobs:
env:
runs-on: ubuntu-latest
outputs:
rust-versions: ${{ steps.definitions.outputs.versions }}
msrv: ${{ steps.definitions.outputs.msrv }}
steps:
- uses: actions/checkout@v4
- name: Evaluate definitions
id: definitions
run: |
export MSRV=$(rustup show | awk 'NF' | awk 'END{print $2}')
echo "msrv=$MSRV" >> "$GITHUB_OUTPUT"
export RAW_VERSIONS="stable $RUST_NIGHTLY_TOOLCHAIN $MSRV"
export VERSIONS=$(echo $RAW_VERSIONS | jq -scR 'rtrimstr("\n")|split(" ")|.')
echo "versions=$VERSIONS" >> "$GITHUB_OUTPUT"
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install rust toolchain
id: toolchain
run: |
rustup toolchain install ${{ env.RUST_NIGHTLY_TOOLCHAIN }} --profile minimal --component rustfmt
rustup override set ${{ env.RUST_NIGHTLY_TOOLCHAIN }}
- name: Run cargo fmt
run: |
cargo fmt --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install rust toolchain
id: toolchain
run: |
rustup toolchain install stable --profile minimal --component clippy
rustup override set stable
- uses: camshaft/rust-cache@v1
- name: Run cargo clippy
run: |
cargo clippy --all-features --all-targets --workspace
udeps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install toolchain
id: toolchain
run: |
rustup toolchain install ${{ env.RUST_NIGHTLY_TOOLCHAIN }} --profile minimal
rustup override set ${{ env.RUST_NIGHTLY_TOOLCHAIN }}
- uses: camshaft/rust-cache@v1
- uses: camshaft/install@v1
with:
crate: cargo-udeps
- name: Run cargo udeps
run: cargo udeps --workspace --all-targets
env:
RUSTC_WRAPPER: ""
test:
runs-on: ${{ matrix.os }}
needs: env
strategy:
matrix:
rust: ${{ fromJson(needs.env.outputs.rust-versions) }}
os: [ubuntu-latest, macOS-latest, windows-latest]
features: [default]
include:
- rust: stable
os: ubuntu-latest
features: tracing,metrics
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Install toolchain
id: toolchain
run: |
rustup toolchain install ${{ matrix.rust }}
rustup override set ${{ matrix.rust }}
- uses: camshaft/rust-cache@v1
with:
key: ${{ matrix.target }}
- name: Run tests
run: |
cargo test ${{ matrix.features != 'default' && '--features' || '' }} ${{ matrix.features }}
miri:
runs-on: ubuntu-latest
strategy:
matrix:
crate: [bach]
steps:
- uses: actions/checkout@v4
- name: Install toolchain
id: toolchain
run: |
rustup toolchain install ${{ env.RUST_NIGHTLY_TOOLCHAIN }} --component miri,rust-src
rustup override set ${{ env.RUST_NIGHTLY_TOOLCHAIN }}
- uses: camshaft/rust-cache@v1
with:
key: ${{ matrix.crate }}
- name: ${{ matrix.crate }}
# Disabling capture speeds up miri execution: https://github.com/rust-lang/miri/issues/1780#issuecomment-830664528
run: cd ${{ matrix.crate }} && cargo miri test -- --nocapture
env:
# needed to read corpus files from filesystem
MIRIFLAGS: -Zmiri-disable-isolation