Skip to content

Commit

Permalink
Fix native split (#45)
Browse files Browse the repository at this point in the history
* compute pages in native job

* change order 🤷

* run faster to test

* faster!

* change type

* Revert "run faster to test"

This reverts commit 784d948.

* Revert "faster!"

This reverts commit ae06250.

* cleanup

* better branch name for forks

* better names
  • Loading branch information
mockersf authored Apr 9, 2024
1 parent 7e1456a commit 70f33fe
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 30 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/report-fork.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Example report - fork
run-name: "${{ inputs.fork }}:${{ inputs.branch }}"

on:
workflow_dispatch:
Expand All @@ -20,8 +21,7 @@ jobs:
name: Get Environment
runs-on: ubuntu-latest
outputs:
pages: ${{ steps.env.outputs.pages }}
per-pages: ${{ env.PER_PAGE }}
per_page: ${{ env.PER_PAGE }}
gitref: ${{ steps.env.outputs.gitref }}
date: ${{ steps.env.outputs.date }}
pixeleagle_project: ${{ steps.env.outputs.pixeleagle_project }}
Expand All @@ -34,42 +34,40 @@ jobs:
- name: Get Environment
id: env
run: |
example_count=`cat Cargo.toml | grep '\[\[example\]\]' | wc -l`
page_count=$((example_count / ${{ env.PER_PAGE }} + 1))
echo "gitref=`git rev-parse HEAD`" >> $GITHUB_OUTPUT
echo "date=`date +%Y%m%d%H%M`" >> $GITHUB_OUTPUT
echo "pages=`python -c \"import json; print(json.dumps([i for i in range($page_count)]))\"`" >> $GITHUB_OUTPUT
echo "pixeleagle_project=B25A040A-A980-4602-B90C-D480AB84076D" >> $GITHUB_OUTPUT
native-run:
name: Native
needs: [get-environment]
uses: ./.github/workflows/workflow-native.yml
with:
gitref: ${{ needs.get-environment.outputs.gitref }}
pixeleagle_project: ${{ needs.get-environment.outputs.pixeleagle_project }}
branch: "${{ inputs.fork }} - ${{ inputs.branch }}"
branch: "${{ inputs.fork }}:${{ inputs.branch }}"
repository: ${{ inputs.fork }}
pages: ${{ needs.get-environment.outputs.pages }}
per-page: ${{ needs.get-environment.outputs.per-pages }}
per_page: "${{ needs.get-environment.outputs.per_page }}"
secrets: inherit

mobile-run:
name: Mobile
needs: [get-environment]
uses: ./.github/workflows/workflow-mobile.yml
with:
gitref: ${{ needs.get-environment.outputs.gitref }}
pixeleagle_project: ${{ needs.get-environment.outputs.pixeleagle_project }}
branch: "${{ inputs.fork }} - ${{ inputs.branch }}"
branch: "${{ inputs.fork }}:${{ inputs.branch }}"
repository: ${{ inputs.fork }}
secrets: inherit

wasm-run:
name: wasm
needs: [get-environment]
uses: ./.github/workflows/workflow-wasm.yml
with:
gitref: ${{ needs.get-environment.outputs.gitref }}
pixeleagle_project: ${{ needs.get-environment.outputs.pixeleagle_project }}
branch: "${{ inputs.fork }} - ${{ inputs.branch }}"
branch: "${{ inputs.fork }}:${{ inputs.branch }}"
repository: ${{ inputs.fork }}
secrets: inherit
14 changes: 6 additions & 8 deletions .github/workflows/report-pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Example report - PR
run-name: ${{ inputs.pr }}

on:
workflow_dispatch:
Expand All @@ -16,8 +17,7 @@ jobs:
name: Get Environment
runs-on: ubuntu-latest
outputs:
pages: ${{ steps.env.outputs.pages }}
per-pages: ${{ env.PER_PAGE }}
per_page: ${{ env.PER_PAGE }}
gitref: ${{ steps.env.outputs.gitref }}
date: ${{ steps.env.outputs.date }}
pixeleagle_project: ${{ steps.env.outputs.pixeleagle_project }}
Expand All @@ -33,27 +33,24 @@ jobs:
- name: Get Environment
id: env
run: |
example_count=`cat Cargo.toml | grep '\[\[example\]\]' | wc -l`
page_count=$((example_count / ${{ env.PER_PAGE }} + 1))
echo "gitref=`git rev-parse HEAD`" >> $GITHUB_OUTPUT
echo "date=`date +%Y%m%d%H%M`" >> $GITHUB_OUTPUT
echo "pages=`python -c \"import json; print(json.dumps([i for i in range($page_count)]))\"`" >> $GITHUB_OUTPUT
echo "pixeleagle_project=B25A040A-A980-4602-B90C-D480AB84076D" >> $GITHUB_OUTPUT
native-run:
name: Native
needs: [get-environment]
uses: ./.github/workflows/workflow-native.yml
with:
gitref: ${{ needs.get-environment.outputs.gitref }}
pixeleagle_project: ${{ needs.get-environment.outputs.pixeleagle_project }}
branch: "PR-${{ inputs.pr }}"
repository: "bevyengine/bevy"
pages: ${{ needs.get-environment.outputs.pages }}
per-page: ${{ needs.get-environment.outputs.per-pages }}
per_page: "${{ needs.get-environment.outputs.per_page }}"
secrets: inherit

mobile-run:
name: Mobile
needs: [get-environment]
uses: ./.github/workflows/workflow-mobile.yml
with:
Expand All @@ -64,6 +61,7 @@ jobs:
secrets: inherit

wasm-run:
name: wasm
needs: [get-environment]
uses: ./.github/workflows/workflow-wasm.yml
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/workflow-mobile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
-F "file=@target/debug/apk/bevyexample.apk" \
-F "custom_id=$GITHUB_RUN_ID"
mobile-run:
take-screenshots:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [build-for-iOS, build-for-Android]
Expand Down Expand Up @@ -181,7 +181,7 @@ jobs:
mobile-check-result:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [mobile-run]
needs: [take-screenshots]
if: always()
steps:
- name: Wait for screenshots comparison
Expand Down
36 changes: 27 additions & 9 deletions .github/workflows/workflow-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
repository:
required: true
type: string
default: 'bevyengine/bevy'
gitref:
required: true
type: string
Expand All @@ -15,25 +16,42 @@ on:
branch:
required: true
type: string
per-page:
required: true
type: number
pages:
default: 'main'
per_page:
required: true
type: string

jobs:
split-pages:
name: Prepare pages
runs-on: ubuntu-latest
outputs:
pages: ${{ steps.env.outputs.pages }}
steps:
- name: Checkout Bevy
uses: actions/checkout@v4
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 }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-14]
page: ${{ fromJSON(inputs.pages) }}
page: ${{ fromJSON(needs.split-pages.outputs.pages) }}

