Add screenshot check on UI (#16486)

# Objective

- Progress towards #15918 
- Add test on UI

## Solution

- Get a single screenshot from the UI testbed example
- Remove older examples from runs in CI as they're covered by the
testbed to reduce CI duration
This commit is contained in:
François Mockers 2024-11-23 19:38:24 +01:00 committed by GitHub
parent a9a4b069b6
commit 689c21d315
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 6 additions and 29 deletions

View File

@ -1,5 +0,0 @@
(
events: [
(300, AppExit),
]
)

View File

@ -1,8 +0,0 @@
(
setup: (
fixed_frame_time: Some(0.03),
),
events: [
(900, AppExit),
]
)

6
.github/example-run/testbed_ui.ron vendored Normal file
View File

@ -0,0 +1,6 @@
(
events: [
(100, Screenshot),
(200, AppExit),
]
)

View File

@ -261,10 +261,6 @@ 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
- name: Build bevy
# this uses the same command as when running the example to ensure build is reused
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"
- name: Run examples
run: |
for example in .github/example-run/*.ron; do

View File

@ -101,10 +101,6 @@ jobs:
target/
key: ${{ runner.os }}-cargo-run-examples-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
- name: Build bevy
# this uses the same command as when running the example to ensure build is reused
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"
- name: Run examples
run: |
for example in .github/example-run/*.ron; do
@ -155,11 +151,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Build bevy
shell: bash
# this uses the same command as when running the example to ensure build is reused
run: |
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
shell: bash
run: |

View File

@ -10,14 +10,11 @@ use bevy::{
picking::focus::HoverMap,
prelude::*,
ui::widget::NodeImageMode,
winit::WinitSettings,
};
fn main() {
let mut app = App::new();
app.add_plugins(DefaultPlugins)
// Only run the app when there is user input. This will significantly reduce CPU/GPU use.
.insert_resource(WinitSettings::desktop_app())
.add_systems(Startup, setup)
.add_systems(Update, update_scroll_position);