66 repository :
77 required : true
88 type : string
9- default : ' bevyengine/bevy'
9+ default : " bevyengine/bevy"
1010 gitref :
1111 required : true
1212 type : string
13- default : ' main'
13+ default : " main"
1414 mobile_percy_project :
1515 required : false
1616 type : string
2525 repository :
2626 required : true
2727 type : string
28- default : ' bevyengine/bevy'
28+ default : " bevyengine/bevy"
29+ description : " Bevy repository to use"
2930 gitref :
3031 required : true
3132 type : string
32- default : ' main'
33+ default : " main"
34+ description : " Commit or branch name to run on"
3335 mobile_percy_project :
3436 required : false
3537 type : string
38+ description : " Percy project to send results to"
3639 pixeleagle_project :
3740 required : true
3841 type : string
39- default : ' B25A040A-A980-4602-B90C-D480AB84076D'
42+ default : " B25A040A-A980-4602-B90C-D480AB84076D"
43+ description : " Pixel Eagle project to send results to"
4044 branch :
4145 required : true
4246 type : string
47+ description : " Branch name to use as a tag in Pixel Eagle"
4348
4449jobs :
50+ create-pixel-eagle-run :
51+ runs-on : ubuntu-latest
52+ outputs :
53+ pixeleagle_run : ${{ steps.run.outputs.pixeleagle_run }}
54+ steps :
55+ - name : Create Run
56+ id : run
57+ run : |
58+ run=`curl https://pixel-eagle.com/${{ inputs.pixeleagle_project }}/runs -H 'Content-Type: application/json' -d '{"os":"mobile", "gitref": "${{ inputs.gitref }}", "branch": "${{ inputs.branch }}"}' --oauth2-bearer ${{ secrets.PIXELEAGLE }} | jq '.id'`
59+ echo "pixeleagle_run=$run" >> $GITHUB_OUTPUT
60+
4561 build-for-iOS :
4662 runs-on : macos-latest
4763 timeout-minutes : 30
@@ -54,17 +70,17 @@ jobs:
5470 - name : Checkout patches
5571 uses : actions/checkout@v4
5672 with :
57- path : ' runner-patches'
58-
73+ path : " runner-patches"
74+
5975 - name : Apply patches
6076 shell : pwsh
6177 run : |
62- Get-ChildItem "runner-patches/patches" -Filter *.patch |
78+ Get-ChildItem "runner-patches/patches" -Filter *.patch |
6379 Foreach-Object {
6480 Write-Output "Processing $($_.FullName)"
6581 git apply --ignore-whitespace $($_.FullName)
6682 }
67-
83+
6884 - uses : dtolnay/rust-toolchain@stable
6985
7086 - name : Add iOS targets
@@ -104,12 +120,12 @@ jobs:
104120 - name : Checkout patches
105121 uses : actions/checkout@v4
106122 with :
107- path : ' runner-patches'
108-
123+ path : " runner-patches"
124+
109125 - name : Apply patches
110126 shell : pwsh
111127 run : |
112- Get-ChildItem "runner-patches/patches" -Filter *.patch |
128+ Get-ChildItem "runner-patches/patches" -Filter *.patch |
113129 Foreach-Object {
114130 Write-Output "Processing $($_.FullName)"
115131 git apply --ignore-whitespace $($_.FullName)
@@ -122,8 +138,8 @@ jobs:
122138 - name : Set up JDK 17
123139 uses : actions/setup-java@v4
124140 with :
125- java-version : ' 17 '
126- distribution : ' temurin'
141+ java-version : " 17 "
142+ distribution : " temurin"
127143
128144 - name : Install Cargo NDK
129145 run : cargo install --force cargo-ndk
@@ -150,7 +166,7 @@ jobs:
150166 take-screenshots :
151167 runs-on : ubuntu-latest
152168 timeout-minutes : 30
153- needs : [build-for-iOS, build-for-Android]
169+ needs : [build-for-iOS, build-for-Android, create-pixel-eagle-run ]
154170 strategy :
155171 fail-fast : false
156172 max-parallel : 7
@@ -217,17 +233,17 @@ jobs:
217233 - name : Checkout patches
218234 uses : actions/checkout@v4
219235 with :
220- path : ' runner-patches'
221-
236+ path : " runner-patches"
237+
222238 - name : Apply patches
223239 shell : pwsh
224240 run : |
225- Get-ChildItem "runner-patches/patches" -Filter *.patch |
241+ Get-ChildItem "runner-patches/patches" -Filter *.patch |
226242 Foreach-Object {
227243 Write-Output "Processing $($_.FullName)"
228244 git apply --ignore-whitespace $($_.FullName)
229245 }
230-
246+
231247 - name : Set Percy Token if needed
232248 if : " ${{ inputs.mobile_percy_project != '' }}"
233249 run : echo "PERCY_TOKEN=${{ secrets.PERCY_TOKEN_MOBILE }}" >> $GITHUB_ENV
@@ -247,51 +263,25 @@ jobs:
247263 PERCY_COMMIT : ${{ inputs.gitref }}
248264 PERCY_PARALLEL_NONCE : ${{ github.run_id }}
249265 PERCY_PARALLEL_TOTAL : ${{ strategy.job-total }}
250-
266+
251267 - name : Save screenshots
252268 if : ${{ always() }}
253269 uses : actions/upload-artifact@v4
254270 with :
255271 name : screenshots-${{ matrix.device }}-${{ matrix.os_version }}
256272 path : .github/start-mobile-example/*.png
257-
273+
258274 - name : Send to Pixel Eagle
259275 run : |
260- run=`curl https://pixel-eagle.com/${{ inputs.pixeleagle_project }}/runs -H 'Content-Type: application/json' -d '{"device":"${{ matrix.device }}", "os":"${{ matrix.os }}-${{ matrix.os_version }}", "adapter": "${{ matrix.adapter }}", "gitref": "${{ inputs.gitref }}", "branch": "${{ inputs.branch }}"}' --oauth2-bearer ${{ secrets.PIXELEAGLE }} | jq '.id'`
261-
262- SAVEIFS=$IFS
263-
264- IFS=$'\n'
265-
266276 cd .github/start-mobile-example
267-
268- # Build a json array of screenshots and their hashes
269- hashes='[';
270277 for screenshot in $(find . -type f -maxdepth 1 -name "*.png");
271278 do
272- name=${screenshot:2}
279+ file=${screenshot:2}
280+ name="${{ matrix.os }}-${{ matrix.device }}-${{ matrix.os_version }}-$file"
273281 echo $name
274- hash=`shasum -a 256 $screenshot | awk '{print $1}'`
275- hashes="$hashes [\"$name\",\"$hash\"],"
282+ curl https://pixel-eagle.com/${{ inputs.pixeleagle_project }}/runs/${{ needs.create-pixel-eagle-run.outputs.pixeleagle_run }}/screenshots -F "data=@./$file" -F "screenshot=$name" --oauth2-bearer ${{ secrets.PIXELEAGLE }}
276283 done
277- hashes=`echo $hashes | rev | cut -c 2- | rev`
278- hashes="$hashes]"
279-
280- IFS=$SAVEIFS
281-
282- # Upload screenshots with unknown hashes
283- curl https://pixel-eagle.com/${{ inputs.pixeleagle_project }}/runs/$run/hashes -H 'Content-Type: application/json' -d "$hashes" --oauth2-bearer ${{ secrets.PIXELEAGLE }} | jq '.[]|[.name] | @tsv' |
284- while IFS=$'\t' read -r name; do
285- name=`echo $name | tr -d '"'`
286- echo "Uploading $name"
287- curl https://pixel-eagle.com/${{ inputs.pixeleagle_project }}/runs/$run/screenshots -F "data=@./$name" -F "screenshot=$name" --oauth2-bearer ${{ secrets.PIXELEAGLE }}
288- echo
289- done
290-
291- IFS=$SAVEIFS
292284
293- curl https://pixel-eagle.com/${{ inputs.pixeleagle_project }}/runs/$run/compare/auto -H 'Content-Type: application/json' -d '{"os":"<equal>", "device":"<equal>", "branch": "main"}' --oauth2-bearer ${{ secrets.PIXELEAGLE }}
294-
295285 mobile-check-result :
296286 runs-on : ubuntu-latest
297287 timeout-minutes : 30
@@ -308,3 +298,24 @@ jobs:
308298 sleep 30
309299 env :
310300 PERCY_TOKEN : ${{ secrets.PERCY_TOKEN_MOBILE }}
301+
302+ mobile-check-result-pixel-eagle :
303+ runs-on : ubuntu-latest
304+ timeout-minutes : 30
305+ needs : [take-screenshots]
306+ if : always()
307+ steps :
308+ - name : Trigger screenshots comparison
309+ run : |
310+ curl https://pixel-eagle.com/${{ inputs.pixeleagle_project }}/runs/${{ needs.create-pixel-eagle-run.outputs.pixeleagle_run }}/compare/auto -H 'Content-Type: application/json' -d '{"os":"<equal>", "branch": "main"}' --oauth2-bearer ${{ secrets.PIXELEAGLE }} | jq '{project_id: .project_id, from: .from, to: .to}' > pixeleagle-mobile.json
311+ cat pixeleagle-mobile.json
312+
313+ - name : Upload Pixel Eagle status
314+ uses : actions/upload-artifact@v4
315+ with :
316+ name : pixeleagle-mobile
317+ path : pixeleagle-mobile.json
318+
319+ - name : Wait a bit
320+ run : |
321+ sleep 30
0 commit comments