steps:

- name: Checkout Bevy main branch
- name: Checkout Bevy
uses: actions/checkout@v4
with:
repository: ${{ inputs.repository }}
Expand Down Expand Up @@ -96,7 +114,7 @@ jobs:
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-at 400 --frame-duration 0.0125 --stop-at 450 --in-ci --ignore-stress-tests --report-details
run: xvfb-run -s "-screen 0 1280x1024x24" cargo run -p example-showcase -- --page ${{ matrix.page }} --per-page ${{ inputs.per_page }} run --screenshot-at 400 --frame-duration 0.0125 --stop-at 450 --in-ci --ignore-stress-tests --report-details

- name: Take Screenshots (Windows)
id: screenshots-windows
Expand All @@ -108,13 +126,13 @@ jobs:
$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-at 400 --frame-duration 0.0125 --stop-at 450 --in-ci --ignore-stress-tests --report-details
cargo run -p example-showcase -- --page ${{ matrix.page }} --per-page ${{ inputs.per_page }} run --screenshot-at 400 --frame-duration 0.0125 --stop-at 450 --in-ci --ignore-stress-tests --report-details
- 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-at 400 --frame-duration 0.0125 --stop-at 450 --in-ci --ignore-stress-tests --report-details
run: cargo run -p example-showcase -- --page ${{ matrix.page }} --per-page ${{ inputs.per_page }} run --screenshot-at 400 --frame-duration 0.0125 --stop-at 450 --in-ci --ignore-stress-tests --report-details

- name: Log errors
shell: pwsh
Expand Down

0 comments on commit 70f33fe

Please sign in to comment.