@@ -13,12 +13,19 @@ jobs:
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 :
2020 tag : ${{ steps.envvars.outputs.tag }}
2121 steps :
22+
23+ - name : " node-cleanup"
24+ run : |
25+ sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
26+ sudo docker image prune --all --force
27+ sudo docker builder prune -a
28+
2229 - name : checkout
2330 uses : actions/checkout@v5.0.0
2431
@@ -39,19 +46,39 @@ jobs:
3946 with :
4047 images : ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}
4148
49+ - name : Set up Docker Buildx
50+ id : buildx
51+ uses : docker/setup-buildx-action@v3.11.1
52+
53+ - name : Build and push by digest
54+ if : github.event_name == 'pull_request'
55+ uses : docker/build-push-action@v6.18.0
56+ with :
57+ file : ./docker/Dockerfile
58+ platforms : ${{ matrix.platform }}
59+ labels : ${{ steps.meta.outputs.labels }}
60+ tags : ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}
61+ outputs : type=docker,push-by-digest=true,name-canonical=true,push=true
62+
63+ - name : Run tests
64+ if : github.event_name == 'pull_request'
65+ shell : bash
66+ run : |
67+ docker run -t ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}:latest bash -c " \
68+ pip install pytest nbmake; \
69+ find . -name '*.ipynb' | pytest --nbmake --nbmake-timeout=3600; "
70+
4271 - name : Authenticate with GHCR
72+ if : github.event_name != 'pull_request'
4373 id : auth
4474 uses : docker/login-action@v3.6.0
4575 with :
4676 registry : ghcr.io
4777 username : ${{ github.repository_owner }}
4878 password : ${{ secrets.BUILD_TOKEN }}
4979
50- - name : Set up Docker Buildx
51- id : buildx
52- uses : docker/setup-buildx-action@v3.11.1
53-
5480 - name : Build and push by digest
81+ if : github.event_name != 'pull_request'
5582 id : build
5683 uses : docker/build-push-action@v6.18.0
5784 with :
@@ -61,20 +88,23 @@ jobs:
6188 tags : ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}
6289 outputs : type=image,push-by-digest=true,name-canonical=true,push=true
6390
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 ./notebooks -name '*.ipynb' | pytest --nbmake --nbmake-timeout=3600;"
91+ - name : Run tests
92+ if : github.event_name != 'pull_request'
93+ shell : bash
94+ run : |
95+ docker run -t ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}@${{ steps.build.outputs.digest }} bash -c " \
96+ pip install pytest nbmake; \
97+ find . -name '*.ipynb' | pytest --nbmake --nbmake-timeout=3600; "
7098
7199 - name : Export digest
100+ if : github.event_name != 'pull_request'
72101 run : |
73102 mkdir -p ${{ runner.temp }}/digests
74103 digest="${{ steps.build.outputs.digest }}"
75104 touch "${{ runner.temp }}/digests/${digest#sha256:}"
76105
77106 - name : Upload digest
107+ if : github.event_name != 'pull_request'
78108 uses : actions/upload-artifact@v5.0.0
79109 with :
80110 name : digests-${{ env.PLATFORM_PAIR }}
0 commit comments