From 689c21d31550bf8063fd36509273b390645f95d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Mockers?= Date: Sat, 23 Nov 2024 19:38:24 +0100 Subject: [PATCH] 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 --- .github/example-run/alien_cake_addict.ron | 5 ----- .github/example-run/breakout.ron | 8 -------- .github/example-run/testbed_ui.ron | 6 ++++++ .github/workflows/ci.yml | 4 ---- .github/workflows/validation-jobs.yml | 9 --------- examples/testbed/ui.rs | 3 --- 6 files changed, 6 insertions(+), 29 deletions(-) delete mode 100644 .github/example-run/alien_cake_addict.ron delete mode 100644 .github/example-run/breakout.ron create mode 100644 .github/example-run/testbed_ui.ron diff --git a/.github/example-run/alien_cake_addict.ron b/.github/example-run/alien_cake_addict.ron deleted file mode 100644 index a8113dad04..0000000000 --- a/.github/example-run/alien_cake_addict.ron +++ /dev/null @@ -1,5 +0,0 @@ -( - events: [ - (300, AppExit), - ] -) diff --git a/.github/example-run/breakout.ron b/.github/example-run/breakout.ron deleted file mode 100644 index a169090336..0000000000 --- a/.github/example-run/breakout.ron +++ /dev/null @@ -1,8 +0,0 @@ -( - setup: ( - fixed_frame_time: Some(0.03), - ), - events: [ - (900, AppExit), - ] -) diff --git a/.github/example-run/testbed_ui.ron b/.github/example-run/testbed_ui.ron new file mode 100644 index 0000000000..579f791d66 --- /dev/null +++ b/.github/example-run/testbed_ui.ron @@ -0,0 +1,6 @@ +( + events: [ + (100, Screenshot), + (200, AppExit), + ] +) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb3fb5770b..b8cb0c7acf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/validation-jobs.yml b/.github/workflows/validation-jobs.yml index 749adf196c..90a4e0031f 100644 --- a/.github/workflows/validation-jobs.yml +++ b/.github/workflows/validation-jobs.yml @@ -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: | diff --git a/examples/testbed/ui.rs b/examples/testbed/ui.rs index 301155c7a6..c3fc9ead87 100644 --- a/examples/testbed/ui.rs +++ b/examples/testbed/ui.rs @@ -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);