diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb377b64cb3e9..029bc5850e05f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,16 +24,10 @@ jobs: timeout-minutes: 30 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-build-stable-${{ hashFiles('**/Cargo.toml') }} - uses: dtolnay/rust-toolchain@stable + - uses: ./.github/actions/cache + with: + kind: build - name: Install Linux dependencies uses: ./.github/actions/install-linux-deps - name: Build & run tests @@ -48,18 +42,10 @@ jobs: timeout-minutes: 30 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-ci-${{ hashFiles('**/Cargo.toml') }} - uses: dtolnay/rust-toolchain@stable + - uses: ./.github/actions/cache with: - components: rustfmt, clippy + kind: check - name: Install Linux dependencies uses: ./.github/actions/install-linux-deps with: @@ -74,19 +60,14 @@ jobs: timeout-minutes: 60 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-miri-${{ hashFiles('**/Cargo.toml') }} - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ env.NIGHTLY_TOOLCHAIN }} components: miri + - uses: ./.github/actions/cache + with: + kind: check + toolchain: nightly - name: CI job # To run the tests one item at a time for troubleshooting, use # cargo --quiet test --lib -- --list | sed 's/: test$//' | MIRIFLAGS="-Zmiri-disable-isolation -Zmiri-permissive-provenance -Zmiri-disable-weak-memory-emulation" xargs -n1 cargo miri test -p bevy_ecs --lib -- --exact @@ -106,20 +87,10 @@ jobs: needs: ci steps: - uses: actions/checkout@v4 - - uses: actions/cache@v4 - with: - 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 + - uses: ./.github/actions/cache with: - toolchain: stable + kind: build - name: Install Linux dependencies uses: ./.github/actions/install-linux-deps - name: Check Compile @@ -132,18 +103,13 @@ 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: ubuntu-assets-cargo-build-wasm-stable-${{ hashFiles('**/Cargo.toml') }} - uses: dtolnay/rust-toolchain@stable with: target: wasm32-unknown-unknown + - uses: ./.github/actions/cache + with: + kind: check + target: wasm - name: Check wasm run: cargo check --target wasm32-unknown-unknown @@ -153,20 +119,16 @@ 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: ubuntu-assets-cargo-build-wasm-nightly-${{ hashFiles('**/Cargo.toml') }} - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ env.NIGHTLY_TOOLCHAIN }} targets: wasm32-unknown-unknown components: rust-src + - uses: ./.github/actions/cache + with: + kind: check + toolchain: nightly + target: wasm-atomics - name: Check wasm run: cargo check --target wasm32-unknown-unknown -Z build-std=std,panic_abort env: @@ -233,6 +195,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable + # TODO: Cache? - 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 @@ -276,16 +239,13 @@ jobs: timeout-minutes: 30 steps: - uses: actions/checkout@v4 - - uses: actions/cache@v4 + - uses: dtolnay/rust-toolchain@master with: - 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 + toolchain: ${{ env.NIGHTLY_TOOLCHAIN }} + - uses: ./.github/actions/cache + with: + kind: doc + toolchain: nightly - name: Install Linux dependencies uses: ./.github/actions/install-linux-deps with: @@ -378,15 +338,7 @@ 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') }} + # TODO: Cache with Rust version? - name: get MSRV run: | msrv=`cargo metadata --no-deps --format-version 1 | jq --raw-output '.packages[] | select(.name=="bevy") | .rust_version'` @@ -436,18 +388,13 @@ jobs: timeout-minutes: 30 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 }}-check-doc-${{ hashFiles('**/Cargo.toml') }} - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ env.NIGHTLY_TOOLCHAIN }} + - uses: ./.github/actions/cache + with: + kind: check + toolchain: nightly - name: Install Linux dependencies uses: ./.github/actions/install-linux-deps with: