CI #7107
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 | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
pull_request: | |
# Daily cron job used to clear and rebuild cache (https://github.com/Swatinem/rust-cache/issues/181). | |
schedule: | |
- cron: '0 0 * * *' | |
# Limits workflow concurrency to only the latest commit in the PR. | |
concurrency: | |
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
env: | |
CARGO_TERM_COLOR: always | |
steps: | |
- name: Maximize build space | |
uses: easimon/maximize-build-space@master | |
with: | |
root-reserve-mb: "3072" | |
temp-reserve-mb: "3072" | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: rui314/setup-mold@v1 | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
save-if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'schedule' }} | |
- uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: taiki-e/install-action@nextest | |
- name: Clear cache | |
if: github.event_name =='schedule' | |
run: | | |
cargo clean | |
rm -rf ~/.cargo/registry | |
rm -rf ~/.cargo/git | |
- name: Compile unit tests | |
run: cargo nextest run --all-targets --all-features --workspace --locked --no-run --timings | |
- name: Run unit tests | |
run: timeout 10m cargo nextest run --no-fail-fast --all-targets --all-features --workspace --locked | |
- name: Store timings | |
uses: actions/upload-artifact@v4 | |
with: | |
name: timings | |
path: target/cargo-timings/ | |
if-no-files-found: warn | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
- uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Clear cache | |
if: github.event_name =='schedule' | |
run: | | |
cargo clean | |
rm -rf ~/.cargo/registry | |
rm -rf ~/.cargo/git | |
- run: | | |
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings -D rust_2018_idioms | |
cargo clippy --workspace --all-targets --all-features --locked --manifest-path crates/load-test/Cargo.toml -- -D warnings -D rust_2018_idioms | |
rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt | |
- run: | | |
cargo +nightly fmt --all -- --check | |
cargo +nightly fmt --all --manifest-path crates/load-test/Cargo.toml -- --check | |
doc: | |
runs-on: ubuntu-latest | |
env: | |
RUSTDOCFLAGS: "-D warnings" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
- uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Clear cache | |
if: github.event_name =='schedule' | |
run: cargo clean | |
- run: cargo doc --no-deps --document-private-items | |
dep-sort: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: baptiste0928/cargo-install@v3 | |
with: | |
crate: cargo-sort | |
version: "^1.0.9" | |
- run: | | |
cargo sort --check --workspace | |
typos: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: crate-ci/typos@v1.26.0 | |
with: | |
files: . | |
load_test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: cargo check | |
run: | | |
cd crates/load-test | |
cargo check |