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

View file

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

View file

@ -78,17 +78,17 @@ jobs:
missing=`cat pixeleagle.json | jq '.missing | length'` missing=`cat pixeleagle.json | jq '.missing | length'`
if [ ! $missing -eq 0 ]; then if [ ! $missing -eq 0 ]; then
echo "There are $missing missing screenshots" 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 status=1
fi fi
diff=`cat pixeleagle.json | jq '.diff | length'` diff=`cat pixeleagle.json | jq '.diff | length'`
if [ ! $diff -eq 0 ]; then if [ ! $diff -eq 0 ]; then
echo "There are $diff screenshots with a difference" 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 status=1
fi 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 exit $status