Skip to content

Commit

Permalink
sending screenshots to pixel eagle (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf authored Mar 10, 2024
1 parent ff7e4b5 commit d15deeb
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/example-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -502,3 +502,64 @@ jobs:
nonce: ${{ needs.get-environment.outputs.mobile_nonce }}
mobile_percy_project: ${{ needs.get-environment.outputs.mobile_percy_project }}
secrets: inherit

send-to-pixel-eagle:
name: Send screenshots to Pixel Eagle
runs-on: macos-14
needs: [take-screenshots, get-environment]
strategy:
fail-fast: false
matrix:
include:
- os: Linux
- os: macOS
- os: Windows
steps:

- name: Download all artifacts
uses: actions/download-artifact@v4
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: Send to Pixel Eagle
if: steps.gather-examples.outcome == 'success'
run: |
uuid="B25A040A-A980-4602-B90C-D480AB84076D"
id=`curl https://pixel-eagle.vleue.com/$uuid/runs --json '{"os":"${{ matrix.os }}", "gitref": "${{ needs.get-environment.outputs.gitref }}"}' | jq '.id'`
SAVEIFS=$IFS
IFS=$'\n'
cd screenshots-${{ matrix.os }}
for screenshot in $(find . -type f -name "*.png");
do
name=${screenshot:2}
echo $name
sha=`shasum -a 256 $screenshot | awk '{print $1}'`
to_upload=`curl https://pixel-eagle.vleue.com/$uuid/runs/$id/hashes --json "[ [\"$name\", \"$sha\"] ]" | jq '. | length'`
if [ $to_upload -eq 1 ]; then
echo " uploading $screenshot"
curl https://pixel-eagle.vleue.com/$uuid/runs/$id/screenshots -F "data=@$screenshot" -F "screenshot=$name"
else
echo " skipping $screenshot"
fi
done
echo "created run $id"
IFS=$SAVEIFS

0 comments on commit d15deeb

Please sign in to comment.