-
Notifications
You must be signed in to change notification settings - Fork 4
151 lines (129 loc) · 7.04 KB
/
pr.yml
File metadata and controls
151 lines (129 loc) · 7.04 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: PR
on:
pull_request:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# https://releases.rs/docs/1.88.0/ release date
NIGHTLY_TOOLCHAIN: nightly-2025-06-23
# Cancel in progress workflows on pull_requests.
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout
uses: actions/checkout@v4
- name: ☁️ Install Nightly
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
components: rustfmt
- name: 📋 Format Check
run: cargo +${{ env.NIGHTLY_TOOLCHAIN }} fmt -- --check
filter:
runs-on: ubuntu-latest
outputs:
top_toml: ${{ steps.filter.outputs.top_toml }}
aot: ${{ steps.filter.outputs.aot }}
checkpoint: ${{ steps.filter.outputs.checkpoint }}
common: ${{ steps.filter.outputs.common }}
snops: ${{ steps.filter.outputs.snops }}
agent: ${{ steps.filter.outputs.agent }}
scli: ${{ steps.filter.outputs.scli }}
steps:
- uses: actions/checkout@v4
- id: filter
uses: dorny/paths-filter@v3
with:
base: ${{ github.ref_name }}
filters: |
top_toml:
- 'Cargo.toml'
aot:
- 'crates/aot/**/*'
checkpoint:
- 'crates/checkpoint/**/*'
snops:
- 'crates/controlplane/**/*'
agent:
- 'crates/agent/**/*'
scli:
- 'crates/cli/**/*'
common:
- 'crates/common/**/*'
crate-checks:
runs-on: ubuntu-latest
needs: [filter]
env:
TOP_TOML: ${{ needs.filter.outputs.top_toml }}
AOT: ${{ needs.filter.outputs.aot }}
CHECKPOINT: ${{ needs.filter.outputs.checkpoint }}
COMMON: ${{ needs.filter.outputs.common }}
SNOPS: ${{ needs.filter.outputs.snops }}
AGENT: ${{ needs.filter.outputs.agent }}
SCLI: ${{ needs.filter.outputs.scli }}
strategy:
fail-fast: false
matrix:
crate:
- { name: "aot", package: "snarkos-aot", dir: "crates/aot" }
- {
name: "checkpoint",
package: "snops-checkpoint",
dir: "crates/checkpoint",
}
- { name: "common", package: "snops-common", dir: "crates/common" }
- { name: "snops", package: "snops", dir: "crates/controlplane" }
- { name: "agent", package: "snops-agent", dir: "crates/agent" }
- { name: "snops-cli", package: "snops-cli", dir: "crates/cli" }
steps:
- name: 📥 Checkout
uses: actions/checkout@v4
- name: 🥬 Use Mold Linker
uses: rui314/setup-mold@v1
- name: ☁️ Install Nightly
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
components: rustc-codegen-cranelift-preview clippy
- name: 🫙 Cache
uses: Swatinem/rust-cache@v2
with:
key: cache-v1
cache-on-failure: true
- name: ☁️ Install Nextest
uses: taiki-e/install-action@nextest
- name: ☁️ Install cargo-machete
uses: taiki-e/install-action@cargo-machete
- name: ☁️ Install cargo-binstall
uses: taiki-e/install-action@cargo-binstall
- name: ☁️ Install cargo-msrv
run: cargo binstall --version 0.18.1 --no-confirm cargo-msrv --force
- name: ☁️ Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: ☁️ Install cargo-minimal-versions
uses: taiki-e/install-action@cargo-minimal-versions
- name: 🧪 Test ${{ matrix.crate.name }}
if: always() && ${{ env.TOP_TOML == 'true' || (matrix.crate.name == 'aot' && env.AOT == 'true') || (matrix.crate.name == 'checkpoint' && env.CHECKPOINT == 'true') || (matrix.crate.name == 'common' && env.COMMON == 'true') || (matrix.crate.name == 'snops' && env.CONTROL_PLANE == 'true') || (matrix.crate.name == 'agent' && env.AGENT == 'true') || (matrix.crate.name == 'scli' && env.SCLI == 'true') }}
env:
RUSTFLAGS: ${{ (matrix.crate.name == 'aot' || matrix.crate.name == 'checkpoint' || matrix.crate.name == 'common' || matrix.crate.name == 'snops') && '-Zcodegen-backend=cranelift' || '' }}
run: cargo +${{ env.NIGHTLY_TOOLCHAIN }} nextest run -p ${{ matrix.crate.package }} --verbose --fail-fast --all-features --no-tests=warn
- name: 🚯 Unused Deps ${{ matrix.crate.name }}
if: always() && ${{ env.TOP_TOML == 'true' || (matrix.crate.name == 'aot' && env.AOT == 'true') || (matrix.crate.name == 'checkpoint' && env.CHECKPOINT == 'true') || (matrix.crate.name == 'common' && env.COMMON == 'true') || (matrix.crate.name == 'snops' && env.CONTROL_PLANE == 'true') || (matrix.crate.name == 'agent' && env.AGENT == 'true') || (matrix.crate.name == 'scli' && env.SCLI == 'true') }}
run: cd ${{ matrix.crate.dir }} && cargo +${{ env.NIGHTLY_TOOLCHAIN }} machete
- name: 🦀 MSRV ${{ matrix.crate.name }}
if: always() && ${{ env.TOP_TOML == 'true' || (matrix.crate.name == 'aot' && env.AOT == 'true') || (matrix.crate.name == 'checkpoint' && env.CHECKPOINT == 'true') || (matrix.crate.name == 'common' && env.COMMON == 'true') || (matrix.crate.name == 'snops' && env.CONTROL_PLANE == 'true') || (matrix.crate.name == 'agent' && env.AGENT == 'true') || (matrix.crate.name == 'scli' && env.SCLI == 'true') }}
run: cargo msrv --manifest-path ${{ matrix.crate.dir }}/Cargo.toml verify --output-format minimal
- name: 🕵️ Minimal Versions ${{ matrix.crate.name }}
if: always() && ${{ env.TOP_TOML == 'true' || (matrix.crate.name == 'aot' && env.AOT == 'true') || (matrix.crate.name == 'checkpoint' && env.CHECKPOINT == 'true') || (matrix.crate.name == 'common' && env.COMMON == 'true') || (matrix.crate.name == 'snops' && env.CONTROL_PLANE == 'true') || (matrix.crate.name == 'agent' && env.AGENT == 'true') || (matrix.crate.name == 'scli' && env.SCLI == 'true') }}
continue-on-error: true
run: cargo +${{ env.NIGHTLY_TOOLCHAIN }} minimal-versions check -p ${{ matrix.crate.package }}
- name: 📋 Clippy ${{ matrix.crate.name }}
if: always() && ${{ env.TOP_TOML == 'true' || (matrix.crate.name == 'aot' && env.AOT == 'true') || (matrix.crate.name == 'checkpoint' && env.CHECKPOINT == 'true') || (matrix.crate.name == 'common' && env.COMMON == 'true') || (matrix.crate.name == 'snops' && env.CONTROL_PLANE == 'true') || (matrix.crate.name == 'agent' && env.AGENT == 'true') || (matrix.crate.name == 'scli' && env.SCLI == 'true') }}
env:
RUSTFLAGS: ${{ (matrix.crate.name == 'aot' || matrix.crate.name == 'checkpoint' || matrix.crate.name == 'common' || matrix.crate.name == 'snops') && '-Zcodegen-backend=cranelift' || '' }}
run: cargo +${{ env.NIGHTLY_TOOLCHAIN }} clippy -p ${{ matrix.crate.package }} --all-targets --locked -- -D warnings