name: Rust CI
on:
push:
branches: [ "main" ]
paths-ignore:
- "**/*.md"
- "docs/**"
pull_request:
branches: [ "main" ]
paths-ignore:
- "**/*.md"
- "docs/**"
jobs:
checks:
name: Format, Clippy, and Test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache Cargo dependencies and build artifacts
uses: Swatinem/rust-cache@v2
- name: Check Format
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
- name: Run tests
run: cargo test --all-features --locked --verbose
proto-vendored-up-to-date:
name: Vendored proto code is up to date
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo dependencies and build artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: tools/gen-proto -> tools/gen-proto/target
- name: Regenerate vendored proto code
run: cargo run --manifest-path tools/gen-proto/Cargo.toml --locked
- name: Verify src/proto/generated/ has no drift
run: |
if ! git diff --exit-code -- src/proto/generated; then
echo "::error::src/proto/generated/ is out of date. Run:" >&2
echo " cargo run --manifest-path tools/gen-proto/Cargo.toml" >&2
echo "and commit the result." >&2
exit 1
fi