Skip to content

Commit 3389f8b

Browse files
committed
use cache in other jobs
1 parent 52534ab commit 3389f8b

File tree

3 files changed

+151
-60
lines changed

3 files changed

+151
-60
lines changed

.github/workflows/ci.yml

Lines changed: 76 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,19 @@ jobs:
3030
timeout-minutes: 30
3131
steps:
3232
- uses: actions/checkout@v4
33-
- uses: actions/cache@v4
33+
- uses: actions/cache/restore@v4
3434
with:
35+
# key won't match, will rely on restore-keys
36+
key: ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
37+
restore-keys: |
38+
${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
39+
${{ runner.os }}-stable--
3540
path: |
3641
~/.cargo/bin/
3742
~/.cargo/registry/index/
3843
~/.cargo/registry/cache/
3944
~/.cargo/git/db/
4045
target/
41-
key: ${{ runner.os }}-cargo-build-stable-${{ hashFiles('**/Cargo.toml') }}
4246
- uses: dtolnay/rust-toolchain@stable
4347
- name: Install Linux dependencies
4448
uses: ./.github/actions/install-linux-deps
@@ -53,15 +57,19 @@ jobs:
5357
timeout-minutes: 30
5458
steps:
5559
- uses: actions/checkout@v4
56-
- uses: actions/cache@v4
60+
- uses: actions/cache/restore@v4
5761
with:
62+
# key won't match, will rely on restore-keys
63+
key: ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
64+
restore-keys: |
65+
${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
66+
${{ runner.os }}-stable--
5867
path: |
5968
~/.cargo/bin/
6069
~/.cargo/registry/index/
6170
~/.cargo/registry/cache/
6271
~/.cargo/git/db/
6372
target/
64-
key: ${{ runner.os }}-cargo-ci-${{ hashFiles('**/Cargo.toml') }}
6573
- uses: dtolnay/rust-toolchain@stable
6674
with:
6775
components: rustfmt, clippy
@@ -79,15 +87,19 @@ jobs:
7987
timeout-minutes: 60
8088
steps:
8189
- uses: actions/checkout@v4
82-
- uses: actions/cache@v4
90+
- uses: actions/cache/restore@v4
8391
with:
92+
# key won't match, will rely on restore-keys
93+
key: ${{ runner.os }}-${{ env.NIGHTLY_TOOLCHAIN }}--${{ hashFiles('**/Cargo.toml') }}-
94+
restore-keys: |
95+
${{ runner.os }}-${{ env.NIGHTLY_TOOLCHAIN }}--${{ hashFiles('**/Cargo.toml') }}-
96+
${{ runner.os }}-${{ env.NIGHTLY_TOOLCHAIN }}--
8497
path: |
8598
~/.cargo/bin/
8699
~/.cargo/registry/index/
87100
~/.cargo/registry/cache/
88101
~/.cargo/git/db/
89102
target/
90-
key: ${{ runner.os }}-cargo-miri-${{ hashFiles('**/Cargo.toml') }}
91103
- uses: dtolnay/rust-toolchain@master
92104
with:
93105
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
@@ -110,17 +122,19 @@ jobs:
110122
needs: ci
111123
steps:
112124
- uses: actions/checkout@v4
113-
- uses: actions/cache@v4
125+
- uses: actions/cache/restore@v4
114126
with:
127+
# key won't match, will rely on restore-keys
128+
key: ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
129+
restore-keys: |
130+
${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
131+
${{ runner.os }}-stable--
115132
path: |
116133
~/.cargo/bin/
117134
~/.cargo/registry/index/
118135
~/.cargo/registry/cache/
119136
~/.cargo/git/db/
120137
target/
121-
crates/bevy_ecs_compile_fail_tests/target/
122-
crates/bevy_reflect_compile_fail_tests/target/
123-
key: ${{ runner.os }}-cargo-check-compiles-${{ hashFiles('**/Cargo.toml') }}
124138
- uses: dtolnay/rust-toolchain@stable
125139
with:
126140
toolchain: stable
@@ -129,47 +143,53 @@ jobs:
129143
- name: Check Compile
130144
# See tools/ci/src/main.rs for the commands this runs
131145
run: cargo run -p ci -- compile
146+
132147
check-compiles-no-std:
133148
runs-on: ubuntu-latest
134149
timeout-minutes: 30
135150
needs: ci
136151
steps:
137152
- uses: actions/checkout@v4
138-
- uses: actions/cache@v4
153+
- uses: actions/cache/restore@v4
139154
with:
155+
# key won't match, will rely on restore-keys
156+
key: ${{ runner.os }}-stable-x86_64-unknown-none-${{ hashFiles('**/Cargo.toml') }}-
157+
restore-keys: |
158+
${{ runner.os }}-stable-x86_64-unknown-none-${{ hashFiles('**/Cargo.toml') }}-
159+
${{ runner.os }}-stable-x86_64-unknown-none-
140160
path: |
141161
~/.cargo/bin/
142162
~/.cargo/registry/index/
143163
~/.cargo/registry/cache/
144164
~/.cargo/git/db/
145165
target/
146-
crates/bevy_ecs_compile_fail_tests/target/
147-
crates/bevy_reflect_compile_fail_tests/target/
148-
key: ${{ runner.os }}-cargo-check-compiles-no-std-${{ hashFiles('**/Cargo.toml') }}
149166
- uses: dtolnay/rust-toolchain@stable
150167
with:
151168
targets: x86_64-unknown-none
152169
- name: Install Linux dependencies
153170
uses: ./.github/actions/install-linux-deps
154171
- name: Check Compile
155172
run: cargo check -p bevy --no-default-features --features default_no_std --target x86_64-unknown-none
173+
156174
check-compiles-no-std-portable-atomic:
157175
runs-on: ubuntu-latest
158176
timeout-minutes: 30
159177
needs: ci
160178
steps:
161179
- uses: actions/checkout@v4
162-
- uses: actions/cache@v4
180+
- uses: actions/cache/restore@v4
163181
with:
182+
# key won't match, will rely on restore-keys
183+
key: ${{ runner.os }}-stable-thumbv6m-none-eabi-${{ hashFiles('**/Cargo.toml') }}-
184+
restore-keys: |
185+
${{ runner.os }}-stable-thumbv6m-none-eabi-${{ hashFiles('**/Cargo.toml') }}-
186+
${{ runner.os }}-stable-thumbv6m-none-eabi-
164187
path: |
165188
~/.cargo/bin/
166189
~/.cargo/registry/index/
167190
~/.cargo/registry/cache/
168191
~/.cargo/git/db/
169192
target/
170-
crates/bevy_ecs_compile_fail_tests/target/
171-
crates/bevy_reflect_compile_fail_tests/target/
172-
key: ${{ runner.os }}-cargo-check-compiles-no-std-portable-atomic-${{ hashFiles('**/Cargo.toml') }}
173193
- uses: dtolnay/rust-toolchain@stable
174194
with:
175195
targets: thumbv6m-none-eabi
@@ -184,40 +204,47 @@ jobs:
184204
needs: ci
185205
steps:
186206
- uses: actions/checkout@v4
187-
- uses: actions/cache@v4
207+
- uses: actions/cache/restore@v4
188208
with:
209+
# key won't match, will rely on restore-keys
210+
key: ${{ runner.os }}-stable-x86_64-unknown-none-${{ hashFiles('**/Cargo.toml') }}-
211+
restore-keys: |
212+
${{ runner.os }}-stable-x86_64-unknown-none-${{ hashFiles('**/Cargo.toml') }}-
213+
${{ runner.os }}-stable-x86_64-unknown-none-
189214
path: |
190215
~/.cargo/bin/
191216
~/.cargo/registry/index/
192217
~/.cargo/registry/cache/
193218
~/.cargo/git/db/
194219
target/
195-
crates/bevy_ecs_compile_fail_tests/target/
196-
crates/bevy_reflect_compile_fail_tests/target/
197-
key: ${{ runner.os }}-cargo-check-compiles-no-std-examples-${{ hashFiles('**/Cargo.toml') }}
198220
- uses: dtolnay/rust-toolchain@stable
199221
with:
200222
targets: x86_64-unknown-none
201223
- name: Install Linux dependencies
202224
uses: ./.github/actions/install-linux-deps
203225
- name: Check Compile
204226
run: cd examples/no_std/library && cargo check --no-default-features --features libm,critical-section --target x86_64-unknown-none
227+
#TODO: features
205228

206229
build-wasm:
207230
runs-on: ubuntu-latest
208231
timeout-minutes: 30
209232
needs: build
210233
steps:
211234
- uses: actions/checkout@v4
212-
- uses: actions/cache@v4
235+
- uses: actions/cache/restore@v4
213236
with:
237+
# key won't match, will rely on restore-keys
238+
key: ${{ runner.os }}-stable-wasm32-unknown-unknown-${{ hashFiles('**/Cargo.toml') }}-
239+
restore-keys: |
240+
${{ runner.os }}-stable-wasm32-unknown-unknown-${{ hashFiles('**/Cargo.toml') }}-
241+
${{ runner.os }}-stable-wasm32-unknown-unknown-
214242
path: |
215243
~/.cargo/bin/
216244
~/.cargo/registry/index/
217245
~/.cargo/registry/cache/
218246
~/.cargo/git/db/
219247
target/
220-
key: ubuntu-assets-cargo-build-wasm-stable-${{ hashFiles('**/Cargo.toml') }}
221248
- uses: dtolnay/rust-toolchain@stable
222249
with:
223250
target: wasm32-unknown-unknown
@@ -230,15 +257,19 @@ jobs:
230257
needs: build
231258
steps:
232259
- uses: actions/checkout@v4
233-
- uses: actions/cache@v4
260+
- uses: actions/cache/restore@v4
234261
with:
262+
# key won't match, will rely on restore-keys
263+
key: ${{ runner.os }}-${{ env.NIGHTLY_TOOLCHAIN }}-wasm32-unknown-unknown-${{ hashFiles('**/Cargo.toml') }}-
264+
restore-keys: |
265+
${{ runner.os }}-${{ env.NIGHTLY_TOOLCHAIN }}-wasm32-unknown-unknown-${{ hashFiles('**/Cargo.toml') }}-
266+
${{ runner.os }}-${{ env.NIGHTLY_TOOLCHAIN }}-wasm32-unknown-unknown-
235267
path: |
236268
~/.cargo/bin/
237269
~/.cargo/registry/index/
238270
~/.cargo/registry/cache/
239271
~/.cargo/git/db/
240272
target/
241-
key: ubuntu-assets-cargo-build-wasm-nightly-${{ hashFiles('**/Cargo.toml') }}
242273
- uses: dtolnay/rust-toolchain@master
243274
with:
244275
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
@@ -309,15 +340,19 @@ jobs:
309340
timeout-minutes: 30
310341
steps:
311342
- uses: actions/checkout@v4
312-
- uses: actions/cache@v4
343+
- uses: actions/cache/restore@v4
313344
with:
345+
# key won't match, will rely on restore-keys
346+
key: ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
347+
restore-keys: |
348+
${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
349+
${{ runner.os }}-stable--
314350
path: |
315351
~/.cargo/bin/
316352
~/.cargo/registry/index/
317353
~/.cargo/registry/cache/
318354
~/.cargo/git/db/
319355
target/
320-
key: ${{ runner.os }}-check-doc-${{ hashFiles('**/Cargo.toml') }}
321356
- uses: dtolnay/rust-toolchain@stable
322357
- name: Install Linux dependencies
323358
uses: ./.github/actions/install-linux-deps
@@ -412,15 +447,6 @@ jobs:
412447
needs: build
413448
steps:
414449
- uses: actions/checkout@v4
415-
- uses: actions/cache@v4
416-
with:
417-
path: |
418-
~/.cargo/bin/
419-
~/.cargo/registry/index/
420-
~/.cargo/registry/cache/
421-
~/.cargo/git/db/
422-
target/
423-
key: ${{ runner.os }}-cargo-msrv-${{ hashFiles('**/Cargo.toml') }}
424450
- uses: dtolnay/rust-toolchain@stable
425451
- name: get MSRV
426452
id: msrv
@@ -430,6 +456,19 @@ jobs:
430456
- uses: dtolnay/rust-toolchain@master
431457
with:
432458
toolchain: ${{ steps.msrv.outputs.msrv }}
459+
- uses: actions/cache/restore@v4
460+
with:
461+
# key won't match, will rely on restore-keys
462+
key: ${{ runner.os }}-${{ steps.msrv.outputs.msrv }}--${{ hashFiles('**/Cargo.toml') }}-
463+
restore-keys: |
464+
${{ runner.os }}-${{ steps.msrv.outputs.msrv }}--${{ hashFiles('**/Cargo.toml') }}-
465+
${{ runner.os }}-${{ steps.msrv.outputs.msrv }}--
466+
path: |
467+
~/.cargo/bin/
468+
~/.cargo/registry/index/
469+
~/.cargo/registry/cache/
470+
~/.cargo/git/db/
471+
target/
433472
- name: Install Linux dependencies
434473
uses: ./.github/actions/install-linux-deps
435474
- name: Run cargo check

.github/workflows/example-run.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ jobs:
2424
- name: Disable audio
2525
# Disable audio through a patch. on github m1 runners, audio timeouts after 15 minutes
2626
run: git apply --ignore-whitespace tools/example-showcase/disable-audio.patch
27+
- uses: actions/cache/restore@v4
28+
with:
29+
# key won't match, will rely on restore-keys
30+
key: ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
31+
restore-keys: |
32+
${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
33+
${{ runner.os }}-stable--
34+
path: |
35+
~/.cargo/bin/
36+
~/.cargo/registry/index/
37+
~/.cargo/registry/cache/
38+
~/.cargo/git/db/
39+
target/
2740
- name: Run examples
2841
run: |
2942
for example in .github/example-run/*.ron; do
@@ -84,16 +97,20 @@ jobs:
8497
run: |
8598
sudo add-apt-repository ppa:kisak/turtle -y
8699
sudo apt-get install --no-install-recommends libxkbcommon-x11-0 xvfb libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
87-
- uses: actions/cache@v4
100+
- uses: dtolnay/rust-toolchain@stable
101+
- uses: actions/cache/restore@v4
88102
with:
103+
# key won't match, will rely on restore-keys
104+
key: ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
105+
restore-keys: |
106+
${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
107+
${{ runner.os }}-stable--
89108
path: |
90109
~/.cargo/bin/
91110
~/.cargo/registry/index/
92111
~/.cargo/registry/cache/
93112
~/.cargo/git/db/
94113
target/
95-
key: ${{ runner.os }}-cargo-run-examples-${{ hashFiles('**/Cargo.toml') }}
96-
- uses: dtolnay/rust-toolchain@stable
97114
- name: Run examples
98115
run: |
99116
for example in .github/example-run/*.ron; do
@@ -143,6 +160,19 @@ jobs:
143160
steps:
144161
- uses: actions/checkout@v4
145162
- uses: dtolnay/rust-toolchain@stable
163+
- uses: actions/cache/restore@v4
164+
with:
165+
# key won't match, will rely on restore-keys
166+
key: ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
167+
restore-keys: |
168+
${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
169+
${{ runner.os }}-stable--
170+
path: |
171+
~/.cargo/bin/
172+
~/.cargo/registry/index/
173+
~/.cargo/registry/cache/
174+
~/.cargo/git/db/
175+
target/
146176
- name: Run examples
147177
shell: bash
148178
run: |

0 commit comments

Comments
 (0)