From 11fd12e74236ee5286dbf712289fe72a1303b20f Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Fri, 19 Jul 2024 11:57:15 +0100 Subject: [PATCH] Fix integration tests on PRs from forks --- .github/workflows/docker-build-test-upload.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-build-test-upload.yml b/.github/workflows/docker-build-test-upload.yml index 521f640ad..483b9523c 100644 --- a/.github/workflows/docker-build-test-upload.yml +++ b/.github/workflows/docker-build-test-upload.yml @@ -80,7 +80,18 @@ jobs: - name: Run pytest for Chrome run: pytest -sv --driver Chrome tests_integration/ env: - QE_IMAGE: ${{ env.IMAGE }}@${{ steps.build-upload.outputs.digest }} + # We'd like to identify the image by its unique digest, i.e ghcr.io/aiidalab/qe@sha256: + # but that sadly does not work when the image is loaded to Docker locally and not published on ghcr.io + # as is the case for PRs from forks. Hence this super-ugly ternary expression... + # For forks, we take the image as ghcr.io/aiidalab/qe:pr-XXX + # which is stored in the steps.meta.outputs.tags variable + QE_IMAGE: >- + ${{ + github.event_name == 'pull_request' && + github.event.pull_request.head.repo.fork && + steps.meta.outputs.tags || + format('{0}@{1}', env.IMAGE, steps.build-upload.outputs.imageid) + }} - name: Upload screenshots as artifacts if: always()