diff --git a/.github/workflows/ai-bundles.yml b/.github/workflows/ai-bundles.yml index f63ab7b2..6250d3b3 100644 --- a/.github/workflows/ai-bundles.yml +++ b/.github/workflows/ai-bundles.yml @@ -116,9 +116,108 @@ jobs: path: /tmp/bundles/ retention-days: 1 + verify: + name: Verify ${{ matrix.bundle }} (${{ matrix.arch }}) + needs: build + timeout-minutes: 20 + strategy: + fail-fast: false + matrix: + include: + - bundle: background-removal + arch: amd64-gpu + runner: ubuntu-latest + - bundle: background-removal + arch: arm64-cpu + runner: ubuntu-24.04-arm + - bundle: face-detection + arch: amd64-gpu + runner: ubuntu-latest + - bundle: face-detection + arch: arm64-cpu + runner: ubuntu-24.04-arm + - bundle: object-eraser-colorize + arch: amd64-gpu + runner: ubuntu-latest + - bundle: object-eraser-colorize + arch: arm64-cpu + runner: ubuntu-24.04-arm + - bundle: upscale-enhance + arch: amd64-gpu + runner: ubuntu-latest + - bundle: upscale-enhance + arch: arm64-cpu + runner: ubuntu-24.04-arm + - bundle: photo-restoration + arch: amd64-gpu + runner: ubuntu-latest + - bundle: photo-restoration + arch: arm64-cpu + runner: ubuntu-24.04-arm + - bundle: ocr + arch: amd64-gpu + runner: ubuntu-latest + - bundle: ocr + arch: arm64-cpu + runner: ubuntu-24.04-arm + - bundle: transcription + arch: amd64-gpu + runner: ubuntu-latest + - bundle: transcription + arch: arm64-cpu + runner: ubuntu-24.04-arm + runs-on: ${{ matrix.runner }} + permissions: + contents: read + packages: read + steps: + - name: Free disk space + run: | + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc \ + /usr/local/share/boost /opt/hostedtoolcache/CodeQL + sudo docker system prune -af + df -h / + + - name: Checkout + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + ref: v${{ inputs.version }} + + - name: Log in to GHCR + uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GHCR_TOKEN }} + + - name: Download build artifact + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ${{ matrix.bundle }}-${{ matrix.arch }} + path: /tmp/bundles + + - name: Verify bundle + env: + BUNDLE: ${{ matrix.bundle }} + ARCH: ${{ matrix.arch }} + VERSION: ${{ inputs.version }} + run: | + docker run --rm --entrypoint bash \ + -v "$PWD/docker/verify-bundle.sh:/verify-bundle.sh:ro" \ + -v "$PWD/packages/ai/python:/app/packages/ai/python:ro" \ + -v "$PWD/tests/fixtures:/fixtures:ro" \ + -v "/tmp/bundles:/bundles:ro" \ + -e SNAPOTTER_GPU=0 \ + -e CUDA_VISIBLE_DEVICES="" \ + -e MODELS_PATH=/tmp/verify-models \ + -e U2NET_HOME=/tmp/verify-models/rembg \ + -e PYTHONPATH=/app/packages/ai/python \ + "ghcr.io/snapotter-hq/snapotter:${VERSION}" \ + /verify-bundle.sh "${BUNDLE}" "${ARCH}" + publish: name: Publish to HuggingFace - needs: build + needs: verify runs-on: ubuntu-latest permissions: contents: read