From a8530ebbc83f6f53751bfbcfc128db0764a5d2b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Mockers?= Date: Tue, 15 Oct 2024 01:20:56 +0200 Subject: [PATCH] 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 --- .github/workflows/ci-comment-failures.yml | 21 +++++++++++++------ .github/workflows/ci.yml | 4 ++++ .../send-screenshots-to-pixeleagle.yml | 6 +++--- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-comment-failures.yml b/.github/workflows/ci-comment-failures.yml index ce005ed81e..d926390993 100644 --- a/.github/workflows/ci-comment-failures.yml +++ b/.github/workflows/ci-comment-failures.yml @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c43ecb0d66..95d9ad186f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/.github/workflows/send-screenshots-to-pixeleagle.yml b/.github/workflows/send-screenshots-to-pixeleagle.yml index 16bb8a4254..2b847dc95e 100644 --- a/.github/workflows/send-screenshots-to-pixeleagle.yml +++ b/.github/workflows/send-screenshots-to-pixeleagle.yml @@ -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