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
254 lines
10 KiB
YAML
254 lines
10 KiB
YAML
name: Example Run
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
merge_group:
|
|
pull_request:
|
|
# also run when pushed to main to update reference screenshots
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
# Environment variables must be kept in sync with all workflows that defines them.
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
CARGO_INCREMENTAL: 0
|
|
CARGO_PROFILE_TEST_DEBUG: 0
|
|
CARGO_PROFILE_DEV_DEBUG: 0
|
|
|
|
jobs:
|
|
run-examples-macos-metal:
|
|
runs-on: macos-14
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
|
|
with:
|
|
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
|
|
- uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
with:
|
|
# key won't match, will rely on restore-keys
|
|
key: ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
|
|
# See .github/workflows/update-caches.yml for how keys are generated
|
|
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
|
|
example_name=`basename $example .ron`
|
|
echo -n $example_name > last_example_run
|
|
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,bevy_ui_debug,area_light_luts"
|
|
sleep 10
|
|
if [ `find ./ -maxdepth 1 -name 'screenshot-*.png' -print -quit` ]; then
|
|
mkdir screenshots-$example_name
|
|
mv screenshot-*.png screenshots-$example_name/
|
|
fi
|
|
done
|
|
mkdir traces && mv trace*.json traces/
|
|
mkdir screenshots && mv screenshots-* screenshots/
|
|
- name: save traces
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: example-traces-macos
|
|
path: traces
|
|
- name: Save PR number
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
run: |
|
|
echo ${{ github.event.number }} > ./screenshots/PR
|
|
- name: save screenshots
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: screenshots-macos
|
|
path: screenshots
|
|
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
if: ${{ failure() && github.event_name == 'pull_request' }}
|
|
with:
|
|
name: example-run-macos
|
|
path: example-run/
|
|
|
|
compare-macos-screenshots:
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
name: Compare Macos screenshots
|
|
needs: [run-examples-macos-metal]
|
|
uses: ./.github/workflows/send-screenshots-to-pixeleagle.yml
|
|
with:
|
|
commit: ${{ github.sha }}
|
|
branch: ${{ github.ref_name }}
|
|
artifact: screenshots-macos
|
|
os: macos
|
|
secrets:
|
|
PIXELEAGLE_TOKEN: ${{ secrets.PIXELEAGLE_TOKEN }}
|
|
|
|
run-examples-linux-vulkan:
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
- name: Install Linux dependencies
|
|
uses: ./.github/actions/install-linux-deps
|
|
- uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
|
|
continue-on-error: true
|
|
with:
|
|
path: |
|
|
~/apt-cache/
|
|
key: ${{ runner.os }}-apt-kisak_turtle-
|
|
restore-keys: ${{ runner.os }}-apt-kisak_turtle-
|
|
# At some point this may be merged into `install-linux-deps`, but for now it is its own step.
|
|
- name: Install additional Linux dependencies for Vulkan
|
|
run: |
|
|
sudo apt-get install --no-install-recommends libxkbcommon-x11-0 xvfb libxcb-xfixes0-dev
|
|
|
|
if [ -d ~/apt-cache ] && [ -n "$(ls -A ~/apt-cache 2>/dev/null)" ]; then
|
|
sudo cp --verbose --force --recursive ~/apt-cache/* /
|
|
else
|
|
sudo add-apt-repository ppa:kisak/turtle -y
|
|
sudo apt-get install --no-install-recommends libgl1-mesa-dri mesa-vulkan-drivers
|
|
fi
|
|
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
|
|
with:
|
|
toolchain: stable
|
|
- uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
with:
|
|
# key won't match, will rely on restore-keys
|
|
key: ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
|
|
# See .github/workflows/update-caches.yml for how keys are generated
|
|
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
|
|
example_name=`basename $example .ron`
|
|
echo -n $example_name > last_example_run
|
|
echo "running $example_name - "`date`
|
|
time TRACE_CHROME=trace-$example_name.json CI_TESTING_CONFIG=$example xvfb-run cargo run --example $example_name --features "bevy_ci_testing,trace,trace_chrome,bevy_ui_debug,area_light_luts"
|
|
sleep 10
|
|
if [ `find ./ -maxdepth 1 -name 'screenshot-*.png' -print -quit` ]; then
|
|
mkdir screenshots-$example_name
|
|
mv screenshot-*.png screenshots-$example_name/
|
|
fi
|
|
done
|
|
mkdir traces && mv trace*.json traces/
|
|
mkdir screenshots && mv screenshots-* screenshots/
|
|
- name: save traces
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: example-traces-linux
|
|
path: traces
|
|
- name: save screenshots
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: screenshots-linux
|
|
path: screenshots
|
|
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
if: ${{ failure() && github.event_name == 'pull_request' }}
|
|
with:
|
|
name: example-run-linux
|
|
path: example-run/
|
|
|
|
compare-linux-screenshots:
|
|
name: Compare Linux screenshots
|
|
needs: [run-examples-linux-vulkan]
|
|
uses: ./.github/workflows/send-screenshots-to-pixeleagle.yml
|
|
with:
|
|
commit: ${{ github.sha }}
|
|
branch: ${{ github.ref_name }}
|
|
artifact: screenshots-linux
|
|
os: linux
|
|
secrets:
|
|
PIXELEAGLE_TOKEN: ${{ secrets.PIXELEAGLE_TOKEN }}
|
|
|
|
run-examples-on-windows-dx12:
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
runs-on: windows-latest
|
|
# See https://github.com/bevyengine/bevy/issues/24106 for discussions on speeding this up
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
|
|
with:
|
|
toolchain: stable
|
|
- uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
with:
|
|
# key won't match, will rely on restore-keys
|
|
key: ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
|
|
# See .github/workflows/update-caches.yml for how keys are generated
|
|
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: |
|
|
for example in .github/example-run/*.ron; do
|
|
example_name=`basename $example .ron`
|
|
echo -n $example_name > last_example_run
|
|
echo "running $example_name - "`date`
|
|
time WGPU_BACKEND=dx12 TRACE_CHROME=trace-$example_name.json CI_TESTING_CONFIG=$example cargo run --example $example_name --features "statically-linked-dxc,bevy_ci_testing,trace,trace_chrome,bevy_ui_debug,area_light_luts"
|
|
sleep 10
|
|
if [ `find ./ -maxdepth 1 -name 'screenshot-*.png' -print -quit` ]; then
|
|
mkdir screenshots-$example_name
|
|
mv screenshot-*.png screenshots-$example_name/
|
|
fi
|
|
done
|
|
mkdir traces && mv trace*.json traces/
|
|
mkdir screenshots && mv screenshots-* screenshots/
|
|
- name: save traces
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: example-traces-windows
|
|
path: traces
|
|
- name: save screenshots
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: screenshots-windows
|
|
path: screenshots
|
|
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
if: ${{ failure() && github.event_name == 'pull_request' }}
|
|
with:
|
|
name: example-run-windows
|
|
path: example-run/
|
|
|
|
compare-windows-screenshots:
|
|
name: Compare Windows screenshots
|
|
needs: [run-examples-on-windows-dx12]
|
|
uses: ./.github/workflows/send-screenshots-to-pixeleagle.yml
|
|
with:
|
|
commit: ${{ github.sha }}
|
|
branch: ${{ github.ref_name }}
|
|
artifact: screenshots-windows
|
|
os: windows
|
|
secrets:
|
|
PIXELEAGLE_TOKEN: ${{ secrets.PIXELEAGLE_TOKEN }}
|