CI: run long tasks on new macOS runners (#12133)

# Objective

- Make PR CI faster

## Solution

- Run example on macOS, Windows examples are now run on PR merge
instead. This is the biggest change in duration
- Run miri on macOS. It doesn't change much the duration, but will free
a runner 2 minutes earlier
- Don't run check-doc job as it hangs on macOS. Don't move too many job
as there are less macOS-14 runners globally available and they are more
limited

before:
<img width="794" alt="Screenshot 2024-02-26 at 20 47 07"
src="https://github.com/bevyengine/bevy/assets/8672791/349292a1-cddd-4e4b-aba9-4dbaef1fc4d6">

after
<img width="790" alt="Screenshot 2024-02-26 at 20 47 23"
src="https://github.com/bevyengine/bevy/assets/8672791/7b0983b2-0a8a-44d2-9bde-e4c6ecfbf97a">
This commit is contained in:
François 2024-02-27 10:00:15 +01:00 committed by GitHub
parent ae9b4fc2dc
commit 08ce57953e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 48 additions and 42 deletions

View File

@ -64,7 +64,7 @@ jobs:
run: cargo run -p ci -- lints run: cargo run -p ci -- lints
miri: miri:
runs-on: ubuntu-latest runs-on: macos-14
timeout-minutes: 60 timeout-minutes: 60
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -81,8 +81,6 @@ jobs:
with: with:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }} toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
components: miri components: miri
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev
- name: CI job - name: CI job
# To run the tests one item at a time for troubleshooting, use # 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 # 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
@ -200,39 +198,49 @@ jobs:
echo 'You can find the extension here: https://marketplace.visualstudio.com/items?itemName=tekumara.typos-vscode' echo 'You can find the extension here: https://marketplace.visualstudio.com/items?itemName=tekumara.typos-vscode'
run-examples-on-windows-dx12: run-examples-macos-metal:
runs-on: windows-latest runs-on: macos-14
timeout-minutes: 60 timeout-minutes: 30
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@stable
- name: Disable audio
- uses: actions/cache@v4 # Disable audio through a patch. on github m1 runners, audio timeouts after 15 minutes
with: run: git apply --ignore-whitespace tools/example-showcase/disable-audio.patch
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-windows-run-examples-${{ hashFiles('**/Cargo.toml') }}
- name: Build bevy - name: Build bevy
shell: bash
# this uses the same command as when running the example to ensure build is reused # this uses the same command as when running the example to ensure build is reused
run: | run: |
WGPU_BACKEND=dx12 CI_TESTING_CONFIG=.github/example-run/alien_cake_addict.ron cargo build --example alien_cake_addict --features "bevy_ci_testing" TRACE_CHROME=trace-alien_cake_addict.json CI_TESTING_CONFIG=.github/example-run/alien_cake_addict.ron cargo build --example alien_cake_addict --features "bevy_ci_testing,trace,trace_chrome"
- name: Run examples - name: Run examples
shell: bash
run: | run: |
for example in .github/example-run/*.ron; do for example in .github/example-run/*.ron; do
example_name=`basename $example .ron` example_name=`basename $example .ron`
echo -n $example_name > last_example_run
echo "running $example_name - "`date` echo "running $example_name - "`date`
time WGPU_BACKEND=dx12 CI_TESTING_CONFIG=$example cargo run --example $example_name --features "bevy_ci_testing" time TRACE_CHROME=trace-$example_name.json CI_TESTING_CONFIG=$example cargo run --example $example_name --features "bevy_ci_testing,trace,trace_chrome"
sleep 10 sleep 10
if [ `find ./ -maxdepth 1 -name 'screenshot-*.png' -print -quit` ]; then
mkdir screenshots-$example_name
mv screenshot-*.png screenshots-$example_name/
fi
done done
mkdir traces && mv trace*.json traces/
mkdir screenshots && mv screenshots-* screenshots/
- name: save traces
uses: actions/upload-artifact@v4
with:
name: example-traces-macos
path: traces
- name: save screenshots
uses: actions/upload-artifact@v4
with:
name: screenshots-macos
path: screenshots
- uses: actions/upload-artifact@v4
if: ${{ failure() && github.event_name == 'pull_request' }}
with:
name: example-run-macos
path: example-run/
check-doc: check-doc:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -251,7 +259,6 @@ jobs:
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@stable
- name: Install alsa and udev - name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev
if: runner.os == 'linux'
- name: Build and check doc - name: Build and check doc
# See tools/ci/src/main.rs for the commands this runs # See tools/ci/src/main.rs for the commands this runs
run: cargo run -p ci -- doc run: cargo run -p ci -- doc

View File

@ -105,67 +105,66 @@ jobs:
mv screenshot-*.png screenshots-$example_name/ mv screenshot-*.png screenshots-$example_name/
fi fi
done done
zip traces.zip trace*.json mkdir traces && mv trace*.json traces/
zip -r screenshots.zip screenshots-* mkdir screenshots && mv screenshots-* screenshots/
- name: save traces - name: save traces
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: example-traces-linux name: example-traces-linux
path: traces.zip path: traces
- name: save screenshots - name: save screenshots
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: screenshots-linux name: screenshots-linux
path: screenshots.zip path: screenshots
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
if: ${{ failure() && github.event_name == 'pull_request' }} if: ${{ failure() && github.event_name == 'pull_request' }}
with: with:
name: example-run-linux name: example-run-linux
path: example-run/ path: example-run/
run-examples-macos-metal: run-examples-on-windows-dx12:
if: ${{ github.event_name == 'merge_group' }} if: ${{ github.event_name == 'merge_group' }}
runs-on: macos-14 runs-on: windows-latest
timeout-minutes: 30 timeout-minutes: 30
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@stable
- 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
- name: Build bevy - name: Build bevy
shell: bash
# this uses the same command as when running the example to ensure build is reused # this uses the same command as when running the example to ensure build is reused
run: | run: |
TRACE_CHROME=trace-alien_cake_addict.json CI_TESTING_CONFIG=.github/example-run/alien_cake_addict.ron cargo build --example alien_cake_addict --features "bevy_ci_testing,trace,trace_chrome" WGPU_BACKEND=dx12 TRACE_CHROME=trace-alien_cake_addict.json CI_TESTING_CONFIG=.github/example-run/alien_cake_addict.ron cargo build --example alien_cake_addict --features "bevy_ci_testing,trace,trace_chrome"
- name: Run examples - name: Run examples
shell: bash
run: | run: |
for example in .github/example-run/*.ron; do for example in .github/example-run/*.ron; do
example_name=`basename $example .ron` example_name=`basename $example .ron`
echo -n $example_name > last_example_run echo -n $example_name > last_example_run
echo "running $example_name - "`date` echo "running $example_name - "`date`
time TRACE_CHROME=trace-$example_name.json CI_TESTING_CONFIG=$example cargo run --example $example_name --features "bevy_ci_testing,trace,trace_chrome" time WGPU_BACKEND=dx12 TRACE_CHROME=trace-$example_name.json CI_TESTING_CONFIG=$example cargo run --example $example_name --features "bevy_ci_testing,trace,trace_chrome"
sleep 10 sleep 10
if [ `find ./ -maxdepth 1 -name 'screenshot-*.png' -print -quit` ]; then if [ `find ./ -maxdepth 1 -name 'screenshot-*.png' -print -quit` ]; then
mkdir screenshots-$example_name mkdir screenshots-$example_name
mv screenshot-*.png screenshots-$example_name/ mv screenshot-*.png screenshots-$example_name/
fi fi
done done
zip traces.zip trace*.json mkdir traces && mv trace*.json traces/
zip -r screenshots.zip screenshots-* mkdir screenshots && mv screenshots-* screenshots/
- name: save traces - name: save traces
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: example-traces-macos name: example-traces-windows
path: traces.zip path: traces
- name: save screenshots - name: save screenshots
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: screenshots-macos name: screenshots-windows
path: screenshots.zip path: screenshots
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
if: ${{ failure() && github.event_name == 'pull_request' }} if: ${{ failure() && github.event_name == 'pull_request' }}
with: with:
name: example-run-macos name: example-run-windows
path: example-run/ path: example-run/
run-examples-on-wasm: run-examples-on-wasm: