diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 784200a..01cdea2 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -13,7 +13,7 @@ jobs: matrix: platform: - linux/amd64 - #- linux/arm64 + - linux/arm64 runs-on: ${{ matrix.platform == 'linux/amd64' && 'ubuntu-24.04' || matrix.platform == 'linux/arm64' && 'ubuntu-24.04-arm' }} name: build ${{ matrix.platform }} outputs: @@ -39,7 +39,30 @@ jobs: with: images: ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }} + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3.11.1 + + - name: Build and push by digest + if: github.event_name == 'pull_request' + uses: docker/build-push-action@v6.18.0 + with: + file: ./docker/Dockerfile + platforms: ${{ matrix.platform }} + labels: ${{ steps.meta.outputs.labels }} + tags: ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }} + outputs: type=docker,push-by-digest=true,name-canonical=true,push=true + + - name: Run tests + if: github.event_name == 'pull_request' + shell: bash + run: | + docker run -t ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}:latest bash -c " \ + pip install pytest nbmake; \ + find . -name '*.ipynb' | pytest --nbmake --nbmake-timeout=3600; " + - name: Authenticate with GHCR + if: github.event_name != 'pull_request' id: auth uses: docker/login-action@v3.6.0 with: @@ -47,11 +70,8 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.BUILD_TOKEN }} - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v3.11.1 - - name: Build and push by digest + if: github.event_name != 'pull_request' id: build uses: docker/build-push-action@v6.18.0 with: @@ -61,20 +81,23 @@ jobs: tags: ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }} outputs: type=image,push-by-digest=true,name-canonical=true,push=true - #- name: Test notebooks - # shell: bash - # run: | - # docker run -t ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}@${{ steps.build.outputs.digest }} bash -c " \ - # pip install pytest nbmake; \ - # find ./notebooks -name '*.ipynb' | pytest --nbmake --nbmake-timeout=3600;" + - name: Run tests + if: github.event_name != 'pull_request' + shell: bash + run: | + docker run -t ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}@${{ steps.build.outputs.digest }} bash -c " \ + pip install pytest nbmake; \ + find . -name '*.ipynb' | pytest --nbmake --nbmake-timeout=3600; " - name: Export digest + if: github.event_name != 'pull_request' run: | mkdir -p ${{ runner.temp }}/digests digest="${{ steps.build.outputs.digest }}" touch "${{ runner.temp }}/digests/${digest#sha256:}" - name: Upload digest + if: github.event_name != 'pull_request' uses: actions/upload-artifact@v5.0.0 with: name: digests-${{ env.PLATFORM_PAIR }}