diff --git a/.github/example-run/data.ron b/.github/example-run/platformer.ron similarity index 100% rename from .github/example-run/data.ron rename to .github/example-run/platformer.ron diff --git a/.github/example-run/spawn_prefab_with_physics.ron b/.github/example-run/spawn_prefab_with_physics.ron new file mode 100644 index 00000000..3d6349e1 --- /dev/null +++ b/.github/example-run/spawn_prefab_with_physics.ron @@ -0,0 +1,5 @@ +( + exit_after: Some(1000), + frame_time: Some(0.03), + screenshot_frames: [101], +) \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4a3bea04..281d4baf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,7 +42,7 @@ jobs: ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ - key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.toml') }} + key: ${{ runner.os }}-cargo_${{ hashFiles('**/Cargo.toml') }} - name: Install stable@stable toolchain uses: dtolnay/rust-toolchain@stable - name: Install Dependencies @@ -66,7 +66,7 @@ jobs: ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ - key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.toml') }} + key: ${{ runner.os }}-cargo_${{ hashFiles('**/Cargo.toml') }} - name: Install stable@stable toolchain uses: dtolnay/rust-toolchain@stable - name: Install Dependencies @@ -91,7 +91,7 @@ jobs: ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ - key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.toml') }} + key: ${{ runner.os }}-cargo_${{ hashFiles('**/Cargo.toml') }} - name: Install stable@stable toolchain uses: dtolnay/rust-toolchain@stable with: diff --git a/.github/workflows/example_validation.yml b/.github/workflows/example_validation.yml index 4015c34a..350ae3b9 100644 --- a/.github/workflows/example_validation.yml +++ b/.github/workflows/example_validation.yml @@ -14,11 +14,84 @@ env: NIGHTLY_TOOLCHAIN: nightly jobs: + + run-platformer-example-linux: + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + - name: Install Bevy dependencies + run: | + sudo apt-get update; + DEBIAN_FRONTEND=noninteractive sudo apt-get install --no-install-recommends -yq \ + libasound2-dev libudev-dev libxkbcommon-x11-0 libwayland-dev; + - name: install xvfb, llvmpipe and lavapipe + run: | + sudo apt-get update -y -qq + sudo add-apt-repository ppa:kisak/turtle -y + sudo apt-get update + sudo apt install -y xvfb libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers + - uses: actions/checkout@v4 + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo_${{ hashFiles('**/Cargo.toml') }} + - uses: dtolnay/rust-toolchain@nightly + with: + toolchain: nightly + target: x86_64-unknown-linux-gnu + - name: Build bevy + # this uses the same command as when running the example to ensure build is reused + run: TRACE_CHROME=trace-platformer.json CI_TESTING_CONFIG=.github/example-run/platformer.ron cargo +nightly build --example platformer --release --features "bevy_xpbd_3d,"bevy/bevy_ci_testing,bevy/trace_chrome,bevy/trace"" + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0 -Z location-detail=none -Z threads=24" + - name: Run examples + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0 -Z location-detail=none -Z threads=24" + run: | + example_name=`basename plaformer.ron` + echo -n $example_name > last_example_run + echo "running platformer - "`date` + time TRACE_CHROME=trace-platformer.json CI_TESTING_CONFIG=.github/example-run/platformer.ron xvfb-run cargo +nightly run --release --example platformer --features "bevy_xpbd_3d,"bevy/bevy_ci_testing,bevy/trace_chrome,bevy/trace"" + sleep 10 + if [ `find ./ -maxdepth 1 -name 'screenshot-*.png' -print -quit` ]; then + mkdir screenshots-platformer + mv screenshot-*.png screenshots-platformer/ + fi + mkdir traces && mv trace*.json traces/ + mkdir screenshots && mv screenshots-* screenshots/ + - name: save traces + uses: actions/upload-artifact@v4 + with: + name: example-traces-linux-platformer-${{ steps.date.outputs.date }} + path: traces + - name: save screenshots + uses: actions/upload-artifact@v4 + with: + name: screenshots-linux-platformer-${{ steps.date.outputs.date }} + path: screenshots + - uses: actions/upload-artifact@v4 + if: ${{ failure() && github.event_name == 'pull_request' }} + with: + name: example-run-linux-platformer-${{ steps.date.outputs.date }} + path: example-run/ run-spawn_prefab_with_physics-example-linux: runs-on: ubuntu-latest timeout-minutes: 60 steps: + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" - name: Install Bevy dependencies run: | sudo apt-get update; @@ -39,14 +112,14 @@ jobs: ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ - key: ${{ runner.os }}-cargo-example-${{ hashFiles('**/Cargo.toml') }} + key: ${{ runner.os }}-cargo_${{ hashFiles('**/Cargo.toml') }} - uses: dtolnay/rust-toolchain@nightly with: toolchain: nightly target: x86_64-unknown-linux-gnu - name: Build bevy # this uses the same command as when running the example to ensure build is reused - run: TRACE_CHROME=trace-spawn_prefab_with_physics.json CI_TESTING_CONFIG=.github/example-run/data.ron cargo +nightly build --example spawn_prefab_with_physics --release --features "bevy_xpbd_3d,"bevy/bevy_ci_testing,bevy/trace_chrome,bevy/trace"" + run: TRACE_CHROME=trace-spawn_prefab_with_physics.json CI_TESTING_CONFIG=.github/example-run/spawn_prefab_with_physics.ron cargo +nightly build --example spawn_prefab_with_physics --release --features "bevy_xpbd_3d,"bevy/bevy_ci_testing,bevy/trace_chrome,bevy/trace"" env: CARGO_INCREMENTAL: 0 RUSTFLAGS: "-C debuginfo=0 -Z location-detail=none -Z threads=24" @@ -58,7 +131,7 @@ jobs: example_name=`basename plaformer.ron` echo -n $example_name > last_example_run echo "running spawn_prefab_with_physics - "`date` - time TRACE_CHROME=trace-spawn_prefab_with_physics.json CI_TESTING_CONFIG=.github/example-run/data.ron xvfb-run cargo +nightly run --release --example spawn_prefab_with_physics --features "bevy_xpbd_3d,"bevy/bevy_ci_testing,bevy/trace_chrome,bevy/trace"" + time TRACE_CHROME=trace-spawn_prefab_with_physics.json CI_TESTING_CONFIG=.github/example-run/spawn_prefab_with_physics.ron xvfb-run cargo +nightly run --release --example spawn_prefab_with_physics --features "bevy_xpbd_3d,"bevy/bevy_ci_testing,bevy/trace_chrome,bevy/trace"" sleep 10 if [ `find ./ -maxdepth 1 -name 'screenshot-*.png' -print -quit` ]; then mkdir screenshots-spawn_prefab_with_physics @@ -69,15 +142,15 @@ jobs: - name: save traces uses: actions/upload-artifact@v4 with: - name: example-traces-linux + name: example-traces-linux-spawn-prefab-${{ steps.date.outputs.date }} path: traces - name: save screenshots uses: actions/upload-artifact@v4 with: - name: screenshots-linux + name: screenshots-linux-spawn-prefab-${{ steps.date.outputs.date }} path: screenshots - uses: actions/upload-artifact@v4 if: ${{ failure() && github.event_name == 'pull_request' }} with: - name: example-run-linux + name: example-run-linux-spawn-prefab-${{ steps.date.outputs.date }} path: example-run/