@@ -39,19 +39,39 @@ jobs:
3939 with :
4040 images : ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}
4141
42+ - name : Set up Docker Buildx
43+ id : buildx
44+ uses : docker/setup-buildx-action@v3.11.1
45+
46+ - name : Build and push by digest
47+ if : github.event_name == 'pull_request'
48+ uses : docker/build-push-action@v6.18.0
49+ with :
50+ file : ./docker/Dockerfile
51+ platforms : ${{ matrix.platform }}
52+ labels : ${{ steps.meta.outputs.labels }}
53+ tags : ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}
54+ outputs : type=docker,push-by-digest=true,name-canonical=true,push=true
55+
56+ - name : Run tests
57+ if : github.event_name == 'pull_request'
58+ shell : bash
59+ run : |
60+ docker run -t ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}:latest bash -c " \
61+ pip install pytest nbmake; \
62+ find . -name '*.ipynb' | pytest --nbmake --nbmake-timeout=3600 --ignore=answers; "
63+
4264 - name : Authenticate with GHCR
65+ if : github.event_name != 'pull_request'
4366 id : auth
4467 uses : docker/login-action@v3.6.0
4568 with :
4669 registry : ghcr.io
4770 username : ${{ github.repository_owner }}
4871 password : ${{ secrets.BUILD_TOKEN }}
4972
50- - name : Set up Docker Buildx
51- id : buildx
52- uses : docker/setup-buildx-action@v3.11.1
53-
5473 - name : Build and push by digest
74+ if : github.event_name != 'pull_request'
5575 id : build
5676 uses : docker/build-push-action@v6.18.0
5777 with :
@@ -61,20 +81,23 @@ jobs:
6181 tags : ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}
6282 outputs : type=image,push-by-digest=true,name-canonical=true,push=true
6383
64- - name : Test notebooks
84+ - name : Run tests
85+ if : github.event_name != 'pull_request'
6586 shell : bash
6687 run : |
6788 docker run -t ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}@${{ steps.build.outputs.digest }} bash -c " \
6889 pip install pytest nbmake; \
6990 find . -name '*.ipynb' | pytest --nbmake --nbmake-timeout=3600 --ignore=answers; "
7091
7192 - name : Export digest
93+ if : github.event_name != 'pull_request'
7294 run : |
7395 mkdir -p ${{ runner.temp }}/digests
7496 digest="${{ steps.build.outputs.digest }}"
7597 touch "${{ runner.temp }}/digests/${digest#sha256:}"
7698
7799 - name : Upload digest
100+ if : github.event_name != 'pull_request'
78101 uses : actions/upload-artifact@v5.0.0
79102 with :
80103 name : digests-${{ env.PLATFORM_PAIR }}
0 commit comments