use cache in other jobs

This commit is contained in:
François Mockers 2025-07-15 00:06:31 +02:00
parent 52534aba7e
commit f893744966
3 changed files with 150 additions and 60 deletions

View File

@ -30,15 +30,19 @@ jobs:
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
- uses: actions/cache/restore@v4
with:
# key won't match, will rely on restore-keys
key: ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
restore-keys: |
${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
${{ runner.os }}-stable--
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-build-stable-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
- name: Install Linux dependencies
uses: ./.github/actions/install-linux-deps
@ -53,15 +57,19 @@ jobs:
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
- uses: actions/cache/restore@v4
with:
# key won't match, will rely on restore-keys
key: ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
restore-keys: |
${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
${{ runner.os }}-stable--
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-ci-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
@ -79,15 +87,19 @@ jobs:
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
- uses: actions/cache/restore@v4
with:
# key won't match, will rely on restore-keys
key: ${{ runner.os }}-${{ env.NIGHTLY_TOOLCHAIN }}--${{ hashFiles('**/Cargo.toml') }}-
restore-keys: |
${{ runner.os }}-${{ env.NIGHTLY_TOOLCHAIN }}--${{ hashFiles('**/Cargo.toml') }}-
${{ runner.os }}-${{ env.NIGHTLY_TOOLCHAIN }}--
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-miri-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
@ -110,17 +122,19 @@ jobs:
needs: ci
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
- uses: actions/cache/restore@v4
with:
# key won't match, will rely on restore-keys
key: ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
restore-keys: |
${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
${{ runner.os }}-stable--
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
crates/bevy_ecs_compile_fail_tests/target/
crates/bevy_reflect_compile_fail_tests/target/
key: ${{ runner.os }}-cargo-check-compiles-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
@ -129,23 +143,26 @@ jobs:
- name: Check Compile
# See tools/ci/src/main.rs for the commands this runs
run: cargo run -p ci -- compile
check-compiles-no-std:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: ci
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
- uses: actions/cache/restore@v4
with:
# key won't match, will rely on restore-keys
key: ${{ runner.os }}-stable-x86_64-unknown-none-${{ hashFiles('**/Cargo.toml') }}-
restore-keys: |
${{ runner.os }}-stable-x86_64-unknown-none-${{ hashFiles('**/Cargo.toml') }}-
${{ runner.os }}-stable-x86_64-unknown-none-
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
crates/bevy_ecs_compile_fail_tests/target/
crates/bevy_reflect_compile_fail_tests/target/
key: ${{ runner.os }}-cargo-check-compiles-no-std-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-none
@ -153,23 +170,26 @@ jobs:
uses: ./.github/actions/install-linux-deps
- name: Check Compile
run: cargo check -p bevy --no-default-features --features default_no_std --target x86_64-unknown-none
check-compiles-no-std-portable-atomic:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: ci
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
- uses: actions/cache/restore@v4
with:
# key won't match, will rely on restore-keys
key: ${{ runner.os }}-stable-thumbv6m-none-eabi-${{ hashFiles('**/Cargo.toml') }}-
restore-keys: |
${{ runner.os }}-stable-thumbv6m-none-eabi-${{ hashFiles('**/Cargo.toml') }}-
${{ runner.os }}-stable-thumbv6m-none-eabi-
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
crates/bevy_ecs_compile_fail_tests/target/
crates/bevy_reflect_compile_fail_tests/target/
key: ${{ runner.os }}-cargo-check-compiles-no-std-portable-atomic-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
with:
targets: thumbv6m-none-eabi
@ -184,17 +204,19 @@ jobs:
needs: ci
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
- uses: actions/cache/restore@v4
with:
# key won't match, will rely on restore-keys
key: ${{ runner.os }}-stable-x86_64-unknown-none-${{ hashFiles('**/Cargo.toml') }}-
restore-keys: |
${{ runner.os }}-stable-x86_64-unknown-none-${{ hashFiles('**/Cargo.toml') }}-
${{ runner.os }}-stable-x86_64-unknown-none-
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
crates/bevy_ecs_compile_fail_tests/target/
crates/bevy_reflect_compile_fail_tests/target/
key: ${{ runner.os }}-cargo-check-compiles-no-std-examples-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-none
@ -209,15 +231,19 @@ jobs:
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
- uses: actions/cache/restore@v4
with:
# key won't match, will rely on restore-keys
key: ${{ runner.os }}-stable-wasm32-unknown-unknown-${{ hashFiles('**/Cargo.toml') }}-
restore-keys: |
${{ runner.os }}-stable-wasm32-unknown-unknown-${{ hashFiles('**/Cargo.toml') }}-
${{ runner.os }}-stable-wasm32-unknown-unknown-
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-assets-cargo-build-wasm-stable-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-unknown-unknown
@ -230,15 +256,19 @@ jobs:
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
- uses: actions/cache/restore@v4
with:
# key won't match, will rely on restore-keys
key: ${{ runner.os }}-${{ env.NIGHTLY_TOOLCHAIN }}-wasm32-unknown-unknown-${{ hashFiles('**/Cargo.toml') }}-
restore-keys: |
${{ runner.os }}-${{ env.NIGHTLY_TOOLCHAIN }}-wasm32-unknown-unknown-${{ hashFiles('**/Cargo.toml') }}-
${{ runner.os }}-${{ env.NIGHTLY_TOOLCHAIN }}-wasm32-unknown-unknown-
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-assets-cargo-build-wasm-nightly-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
@ -309,15 +339,19 @@ jobs:
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
- uses: actions/cache/restore@v4
with:
# key won't match, will rely on restore-keys
key: ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
restore-keys: |
${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
${{ runner.os }}-stable--
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-check-doc-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
- name: Install Linux dependencies
uses: ./.github/actions/install-linux-deps
@ -412,15 +446,6 @@ jobs:
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-msrv-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
- name: get MSRV
id: msrv
@ -430,6 +455,19 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.msrv.outputs.msrv }}
- uses: actions/cache/restore@v4
with:
# key won't match, will rely on restore-keys
key: ${{ runner.os }}-${{ steps.msrv.outputs.msrv }}--${{ hashFiles('**/Cargo.toml') }}-
restore-keys: |
${{ runner.os }}-${{ steps.msrv.outputs.msrv }}--${{ hashFiles('**/Cargo.toml') }}-
${{ runner.os }}-${{ steps.msrv.outputs.msrv }}--
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
- name: Install Linux dependencies
uses: ./.github/actions/install-linux-deps
- name: Run cargo check

View File

@ -24,6 +24,19 @@ jobs:
- name: Disable audio
# Disable audio through a patch. on github m1 runners, audio timeouts after 15 minutes
run: git apply --ignore-whitespace tools/example-showcase/disable-audio.patch
- uses: actions/cache/restore@v4
with:
# key won't match, will rely on restore-keys
key: ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
restore-keys: |
${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
${{ runner.os }}-stable--
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
- name: Run examples
run: |
for example in .github/example-run/*.ron; do
@ -84,16 +97,20 @@ jobs:
run: |
sudo add-apt-repository ppa:kisak/turtle -y
sudo apt-get install --no-install-recommends libxkbcommon-x11-0 xvfb libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
- uses: actions/cache@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache/restore@v4
with:
# key won't match, will rely on restore-keys
key: ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
restore-keys: |
${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
${{ runner.os }}-stable--
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-run-examples-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
- name: Run examples
run: |
for example in .github/example-run/*.ron; do
@ -143,6 +160,19 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache/restore@v4
with:
# key won't match, will rely on restore-keys
key: ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
restore-keys: |
${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
${{ runner.os }}-stable--
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
- name: Run examples
shell: bash
run: |

View File

@ -29,15 +29,22 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v4
- uses: actions/cache/restore@v4
with:
# key won't match, will rely on restore-keys
key: ${{ runner.os }}-stable-aarch64-apple-ios-sim-${{ hashFiles('**/Cargo.toml') }}-
restore-keys: |
${{ runner.os }}-stable-aarch64-apple-ios-sim-${{ hashFiles('**/Cargo.toml') }}-
${{ runner.os }}-stable-aarch64-apple-ios-sim-
path: |
target
key: ${{ runner.os }}-ios-install-${{ hashFiles('**/Cargo.lock') }}
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
# TODO: remove x86 target once it always run on arm GitHub runners
- name: Add iOS targets
run: rustup target add aarch64-apple-ios x86_64-apple-ios aarch64-apple-ios-sim
run: rustup target add aarch64-apple-ios-sim
- name: Build and install iOS app in iOS Simulator.
run: cd examples/mobile && make install
@ -54,18 +61,22 @@ jobs:
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
java-version: "17"
distribution: "temurin"
- uses: actions/cache@v4
- uses: actions/cache/restore@v4
with:
# key won't match, will rely on restore-keys
key: ${{ runner.os }}-stable-aarch64-linux-android-${{ hashFiles('**/Cargo.toml') }}-
restore-keys: |
${{ runner.os }}-stable-aarch64-linux-android-${{ hashFiles('**/Cargo.toml') }}-
${{ runner.os }}-stable-aarch64-linux-android-
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-build-android-${{ hashFiles('**/Cargo.toml') }}
- name: Install Android targets
run: rustup target add aarch64-linux-android
@ -90,16 +101,19 @@ jobs:
with:
target: wasm32-unknown-unknown
- uses: actions/cache@v4
- uses: actions/cache/restore@v4
with:
# key won't match, will rely on restore-keys
key: ${{ runner.os }}-stable-wasm32-unknown-unknown-${{ hashFiles('**/Cargo.toml') }}-
restore-keys: |
${{ runner.os }}-stable-wasm32-unknown-unknown-${{ hashFiles('**/Cargo.toml') }}-
${{ runner.os }}-stable-wasm32-unknown-unknown-
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.github/start-wasm-example/node_modules
target/
key: ${{ runner.os }}-wasm-run-examples-${{ hashFiles('**/Cargo.toml') }}
- name: Install wasm-bindgen
run: cargo install --force wasm-bindgen-cli
@ -167,18 +181,22 @@ jobs:
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
- uses: actions/cache/restore@v4
with:
# key won't match, will rely on restore-keys
key: ${{ runner.os }}-${{ env.NIGHTLY_TOOLCHAIN }}--${{ hashFiles('**/Cargo.toml') }}-
restore-keys: |
${{ runner.os }}-${{ env.NIGHTLY_TOOLCHAIN }}--${{ hashFiles('**/Cargo.toml') }}-
${{ runner.os }}-${{ env.NIGHTLY_TOOLCHAIN }}--
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-check-unused-dependencies-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
- name: Installs cargo-udeps
run: cargo install --force cargo-udeps
- name: Install Linux dependencies
@ -192,16 +210,20 @@ jobs:
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache/restore@v4
with:
# key won't match, will rely on restore-keys
key: ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
restore-keys: |
${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
${{ runner.os }}-stable--
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-check-showcase-patches-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
- name: Install Linux dependencies
uses: ./.github/actions/install-linux-deps
- name: Apply patches