-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (57 loc) · 2.75 KB
/
Copy pathrust.yml
File metadata and controls
62 lines (57 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: rust
# Build, lint, and test the Rust crate on every PR and on pushes to main/hotfix branches.
# Mirrors the build-control jobs in malbeclabs/doublezero (.github/workflows/rust.yml),
# adapted for this single-crate project: no Solana/agave tooling or validator job, and the
# `make` targets are inlined as direct cargo commands.
on:
push:
branches: [main, 'hotfix/**']
pull_request:
# Least-privilege default: this workflow only reads the repo.
permissions:
contents: read
jobs:
rust-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
# dtolnay/rust-toolchain selects the toolchain from the @ref (a branch); pinned to a
# SHA we must name the toolchain explicitly via `toolchain:`.
- uses: dtolnay/rust-toolchain@fa04a1451ff1842e2626ccb99004d0195b455a88 # master
with:
toolchain: stable
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
# `--workspace` is required: this is a root-package workspace (root `Cargo.toml` has both
# `[package]` and `[workspace]`), so a bare `cargo build` selects only the root crate and would
# never compile the `shred-proxy` member. Same for clippy/test below.
- run: cargo build --workspace --release --verbose
rust-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: dtolnay/rust-toolchain@fa04a1451ff1842e2626ccb99004d0195b455a88 # master
with:
toolchain: stable
components: clippy
# Nightly is only needed for rustfmt's imports_granularity option (matches the
# reference repo's `cargo +nightly fmt` formatting contract).
- uses: dtolnay/rust-toolchain@fa04a1451ff1842e2626ccb99004d0195b455a88 # master
with:
toolchain: nightly
components: rustfmt
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: rustfmt
run: cargo +nightly fmt --all -- --check --config imports_granularity=Crate
# The nightly toolchain above is now the default, but clippy is only installed on
# stable — pin clippy to stable so it doesn't resolve to the (clippy-less) nightly.
- name: clippy
run: cargo +stable clippy --workspace --all-targets -- -Dclippy::all -Dwarnings
rust-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: dtolnay/rust-toolchain@fa04a1451ff1842e2626ccb99004d0195b455a88 # master
with:
toolchain: stable
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- run: cargo test --workspace --all-features --verbose