-
Notifications
You must be signed in to change notification settings - Fork 0
454 lines (441 loc) · 16.9 KB
/
check-releasability.yml
File metadata and controls
454 lines (441 loc) · 16.9 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
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
name: Check Releasability
on:
push:
workflow_dispatch:
env:
RUSTFLAGS: "-D warnings"
CARGO_INCREMENTAL: 0
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_PROFILE_DEV_DEBUG: 0
jobs:
split-crates:
name: Prepare crate list
runs-on: ubuntu-latest
outputs:
crates: ${{ steps.env.outputs.crates }}
steps:
- name: Checkout Bevy
uses: actions/checkout@v4
with:
repository: bevyengine/bevy
ref: main
- name: Prepare crate list
id: env
run: |
# remove workspace members that are not published
sed -z -i 's/members = \[[^]]*\]/members = ["crates\/*"]/' Cargo.toml
crate_list=`cargo test -p 2>&1 | grep ' '`
echo "crates=`python3 -c \"import json; crate_list_str='''$crate_list''';crate_list=[crate.strip() for crate in crate_list_str.splitlines()];crate_list.sort();print(json.dumps(crate_list))\"`" >> $GITHUB_OUTPUT
list-features:
name: Prepare feature list
runs-on: ubuntu-latest
outputs:
features: ${{ steps.env.outputs.features }}
steps:
- name: Checkout Bevy
uses: actions/checkout@v4
with:
repository: bevyengine/bevy
ref: main
- name: Install toml-cli
run: |
cargo install toml-cli@0.2.3
- name: Prepare feature list
id: env
run: |
feature_list=`toml get Cargo.toml features | jq -c 'keys'`
echo "features=$feature_list" >> $GITHUB_OUTPUT
echo $feature_list
list-examples:
name: Prepare example list
runs-on: ubuntu-latest
outputs:
examples1: ${{ steps.env.outputs.examples1 }}
examples2: ${{ steps.env.outputs.examples2 }}
steps:
- name: Checkout Bevy
uses: actions/checkout@v4
with:
repository: bevyengine/bevy
ref: main
- name: Install toml-cli
run: |
cargo install toml-cli@0.2.3
- name: Prepare example list
id: env
run: |
example_list=`toml get Cargo.toml example | jq -c '[.[] | .name] | sort[:256]'`
echo "examples1=$example_list" >> $GITHUB_OUTPUT
echo $example_list
example_list=`toml get Cargo.toml example | jq -c '[.[] | .name] | sort[256:]'`
echo "examples2=$example_list" >> $GITHUB_OUTPUT
echo $example_list
owner-check:
name: Owner Check
needs: [split-crates]
runs-on: ubuntu-latest
strategy:
max-parallel: 1
fail-fast: false
matrix:
crate: ${{ fromJSON(needs.split-crates.outputs.crates) }}
owner: ["Carter Anderson", "github:bevyengine:publish"]
steps:
- name: check owner
run: |
curl --user-agent "francois@bevy.org" https://crates.io/api/v1/crates/${{ matrix.crate }}/owners | grep '${{ matrix.owner }}'
sleep 2
crate-check:
name: Crate Check
needs: [split-crates]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
crate: ${{ fromJSON(needs.split-crates.outputs.crates) }}
extra: ["", "--all-features", "--no-default-features"]
exclude:
# needs either bevy_image/zstd_rust or bevy_image/zstd_c
- crate: "bevy_anti_alias"
extra: "--all-features"
# needs a math backend
- crate: "bevy_color"
extra: "--no-default-features"
# needs either bevy_image/zstd_rust or bevy_image/zstd_c
- crate: "bevy_core_pipeline"
extra: "--all-features"
# needs either bevy_image/zstd_rust or bevy_image/zstd_c
- crate: "bevy_pbr"
extra: "--all-features"
# needs either bevy_relfect/auto_register_inventory or bevy_relfect/auto_register_static
- crate: "bevy_app"
extra: "--all-features"
# needs either bevy_relfect/auto_register_inventory or bevy_relfect/auto_register_static
- crate: "bevy_ecs"
extra: "--all-features"
# needs a math backend
- crate: "bevy_input"
extra: "--no-default-features"
# needs a math backend
- crate: "bevy_math"
extra: "--no-default-features"
# needs a math backend
- crate: "bevy_transform"
extra: "--no-default-features"
# needs a math backend
- crate: "bevy_window"
extra: "--no-default-features"
# needs a math backend
- crate: "bevy_input_focus"
extra: "--no-default-features"
# needs either x11 or wayland feature enabled
- crate: "bevy_winit"
extra: "--no-default-features"
include:
- crate: "bevy_anti_alias"
extra: "--all-features --features bevy_image/zstd_rust"
- crate: "bevy_color"
extra: "--no-default-features --features bevy_math/libm"
- crate: "bevy_core_pipeline"
extra: "--all-features --features bevy_image/zstd_rust"
- crate: "bevy_pbr"
extra: "--all-features --features bevy_image/zstd_rust"
- crate: "bevy_app"
extra: "--all-features --features bevy_reflect/auto_register_static"
- crate: "bevy_ecs"
extra: "--all-features --features bevy_reflect/auto_register_static"
- crate: "bevy_input"
extra: "--no-default-features --features bevy_math/libm"
- crate: "bevy_math"
extra: "--no-default-features --features libm"
- crate: "bevy_math"
extra: "--no-default-features --features std"
- crate: "bevy_math"
extra: "--no-default-features --features nostd-libm"
- crate: "bevy_transform"
extra: "--no-default-features --features bevy_math/libm"
- crate: "bevy_window"
extra: "--no-default-features --features bevy_math/libm"
- crate: "bevy_input_focus"
extra: "--no-default-features --features bevy_math/libm"
- crate: "bevy_winit"
extra: "--no-default-features --features winit/x11"
steps:
- name: Checkout Bevy
uses: actions/checkout@v4
with:
repository: bevyengine/bevy
ref: main
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Install Bevy dependencies
run: |
sudo apt-get update;
DEBIAN_FRONTEND=noninteractive sudo apt-get install --no-install-recommends -yq libasound2-dev libudev-dev libxkbcommon-x11-0 libwayland-dev libx264-164 libx264-dev fontconfig libfontconfig1-dev
- name: Build Crate
run: |
cargo build -p ${{ matrix.crate }} ${{ matrix.extra }}
- name: Clippy Crate
run: |
cargo clippy -p ${{ matrix.crate }} ${{ matrix.extra }} --no-deps -- -D warnings
crate-archi:
name: Toolchains
needs: [split-crates]
runs-on: ${{ matrix.target.os }}
strategy:
fail-fast: false
matrix:
crate: ${{ fromJSON(needs.split-crates.outputs.crates) }}
target:
# need to install android tooling and build with it
# - target: "aarch64-linux-android"
# os: ubuntu-latest
- target: "wasm32-unknown-unknown"
os: ubuntu-latest
- target: "aarch64-apple-ios"
os: macos-latest
exclude:
- crate: bevy_dylib
- crate: bevy_remote
steps:
- name: Checkout Bevy
uses: actions/checkout@v4
with:
repository: bevyengine/bevy
ref: main
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
targets: ${{ matrix.target.target }}
- name: Install Bevy dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update;
DEBIAN_FRONTEND=noninteractive sudo apt-get install --no-install-recommends -yq libasound2-dev libudev-dev libxkbcommon-x11-0 libwayland-dev libx264-164 libx264-dev fontconfig libfontconfig1-dev
- name: Enable android game-activity
if: matrix.target.target == 'aarch64-linux-android'
run: |
cargo add --package ${{ matrix.crate }} android-activity --features game-activity
- name: Build Crate
run: |
cargo build --target ${{ matrix.target.target }} -p ${{ matrix.crate }}
env:
RUSTFLAGS: '${{ matrix.target.target == ''wasm32-unknown-unknown'' && ''--cfg getrandom_backend="wasm_js" -D warnings'' || ''-D warnings'' }}'
- name: Clippy Crate
run: |
cargo clippy --target ${{ matrix.target.target }} -p ${{ matrix.crate }} --no-deps -- -D warnings
env:
RUSTFLAGS: '${{ matrix.target.target == ''wasm32-unknown-unknown'' && ''--cfg getrandom_backend="wasm_js" -D warnings'' || ''-D warnings'' }}'
feature-check:
name: Feature
needs: [list-features]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
feature: ${{ fromJSON(needs.list-features.outputs.features) }}
exclude:
# needs the native dlss dependency
- feature: "dlss"
# needs a zstd feature
- feature: "smaa_luts"
# needs a zstd feature
- feature: "tonemapping_luts"
# needs a zstd feature
- feature: "bluenoise_texture"
# must target android
- feature: "android-game-activity"
# must target android
- feature: "android-native-activity"
# needs to know linux windowing backend
- feature: "bevy_winit"
# needs to know linux windowing backend
- feature: "accesskit_unix"
# needs to know linux windowing backend
- feature: "custom_cursor"
# needs to know linux windowing backend
- feature: "default_app"
# needs to know linux windowing backend
- feature: "ui_bevy_render"
# needs to know linux windowing backend
- feature: "ui_api"
include:
- feature: "smaa_luts,zstd_rust"
- feature: "tonemapping_luts,zstd_rust"
- feature: "bluenoise_texture,zstd_rust"
- feature: "bevy_winit,x11"
- feature: "accesskit_unix,x11"
- feature: "custom_cursor,x11"
- feature: "default_app,x11"
- feature: "ui_bevy_render,x11"
- feature: "ui_api,x11"
steps:
- name: Checkout Bevy
uses: actions/checkout@v4
with:
repository: bevyengine/bevy
ref: main
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Install Bevy dependencies
run: |
sudo apt-get update;
DEBIAN_FRONTEND=noninteractive sudo apt-get install --no-install-recommends -yq libasound2-dev libudev-dev libxkbcommon-x11-0 libwayland-dev libx264-164 libx264-dev fontconfig libfontconfig1-dev
- name: Build Crate
run: |
cargo build --no-default-features --features ${{ matrix.feature }}
example-doc-check1:
name: Example Documentation
needs: [list-examples]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
example: ${{ fromJSON(needs.list-examples.outputs.examples1) }}
steps:
- name: Checkout Bevy
uses: actions/checkout@v4
with:
repository: bevyengine/bevy
ref: main
- name: Install toml-cli
run: |
cargo install toml-cli@0.2.3
- name: Keep initial state
id: initial
run: |
initial=`toml get Cargo.toml example | jq -c '.[] | select(.name=="${{ matrix.example }}") | ."doc-scrape-examples"'`
echo "initial=$initial" >> $GITHUB_OUTPUT
- name: Checkout Releasability
uses: actions/checkout@v4
with:
path: releasability
- name: Limit to one scrapped example
run: |
pip install tomli-w
python releasability/limit-scrapped-examples.py ${{ matrix.example }}
cat Cargo.toml | grep 'doc-scrape-examples = true' -B 3
- name: Setup Rust
uses: dtolnay/rust-toolchain@nightly
- name: Install Bevy dependencies
run: |
sudo apt-get update;
DEBIAN_FRONTEND=noninteractive sudo apt-get install --no-install-recommends -yq libasound2-dev libudev-dev libxkbcommon-x11-0 libwayland-dev libx264-164 libx264-dev fontconfig libfontconfig1-dev
- name: Document with scrapping example
id: scrape
# continue-on-error: true
run: |
cargo +nightly doc -Zunstable-options -Zrustdoc-scrape-examples --no-deps --all-features
env:
RUSTDOCFLAGS: "-Zunstable-options --cfg=docsrs --generate-link-to-definition --generate-macro-expansion --html-after-content docs-rs/trait-tags.html"
- name: Fail when needed
run: |
if [[ ${{ steps.initial.outputs.initial }} == "false" ]]; then
if [[ "${{ steps.scrape.outcome }}" == "success" ]]; then
echo "Failure expected but succeeded"
exit 2
fi
else
if [[ "${{ steps.scrape.outcome }}" == "failure" ]]; then
echo "Success expected but failed"
exit 1
fi
fi
example-doc-check2:
name: Example Documentation
needs: [list-examples]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
example: ${{ fromJSON(needs.list-examples.outputs.examples2) }}
steps:
- name: Checkout Bevy
uses: actions/checkout@v4
with:
repository: bevyengine/bevy
ref: main
- name: Install toml-cli
run: |
cargo install toml-cli@0.2.3
- name: Keep initial state
id: initial
run: |
initial=`toml get Cargo.toml example | jq -c '.[] | select(.name=="${{ matrix.example }}") | ."doc-scrape-examples"'`
echo "initial=$initial" >> $GITHUB_OUTPUT
- name: Checkout Releasability
uses: actions/checkout@v4
with:
path: releasability
- name: Limit to one scrapped example
run: |
pip install tomli-w
python releasability/limit-scrapped-examples.py ${{ matrix.example }}
cat Cargo.toml | grep 'doc-scrape-examples = true' -B 3
- name: Setup Rust
uses: dtolnay/rust-toolchain@nightly
- name: Install Bevy dependencies
run: |
sudo apt-get update;
DEBIAN_FRONTEND=noninteractive sudo apt-get install --no-install-recommends -yq libasound2-dev libudev-dev libxkbcommon-x11-0 libwayland-dev libx264-164 libx264-dev fontconfig libfontconfig1-dev
- name: Document with scrapping example
id: scrape
# continue-on-error: true
run: |
cargo +nightly doc -Zunstable-options -Zrustdoc-scrape-examples --no-deps --all-features
env:
RUSTDOCFLAGS: "-Zunstable-options --cfg=docsrs --generate-link-to-definition --generate-macro-expansion --html-after-content docs-rs/trait-tags.html"
- name: Fail when needed
run: |
if [[ ${{ steps.initial.outputs.initial }} == "false" ]]; then
if [[ "${{ steps.scrape.outcome }}" == "success" ]]; then
echo "Failure expected but succeeded"
exit 2
fi
else
if [[ "${{ steps.scrape.outcome }}" == "failure" ]]; then
echo "Success expected but failed"
exit 1
fi
fi
release-private-registry:
name: Release to Private Registry
runs-on: ubuntu-latest
steps:
- name: Starts kellnr
run: |
docker run --detach --rm -p 8000:8000 --name kellnr -e "KELLNR_ORIGIN__HOSTNAME=localhost" ghcr.io/kellnr/kellnr:5.6
- name: Checkout Bevy
uses: actions/checkout@v4
with:
repository: bevyengine/bevy
ref: main
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Install Bevy dependencies
run: |
sudo apt-get update;
DEBIAN_FRONTEND=noninteractive sudo apt-get install --no-install-recommends -yq libasound2-dev libudev-dev libxkbcommon-x11-0 fontconfig libfontconfig1-dev
- name: Setup kellnr registry
run: |
# add kellnr registry to cargo config
cat > .cargo/config.toml<< EOF
[registries.kellnr]
index = "sparse+http://localhost:8000/api/v1/crates/"
credential-provider = ["cargo:token"]
token = "Zy9HhJ02RJmg0GCrgLfaCVfU6IwDfhXD"
EOF
# remove workspace members that are not published
sed -z -i 's/members = \[[^]]*\]/members = ["crates\/*"]/' Cargo.toml
# set all local dependency as coming from the kellnr registry
find . -name Cargo.toml | xargs sed -i 's/{ path = "/{ registry = "kellnr", path = "/'
- name: Publish to kellnr registry
run: |
cargo publish --workspace --allow-dirty --no-verify --registry kellnr
- name: Stops kellnr
if: always()
run: |
docker stop kellnr