Workflow - Tests on native #25
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Workflow - Tests on native | |
| on: | |
| workflow_call: | |
| inputs: | |
| repository: | |
| required: true | |
| type: string | |
| default: "bevyengine/bevy" | |
| gitref: | |
| required: true | |
| type: string | |
| branch: | |
| required: true | |
| type: string | |
| default: "main" | |
| per_page: | |
| required: false | |
| type: string | |
| default: "20" | |
| platforms: | |
| required: false | |
| type: string | |
| default: '["windows-2025", "macos-14", "ubuntu-24.04"]' | |
| workflow_dispatch: | |
| inputs: | |
| repository: | |
| required: true | |
| type: string | |
| default: "bevyengine/bevy" | |
| description: "Bevy repository to use" | |
| gitref: | |
| required: true | |
| type: string | |
| default: "main" | |
| description: "Git reference to use" | |
| branch: | |
| required: true | |
| type: string | |
| description: "Branch name that will be used for the report" | |
| per_page: | |
| required: true | |
| type: string | |
| default: "20" | |
| description: "Number of examples to run per job" | |
| platforms: | |
| required: false | |
| type: string | |
| default: '["windows-2025", "macos-14", "ubuntu-24.04"]' | |
| description: "List of platforms to run the examples on" | |
| jobs: | |
| split-pages: | |
| name: Prepare pages | |
| runs-on: ubuntu-latest | |
| outputs: | |
| pages: ${{ steps.env.outputs.pages }} | |
| steps: | |
| - name: Checkout Bevy | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: ${{ inputs.repository}} | |
| ref: ${{ inputs.gitref }} | |
| - name: Prepare Pages | |
| id: env | |
| run: | | |
| example_count=`cat Cargo.toml | grep '\[\[example\]\]' | wc -l` | |
| page_count=$((example_count / ${{ inputs.per_page }} + 1)) | |
| echo "pages=`python -c \"import json; print(json.dumps([i for i in range($page_count)]))\"`" >> $GITHUB_OUTPUT | |
| take-screenshots: | |
| name: Take Screenshots | |
| needs: [split-pages] | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
| strategy: | |
| matrix: | |
| os: ${{ fromJSON(inputs.platforms) }} | |
| page: ${{ fromJSON(needs.split-pages.outputs.pages) }} | |
| steps: | |
| - name: Checkout Bevy | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: ${{ inputs.repository }} | |
| ref: ${{ inputs.gitref }} | |
| - name: Checkout patches | |
| uses: actions/checkout@v6 | |
| with: | |
| path: "runner-patches" | |
| - name: Apply patches | |
| shell: pwsh | |
| run: | | |
| Get-ChildItem "runner-patches/patches" -Filter *.patch | | |
| Foreach-Object { | |
| Write-Output "Processing $($_.FullName)" | |
| git apply --ignore-whitespace $($_.FullName) | |
| } | |
| - name: (Windows) Apply patches | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| Get-ChildItem "runner-patches/patches-windows" -Filter *.patch | | |
| Foreach-Object { | |
| Write-Output "Processing $($_.FullName)" | |
| git apply --ignore-whitespace $($_.FullName) | |
| } | |
| # - name: Setup Sentry Reporting | |
| # shell: pwsh | |
| # run: | | |
| # cargo add vleue_sentry --git https://github.com/vleue/vleue_sentry -p bevy_internal --features subcrates --no-default-features | |
| # git apply --ignore-whitespace runner-patches/add_sentry.patch | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: (Linux) Install Bevy dependencies | |
| if: runner.os == 'linux' | |
| 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 fontconfig libfontconfig1-dev; | |
| - name: (Linux) install xvfb, llvmpipe and lavapipe | |
| if: runner.os == 'linux' | |
| run: | | |
| sudo apt-get update -y -qq | |
| sudo add-apt-repository ppa:kisak/turtle -y || FAILED=true | |
| # retry as it sometimes timeout | |
| if [ $FAILED ]; then | |
| sleep 5 | |
| sudo add-apt-repository ppa:kisak/turtle -y || FAILED=true | |
| if [ $FAILED ]; then | |
| sleep 5 | |
| sudo add-apt-repository ppa:kisak/turtle -y | |
| fi | |
| fi | |
| sudo apt-get update | |
| sudo apt install -y xvfb libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers | |
| - name: (Windows) Install DXC | |
| if: runner.os == 'windows' | |
| shell: bash | |
| run: | | |
| set -e | |
| # from https://github.com/microsoft/DirectXShaderCompiler/releases | |
| curl.exe -L --retry 5 https://github.com/microsoft/DirectXShaderCompiler/releases/download/v1.8.2505/dxc_2025_05_24.zip -o dxc.zip | |
| 7z.exe e dxc.zip -odxc bin/x64/{dxc.exe,dxcompiler.dll,dxil.dll} | |
| cp dxc/* . | |
| - uses: actions/cache/restore@v5 | |
| id: restore-cache | |
| continue-on-error: true | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} | |
| restore-keys: ${{ runner.os }}-cargo- | |
| - name: Take Screenshots (Linux) | |
| id: screenshots-linux | |
| if: runner.os == 'linux' | |
| continue-on-error: true | |
| run: xvfb-run -s "-screen 0 1280x1024x24" cargo run -p example-showcase -- --page ${{ matrix.page }} --per-page ${{ inputs.per_page }} run --screenshot-frame 400 --fixed-frame-time 0.0125 --auto-stop-frame --in-ci --ignore-stress-tests --report-details --show-logs | |
| - name: Take Screenshots (macOS) | |
| id: screenshots-macos | |
| if: runner.os == 'macos' | |
| continue-on-error: true | |
| run: cargo run -p example-showcase -- --page ${{ matrix.page }} --per-page ${{ inputs.per_page }} run --screenshot-frame 400 --fixed-frame-time 0.0125 --auto-stop-frame --in-ci --ignore-stress-tests --report-details --show-logs | |
| - name: Take Screenshots (Windows) | |
| id: screenshots-windows | |
| if: runner.os == 'windows' | |
| continue-on-error: true | |
| shell: pwsh | |
| run: | | |
| Add-Type -AssemblyName System.Windows.Forms | |
| $screen = [System.Windows.Forms.SystemInformation]::VirtualScreen | |
| [Windows.Forms.Cursor]::Position = "$($screen.Width / 2),$($screen.Height / 2)" | |
| cargo run -p example-showcase -- --page ${{ matrix.page }} --per-page ${{ inputs.per_page }} run --screenshot-frame 400 --fixed-frame-time 0.0125 --auto-stop-frame --in-ci --ignore-stress-tests --report-details --show-logs | |
| env: | |
| WGPU_BACKEND: dx12 | |
| - name: Log errors | |
| shell: pwsh | |
| run: | | |
| if (Get-Content example-showcase-reports/no_screenshots) { | |
| perl -p -e 's/(.*) - [.0-9]*\n/\1, /g' example-showcase-reports/no_screenshots > cleaned | |
| $no_screenshots = Get-Content .\cleaned -Raw | |
| echo "::warning title=No Screenshots ${{ runner.os }}/${{ matrix.page }}::$no_screenshots" | |
| } | |
| if (Get-Content example-showcase-reports/failures) { | |
| perl -p -e 's/(.*) - [.0-9]*\n/\1, /g' example-showcase-reports/failures > cleaned | |
| $failures = Get-Content .\cleaned -Raw | |
| echo "::error title=Failed To Run ${{ runner.os }}/${{ matrix.page }}::$failures" | |
| } | |
| - name: Outputs run results | |
| id: run-results | |
| shell: pwsh | |
| run: | | |
| echo "has_success=$(![String]::IsNullOrWhiteSpace((Get-content example-showcase-reports/successes)))" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | |
| - name: Upload Screenshots | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: screenshots-${{ runner.os }}-${{ matrix.page }} | |
| path: screenshots | |
| - name: Upload Status | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: status-${{ runner.os }}-${{ matrix.page }} | |
| path: | | |
| example-showcase-reports | |
| send-to-pixel-eagle: | |
| name: Send screenshots to Pixel Eagle | |
| runs-on: ubuntu-latest | |
| needs: [take-screenshots] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: Linux | |
| - os: macOS | |
| - os: Windows | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v6 | |
| with: | |
| pattern: screenshots-${{ matrix.os }}-* | |
| - name: Move examples to the correct folder | |
| id: gather-examples | |
| continue-on-error: true | |
| run: | | |
| mkdir screenshots-${{ matrix.os }} | |
| for screenshotfolder in screenshots-${{ matrix.os }}-* | |
| do | |
| echo $screenshotfolder | |
| rsync --verbose --archive $screenshotfolder/* screenshots-${{ matrix.os }}/ | |
| rm -rf $screenshotfolder | |
| done | |
| - name: Install Pixel Eagle CLI | |
| if: steps.gather-examples.outcome == 'success' | |
| uses: vleue/PixelEagle-cli/install@main | |
| - name: Send to Pixel Eagle | |
| if: steps.gather-examples.outcome == 'success' | |
| run: | | |
| run=`pixeleagle-cli new-run --metadata '{"os":"${{ matrix.os }}", "gitref": "${{ inputs.gitref }}", "branch": "${{ inputs.branch }}"}'` | |
| cd screenshots-${{ matrix.os }} | |
| pixeleagle-cli upload-screenshots $run */*.png | |
| pixeleagle-cli --format json compare-run $run --same os --filter branch:main --print-details | jq '{project_id: .project_id, from: .from, to: .to}' > pixeleagle-${{ matrix.os }}.json | |
| cat pixeleagle-${{ matrix.os }}.json | |
| echo "created run $run" | |
| env: | |
| PIXEL_EAGLE_TOKEN: ${{ secrets.PIXELEAGLE }} | |
| - name: Upload Pixel Eagle status | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: pixeleagle-${{ matrix.os }} | |
| path: pixeleagle-${{ matrix.os }}.json |