Skip to content

CI

CI #422

Workflow file for this run

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:
remove-dotnet: "true"
remove-android: "true"
remove-haskell: "true"
remove-codeql: "true"
remove-docker-images: "true"
root-reserve-mb: "2048"
temp-reserve-mb: "2048"
- 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' }}
- 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
# --build-jobs 1 as we are constantly OOMing during compilation.
run: cargo nextest run --all-targets --all-features --workspace --locked --no-run --timings --build-jobs 1
- 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/[email protected]
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