1313 matrix :
1414 platform :
1515 - linux/amd64
16- # - linux/arm64
16+ - linux/arm64
1717 runs-on : ${{ matrix.platform == 'linux/amd64' && 'ubuntu-24.04' || matrix.platform == 'linux/arm64' && 'ubuntu-24.04-arm' }}
1818 name : build ${{ matrix.platform }}
1919 outputs :
@@ -39,42 +39,67 @@ 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+ build-args : TARGETPLATFORM=${{ matrix.platform }}
51+ file : ./docker/Dockerfile
52+ platforms : ${{ matrix.platform }}
53+ labels : ${{ steps.meta.outputs.labels }}
54+ tags : ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}
55+ outputs : type=docker,push-by-digest=true,name-canonical=true,push=true
56+
57+ - name : Run tests
58+ if : github.event_name == 'pull_request'
59+ shell : bash
60+ run : |
61+ docker run -t ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}:latest bash -c " \
62+ pip install pytest nbmake; \
63+ find . -name '*.ipynb' | pytest --nbmake --nbmake-timeout=3600; "
64+
4265 - name : Authenticate with GHCR
66+ if : github.event_name != 'pull_request'
4367 id : auth
4468 uses : docker/login-action@v3.6.0
4569 with :
4670 registry : ghcr.io
4771 username : ${{ github.repository_owner }}
4872 password : ${{ secrets.BUILD_TOKEN }}
4973
50- - name : Set up Docker Buildx
51- id : buildx
52- uses : docker/setup-buildx-action@v3.11.1
53-
5474 - name : Build and push by digest
75+ if : github.event_name != 'pull_request'
5576 id : build
5677 uses : docker/build-push-action@v6.18.0
5778 with :
79+ build-args : TARGETPLATFORM=${{ matrix.platform }}
5880 file : ./docker/Dockerfile
5981 platforms : ${{ matrix.platform }}
6082 labels : ${{ steps.meta.outputs.labels }}
6183 tags : ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}
6284 outputs : type=image,push-by-digest=true,name-canonical=true,push=true
6385
64- # - name: Test notebooks
65- # shell: bash
66- # run: |
67- # docker run -t ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}@${{ steps.build.outputs.digest }} bash -c " \
68- # pip install pytest nbmake; \
69- # find . -name '*.ipynb' | pytest --nbmake --nbmake-timeout=3600;"
86+ - name : Run tests
87+ if : github.event_name != 'pull_request'
88+ shell : bash
89+ run : |
90+ docker run -t ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}@${{ steps.build.outputs.digest }} bash -c " \
91+ pip install pytest nbmake; \
92+ find . -name '*.ipynb' | pytest --nbmake --nbmake-timeout=3600; "
7093
7194 - name : Export digest
95+ if : github.event_name != 'pull_request'
7296 run : |
7397 mkdir -p ${{ runner.temp }}/digests
7498 digest="${{ steps.build.outputs.digest }}"
7599 touch "${{ runner.temp }}/digests/${digest#sha256:}"
76100
77101 - name : Upload digest
102+ if : github.event_name != 'pull_request'
78103 uses : actions/upload-artifact@v5.0.0
79104 with :
80105 name : digests-${{ env.PLATFORM_PAIR }}
0 commit comments