screenshot comparison: fix upload for macOS... again (#15914)

# Objective

- Used the wrong variable to set metadata
- new fixes after https://github.com/bevyengine/bevy/pull/15911

## Solution

- Use the right one
- Also keep a reference to the original PR when there's one
This commit is contained in:
François Mockers 2024-10-15 01:20:56 +02:00 committed by GitHub
parent 8c0fcf02d0
commit a8530ebbc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 9 deletions

View file

@ -30,7 +30,7 @@ jobs:
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
run_id: ${{ github.event.workflow_run.id }},
});
var matchArtifacts = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "missing-examples"
@ -88,7 +88,7 @@ jobs:
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
run_id: ${{ github.event.workflow_run.id }},
});
var matchArtifacts = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "missing-features"
@ -146,7 +146,7 @@ jobs:
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
run_id: ${{ github.event.workflow_run.id }},
});
var matchArtifacts = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "msrv"
@ -182,6 +182,8 @@ jobs:
make-macos-screenshots-available:
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
branch-name: ${{ steps.branch-name.outputs.result }}
steps:
- name: 'Download artifact'
id: find-artifact
@ -218,15 +220,22 @@ jobs:
with:
name: screenshots-macos
path: screenshots
- name: branch name
id: branch-name
run: |
if [ -f PR ]; then
echo "result=PR-$(cat PR)-${{ github.event.workflow_run.head_branch }}" >> $GITHUB_OUTPUT
else
echo "result=${{ github.event.workflow_run.head_branch }}" >> $GITHUB_OUTPUT
fi
compare-macos-screenshots:
name: Compare macOS screenshots
needs: [make-macos-screenshots-available]
uses: ./.github/workflows/send-screenshots-to-pixeleagle.yml
with:
commit: ${{ github.event.workflow_run.head_commit }}
branch: ${{ github.event.workflow_run.head_branch }}
commit: ${{ github.event.workflow_run.head_sha }}
branch: ${{ needs.make-macos-screenshots-available.outputs.branch-name }}
artifact: screenshots-macos
os: macos
secrets: inherit

View file

@ -287,6 +287,10 @@ jobs:
with:
name: example-traces-macos
path: traces
- name: Save PR number
if: ${{ github.event_name == 'pull_request' }}
run: |
echo ${{ github.event.number }} > ./screenshots/PR
- name: save screenshots
uses: actions/upload-artifact@v4
with:

View file

@ -78,17 +78,17 @@ jobs:
missing=`cat pixeleagle.json | jq '.missing | length'`
if [ ! $missing -eq 0 ]; then
echo "There are $missing missing screenshots"
echo "::warning title=$missing missing screenshots on ${{ inputs.os }}::https://pixel-eagle.vleue.com/$project/runs/$run/compare/$to"
echo "::warning title=$missing missing screenshots on ${{ inputs.os }}::https://pixel-eagle.vleue.com/$project/runs/$run/compare/$compared_with"
status=1
fi
diff=`cat pixeleagle.json | jq '.diff | length'`
if [ ! $diff -eq 0 ]; then
echo "There are $diff screenshots with a difference"
echo "::warning title=$diff different screenshots on ${{ inputs.os }}::https://pixel-eagle.vleue.com/$project/runs/$run/compare/$to"
echo "::warning title=$diff different screenshots on ${{ inputs.os }}::https://pixel-eagle.vleue.com/$project/runs/$run/compare/$compared_with"
status=1
fi
echo "created run $run: https://pixel-eagle.vleue.com/$project/runs/$run/compare/$to"
echo "created run $run: https://pixel-eagle.vleue.com/$project/runs/$run/compare/$compared_with"
exit $status