Skip to content

Commit f893744

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

File tree

3 files changed

+150
-60
lines changed

3 files changed

+150
-60
lines changed

.github/workflows/ci.yml

Lines changed: 75 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,17 +204,19 @@ 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
@@ -209,15 +231,19 @@ jobs:
209231
needs: build
210232
steps:
211233
- uses: actions/checkout@v4
212-
- uses: actions/cache@v4
234+
- uses: actions/cache/restore@v4
213235
with:
236+
# key won't match, will rely on restore-keys
237+
key: ${{ runner.os }}-stable-wasm32-unknown-unknown-${{ hashFiles('**/Cargo.toml') }}-
238+
restore-keys: |
239+
${{ runner.os }}-stable-wasm32-unknown-unknown-${{ hashFiles('**/Cargo.toml') }}-
240+
${{ runner.os }}-stable-wasm32-unknown-unknown-
214241
path: |
215242
~/.cargo/bin/
216243
~/.cargo/registry/index/
217244
~/.cargo/registry/cache/
218245
~/.cargo/git/db/
219246
target/
220-
key: ubuntu-assets-cargo-build-wasm-stable-${{ hashFiles('**/Cargo.toml') }}
221247
- uses: dtolnay/rust-toolchain@stable
222248
with:
223249
target: wasm32-unknown-unknown
@@ -230,15 +256,19 @@ jobs:
230256
needs: build
231257
steps:
232258
- uses: actions/checkout@v4
233-
- uses: actions/cache@v4
259+
- uses: actions/cache/restore@v4
234260
with:
261+
# key won't match, will rely on restore-keys
262+
key: ${{ runner.os }}-${{ env.NIGHTLY_TOOLCHAIN }}-wasm32-unknown-unknown-${{ hashFiles('**/Cargo.toml') }}-
263+
restore-keys: |
264+
${{ runner.os }}-${{ env.NIGHTLY_TOOLCHAIN }}-wasm32-unknown-unknown-${{ hashFiles('**/Cargo.toml') }}-
265+
${{ runner.os }}-${{ env.NIGHTLY_TOOLCHAIN }}-wasm32-unknown-unknown-
235266
path: |
236267
~/.cargo/bin/
237268
~/.cargo/registry/index/
238269
~/.cargo/registry/cache/
239270
~/.cargo/git/db/
240271
target/
241-
key: ubuntu-assets-cargo-build-wasm-nightly-${{ hashFiles('**/Cargo.toml') }}
242272
- uses: dtolnay/rust-toolchain@master
243273
with:
244274
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
@@ -309,15 +339,19 @@ jobs:
309339
timeout-minutes: 30
310340
steps:
311341
- uses: actions/checkout@v4
312-
- uses: actions/cache@v4
342+
- uses: actions/cache/restore@v4
313343
with:
344+
# key won't match, will rely on restore-keys
345+
key: ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
346+
restore-keys: |
347+
${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
348+
${{ runner.os }}-stable--
314349
path: |
315350
~/.cargo/bin/
316351
~/.cargo/registry/index/
317352
~/.cargo/registry/cache/
318353
~/.cargo/git/db/
319354
target/
320-
key: ${{ runner.os }}-check-doc-${{ hashFiles('**/Cargo.toml') }}
321355
- uses: dtolnay/rust-toolchain@stable
322356
- name: Install Linux dependencies
323357
uses: ./.github/actions/install-linux-deps
@@ -412,15 +446,6 @@ jobs:
412446
needs: build
413447
steps:
414448
- 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') }}
424449
- uses: dtolnay/rust-toolchain@stable
425450
- name: get MSRV
426451
id: msrv
@@ -430,6 +455,19 @@ jobs:
430455
- uses: dtolnay/rust-toolchain@master
431456
with:
432457
toolchain: ${{ steps.msrv.outputs.msrv }}
458+
- uses: actions/cache/restore@v4
459+
with:
460+
# key won't match, will rely on restore-keys
461+
key: ${{ runner.os }}-${{ steps.msrv.outputs.msrv }}--${{ hashFiles('**/Cargo.toml') }}-
462+
restore-keys: |
463+
${{ runner.os }}-${{ steps.msrv.outputs.msrv }}--${{ hashFiles('**/Cargo.toml') }}-
464+
${{ runner.os }}-${{ steps.msrv.outputs.msrv }}--
465+
path: |
466+
~/.cargo/bin/
467+
~/.cargo/registry/index/
468+
~/.cargo/registry/cache/
469+
~/.cargo/git/db/
470+
target/
433471
- name: Install Linux dependencies
434472
uses: ./.github/actions/install-linux-deps
435473
- 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)