Repository navigation
401 lines (331 loc) · 12 KB
/
Copy pathci.yml
File metadata and controls
401 lines (331 loc) · 12 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
name: CI
on:
workflow_dispatch:
inputs:
run_formatting:
description: "Run formatting checks"
type: boolean
default: false
run_core:
description: "Run core checks"
type: boolean
default: false
run_web:
description: "Run web checks"
type: boolean
default: false
run_socketio:
description: "Run socketio checks"
type: boolean
default: false
run_grpc:
description: "Run grpc checks"
type: boolean
default: false
run_jobs:
description: "Run jobs checks"
type: boolean
default: false
run_events:
description: "Run events checks"
type: boolean
default: false
run_deps:
description: "Run dependency checks"
type: boolean
default: false
run_mixed:
description: "Run mixed web+grpc checks"
type: boolean
default: false
run_examples:
description: "Check example crates"
type: boolean
default: false
push:
branches: ["main"]
paths-ignore:
- ".editorconfig"
- "README.md"
- "LICENSE"
- ".gitignore"
- "*.md"
- ".vscode/**"
- ".zed/**"
pull_request:
branches: ["main"]
paths-ignore:
- ".editorconfig"
- "README.md"
- "LICENSE"
- ".gitignore"
- "*.md"
- ".vscode/**"
- ".zed/**"
permissions:
contents: read
pull-requests: read
jobs:
changes:
runs-on: ubuntu-latest
outputs:
core: ${{ steps.filter.outputs.core }}
grpc: ${{ steps.filter.outputs.grpc }}
web: ${{ steps.filter.outputs.web }}
socketio: ${{ steps.filter.outputs.socketio }}
jobs: ${{ steps.filter.outputs.jobs }}
events: ${{ steps.filter.outputs.events }}
mixed: ${{ steps.filter.outputs.mixed }}
formatting: ${{ steps.filter.outputs.formatting }}
deps: ${{ steps.filter.outputs.deps }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
core:
- 'crates/sword-core/**'
- 'crates/sword/**'
- 'crates/sword-layers/**'
- 'crates/sword-macros/**'
- 'rust-toolchain.toml'
- '.github/workflows/**'
grpc:
- 'crates/sword-grpc/**'
- 'tests/sword-grpc/**'
- 'examples/grpc/**'
web:
- 'crates/sword-web/**'
- 'tests/sword-web/**'
- 'examples/web/**'
- 'examples/interceptors/**'
socketio:
- 'crates/sword-socketio/**'
- 'crates/sword-web/**'
- 'tests/sword-socketio/**'
- 'examples/socketio/**'
- 'examples/interceptors/**'
jobs:
- 'crates/sword-jobs/**'
- 'tests/sword-jobs/**'
events:
- 'crates/sword-events/**'
- 'tests/sword-events/**'
- 'examples/nats/**'
mixed:
- 'tests/sword-mixed/**'
formatting:
- '**/*.rs'
- 'rustfmt.toml'
- 'rust-toolchain.toml'
- '.github/workflows/**'
deps:
- 'Cargo.toml'
- 'Cargo.lock'
formatting:
needs: changes
if: needs.changes.outputs.formatting == 'true' || inputs.run_formatting == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Check formatting
run: cargo fmt --all -- --check
core-checks:
needs: changes
if: needs.changes.outputs.core == 'true' || inputs.run_core == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: Run clippy (sword-core)
run: cargo clippy -p sword-core --all-targets -- -D warnings
- name: Run clippy (sword)
run: cargo clippy -p sword --all-targets -- -D warnings
- name: Run clippy (sword-layers)
run: cargo clippy -p sword-layers --all-targets --all-features -- -D warnings
- name: Run clippy (sword-macros, all features)
run: cargo clippy -p sword-macros --all-targets --all-features -- -D warnings
- name: Build docs (sword-core)
env:
RUSTDOCFLAGS: "-D warnings"
run: cargo doc -p sword-core --no-deps
- name: Build docs (sword)
env:
RUSTDOCFLAGS: "-D warnings"
run: cargo doc -p sword --no-deps
- name: Build docs (sword-layers)
env:
RUSTDOCFLAGS: "-D warnings"
run: cargo doc -p sword-layers --no-deps --all-features
- name: Run unit tests
run: |
cargo test -p sword --lib
cargo test -p sword-core --lib
cargo test -p sword-macros --lib
cargo test -p sword-layers --all-features
grpc-checks:
needs: changes
if: needs.changes.outputs.grpc == 'true' || needs.changes.outputs.core == 'true' || needs.changes.outputs.deps == 'true' || inputs.run_grpc == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: Install protoc
uses: arduino/setup-protoc@v3
- name: Run clippy (sword-grpc)
run: cargo clippy -p sword-grpc --all-targets --all-features -- -D warnings
- name: Run clippy (sword-macros)
run: cargo clippy -p sword-macros --all-targets --features grpc -- -D warnings
- name: Run tests (sword-grpc-tests)
run: cargo test -p sword-grpc-tests -- --test-threads=1
- name: Build docs (sword-grpc)
env:
RUSTDOCFLAGS: "-D warnings"
run: cargo doc -p sword-grpc --no-deps --all-features
web-checks:
needs: changes
if: needs.changes.outputs.web == 'true' || needs.changes.outputs.core == 'true' || needs.changes.outputs.deps == 'true' || inputs.run_web == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: Run clippy (sword-web)
run: cargo clippy -p sword-web --all-targets --all-features -- -D warnings
- name: Run clippy (sword-macros)
run: cargo clippy -p sword-macros --all-targets --features web -- -D warnings
- name: Run tests (sword-web-tests)
run: cargo test -p sword-web-tests
- name: Build docs (sword-web)
env:
RUSTDOCFLAGS: "-D warnings"
run: cargo doc -p sword-web --no-deps --all-features
socketio-checks:
needs: changes
if: needs.changes.outputs.socketio == 'true' || needs.changes.outputs.core == 'true' || needs.changes.outputs.deps == 'true' || inputs.run_socketio == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: Run clippy (sword-socketio)
run: cargo clippy -p sword-socketio --all-targets --all-features -- -D warnings
- name: Run clippy (sword-macros)
run: cargo clippy -p sword-macros --all-targets --features socketio -- -D warnings
- name: Run tests (sword-socketio-tests)
run: cargo test -p sword-socketio-tests
- name: Build docs (sword-socketio)
env:
RUSTDOCFLAGS: "-D warnings"
run: cargo doc -p sword-socketio --no-deps --all-features
jobs-checks:
needs: changes
if: needs.changes.outputs.jobs == 'true' || needs.changes.outputs.core == 'true' || needs.changes.outputs.deps == 'true' || inputs.run_jobs == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: Run clippy (sword-jobs)
run: cargo clippy -p sword-jobs --all-targets -- -D warnings
- name: Run clippy (sword-macros)
run: cargo clippy -p sword-macros --all-targets --features jobs -- -D warnings
- name: Run tests (sword-jobs-tests)
run: cargo test -p sword-jobs-tests
- name: Build docs (sword-jobs)
env:
RUSTDOCFLAGS: "-D warnings"
run: cargo doc -p sword-jobs --no-deps
events-checks:
needs: changes
if: needs.changes.outputs.events == 'true' || needs.changes.outputs.core == 'true' || needs.changes.outputs.deps == 'true' || inputs.run_events == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: Run clippy (sword-events)
run: cargo clippy -p sword-events --all-targets --all-features -- -D warnings
- name: Run clippy (sword-macros)
run: cargo clippy -p sword-macros --all-targets --features events -- -D warnings
- name: Run tests (sword-events-tests)
run: cargo test -p sword-events-tests
- name: Build docs (sword-events)
env:
RUSTDOCFLAGS: "-D warnings"
run: cargo doc -p sword-events --no-deps --all-features
deps-checks:
needs: changes
if: needs.changes.outputs.deps == 'true' || inputs.run_deps == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: Install protoc
uses: arduino/setup-protoc@v3
- name: Check workspace compiles
run: cargo check --workspace --all-targets --all-features --locked
- name: Run unit tests
run: |
cargo test -p sword --lib
cargo test -p sword-macros --lib
mixed-checks:
needs: changes
if: needs.changes.outputs.mixed == 'true' || needs.changes.outputs.web == 'true' || needs.changes.outputs.grpc == 'true' || needs.changes.outputs.core == 'true' || needs.changes.outputs.deps == 'true' || inputs.run_mixed == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: Install protoc
uses: arduino/setup-protoc@v3
- name: Run mixed app tests
run: cargo test -p sword-mixed-tests -- --test-threads=1
examples-checks:
needs: changes
if: needs.changes.outputs.core == 'true' || needs.changes.outputs.web == 'true' || needs.changes.outputs.grpc == 'true' || needs.changes.outputs.socketio == 'true' || needs.changes.outputs.jobs == 'true' || needs.changes.outputs.events == 'true' || needs.changes.outputs.deps == 'true' || inputs.run_examples == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: Install protoc
uses: arduino/setup-protoc@v3
- name: Check examples compile
run: cargo check --workspace --bins --locked