mirror of
https://github.com/bevyengine/bevy.git
synced 2026-05-06 06:06:42 -04:00
9e85b052d8
# Objective - ppa:kisak/turtle has been unstable lately - Improve CI stability ## Solution - Cache the packages in actions cache - Use the cache if available, otherwise clean install ## Testing - I did the same changes to the example runner
192 lines
6.4 KiB
YAML
192 lines
6.4 KiB
YAML
name: Update Actions Caches
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
# Manually
|
|
workflow_dispatch:
|
|
# On PR merge
|
|
push:
|
|
branches:
|
|
- main
|
|
# After nightly release
|
|
schedule:
|
|
- cron: "0 1 * * *"
|
|
|
|
# Environment variables must be kept in sync with all workflows that defines them.
|
|
env:
|
|
CARGO_INCREMENTAL: 0
|
|
CARGO_PROFILE_TEST_DEBUG: 0
|
|
CARGO_PROFILE_DEV_DEBUG: 0
|
|
# If nightly is breaking CI, modify this variable to target a specific nightly version.
|
|
NIGHTLY_TOOLCHAIN: nightly
|
|
|
|
jobs:
|
|
env:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
NIGHTLY_TOOLCHAIN: ${{ steps.env.outputs.NIGHTLY_TOOLCHAIN }}
|
|
MSRV: ${{ steps.msrv.outputs.MSRV }}
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
|
|
with:
|
|
toolchain: stable
|
|
- name: get MSRV
|
|
id: msrv
|
|
run: |
|
|
msrv=`cargo metadata --no-deps --format-version 1 | jq --raw-output '.packages[] | select(.name=="bevy") | .rust_version'`
|
|
echo "MSRV=$msrv" >> $GITHUB_OUTPUT
|
|
- name: Expose Env
|
|
id: env
|
|
run: |
|
|
echo "NIGHTLY_TOOLCHAIN=${{ env.NIGHTLY_TOOLCHAIN }}" >> $GITHUB_OUTPUT
|
|
|
|
build-caches:
|
|
name: Build Caches
|
|
needs: ["env"]
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
toolchain: stable
|
|
target: ""
|
|
- os: macos-latest
|
|
toolchain: stable
|
|
target: ""
|
|
- os: windows-latest
|
|
toolchain: stable
|
|
target: ""
|
|
- os: ubuntu-latest
|
|
toolchain: ${{ needs.env.outputs.NIGHTLY_TOOLCHAIN }}
|
|
target: ""
|
|
- os: ubuntu-latest
|
|
toolchain: ${{ needs.env.outputs.MSRV }}
|
|
target: ""
|
|
- os: macos-latest
|
|
toolchain: ${{ needs.env.outputs.NIGHTLY_TOOLCHAIN }}
|
|
target: ""
|
|
- os: ubuntu-latest
|
|
toolchain: ${{ needs.env.outputs.NIGHTLY_TOOLCHAIN }}
|
|
target: wasm32-unknown-unknown
|
|
- os: ubuntu-latest
|
|
toolchain: stable
|
|
target: wasm32-unknown-unknown
|
|
- os: ubuntu-latest
|
|
toolchain: stable
|
|
target: x86_64-unknown-none
|
|
- os: ubuntu-latest
|
|
toolchain: stable
|
|
target: thumbv6m-none-eabi
|
|
- os: ubuntu-latest
|
|
toolchain: stable
|
|
target: aarch64-linux-android
|
|
- os: macos-14
|
|
toolchain: stable
|
|
target: aarch64-apple-ios-sim
|
|
|
|
steps:
|
|
# prepare the date - used to rebuild the cache daily to update the cache for rust nightly, even if no change on Bevy dependencies
|
|
- name: Get Date
|
|
id: get-date
|
|
run: |
|
|
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
|
|
shell: bash
|
|
|
|
- name: Checkout Bevy main branch
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
repository: "bevyengine/bevy"
|
|
ref: "main"
|
|
persist-credentials: false
|
|
|
|
- name: Setup Rust
|
|
id: rust
|
|
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
|
|
with:
|
|
toolchain: ${{ matrix.toolchain }}
|
|
target: ${{ matrix.target }}
|
|
|
|
# prepare the lockfile - to have a complete image of the dependencies on the current platform
|
|
- name: Create lock file
|
|
run: cargo update
|
|
|
|
# Fetch the cache using the complete key - to avoid rebuilding the cache if nothing changed
|
|
- uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
id: cache
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
target/
|
|
key: ${{ runner.os }}-${{ matrix.toolchain }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('Cargo.lock') }}-${{ steps.get-date.outputs.date }}
|
|
lookup-only: true
|
|
|
|
- name: Install Bevy dependencies
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
uses: ./.github/actions/install-linux-deps
|
|
with:
|
|
wayland: true
|
|
xkb: true
|
|
x264: true
|
|
fontconfig: true
|
|
|
|
# Build Bevy for the dev profile, used by check, doc, ...
|
|
- name: Build dev cache
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
run: cargo build --profile dev --package bevy
|
|
|
|
# Build Bevy for the test profile, used by test
|
|
- name: Build test cache
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
run: cargo build --profile test --package bevy
|
|
|
|
- name: Save cache
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
target/
|
|
key: ${{ runner.os }}-${{ matrix.toolchain }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('Cargo.lock') }}-${{ steps.get-date.outputs.date }}
|
|
|
|
build-apt-cache:
|
|
name: Build apt kisak/turtle Cache
|
|
runs-on: ubuntu-24.04
|
|
|
|
steps:
|
|
# prepare the date - used to rebuild the cache daily to catch new versions
|
|
- name: Get Date
|
|
id: get-date
|
|
run: |
|
|
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
|
|
shell: bash
|
|
|
|
- name: Install llvmpipe and lavapipe
|
|
run: |
|
|
sudo apt-get update -y -qq
|
|
sudo add-apt-repository ppa:kisak/turtle -y
|
|
DEBIAN_FRONTEND=noninteractive sudo apt-get install --no-install-recommends -yq \
|
|
libgl1-mesa-dri mesa-vulkan-drivers
|
|
rm -rf ~/apt-cache; mkdir ~/apt-cache
|
|
for package in libgbm1 libgl1-mesa-dri libglx-mesa0 mesa-libgallium mesa-vulkan-drivers; do
|
|
echo $package
|
|
dpkg -L $package | while IFS= read -r f; do if test -f "$f"; then echo "$f"; fi; done | xargs -d '\n' cp --parents --target-directory ~/apt-cache/
|
|
done
|
|
|
|
- name: Save cache
|
|
uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
|
|
with:
|
|
path: |
|
|
~/apt-cache/
|
|
key: ${{ runner.os }}-apt-kisak_turtle-${{ steps.get-date.outputs.date }}
|