@@ -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,44 +46,69 @@ 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+ build-args : |
58+ AMBERTOOLS_DL=${{ secrets.AMBERTOOLS_DL }}
59+ file : ./docker/Dockerfile
60+ platforms : ${{ matrix.platform }}
61+ labels : ${{ steps.meta.outputs.labels }}
62+ tags : ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}
63+ outputs : type=docker,push-by-digest=true,name-canonical=true,push=true
64+
65+ - name : Run tests
66+ if : github.event_name == 'pull_request'
67+ shell : bash
68+ run : |
69+ docker run -t ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}:latest bash -c " \
70+ pip install pytest nbmake; \
71+ find . -name '*.ipynb' | pytest --nbmake --nbmake-timeout=3600; "
72+
4273 - name : Authenticate with GHCR
74+ if : github.event_name != 'pull_request'
4375 id : auth
4476 uses : docker/login-action@v3.6.0
4577 with :
4678 registry : ghcr.io
4779 username : ${{ github.repository_owner }}
4880 password : ${{ secrets.BUILD_TOKEN }}
4981
50- - name : Set up Docker Buildx
51- id : buildx
52- uses : docker/setup-buildx-action@v3.11.1
53-
5482 - name : Build and push by digest
83+ if : github.event_name != 'pull_request'
5584 id : build
5685 uses : docker/build-push-action@v6.18.0
5786 with :
58- file : ./docker/Dockerfile
5987 build-args : |
6088 AMBERTOOLS_DL=${{ secrets.AMBERTOOLS_DL }}
89+ file : ./docker/Dockerfile
6190 platforms : ${{ matrix.platform }}
6291 labels : ${{ steps.meta.outputs.labels }}
6392 tags : ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}
6493 outputs : type=image,push-by-digest=true,name-canonical=true,push=true
6594
66- # - name: Test notebooks
67- # shell: bash
68- # run: |
69- # docker run -t ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}@${{ steps.build.outputs.digest }} bash -c " \
70- # pip install pytest nbmake; \
71- # find ./notebooks -name '*.ipynb' | pytest --nbmake --nbmake-timeout=3600;"
95+ - name : Run tests
96+ if : github.event_name != 'pull_request'
97+ shell : bash
98+ run : |
99+ docker run -t ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}@${{ steps.build.outputs.digest }} bash -c " \
100+ pip install pytest nbmake; \
101+ find . -name '*.ipynb' | pytest --nbmake --nbmake-timeout=3600; "
72102
73103 - name : Export digest
104+ if : github.event_name != 'pull_request'
74105 run : |
75106 mkdir -p ${{ runner.temp }}/digests
76107 digest="${{ steps.build.outputs.digest }}"
77108 touch "${{ runner.temp }}/digests/${digest#sha256:}"
78109
79110 - name : Upload digest
111+ if : github.event_name != 'pull_request'
80112 uses : actions/upload-artifact@v5.0.0
81113 with :
82114 name : digests-${{ env.PLATFORM_PAIR }}
0 commit comments