mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
eb40e68274
Bumps the actions group with 8 updates: | Package | From | To | | --- | --- | --- | | [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | `4.1.0` | `4.2.0` | | [docker/login-action](https://github.com/docker/login-action) | `4.2.0` | `4.4.0` | | [github/codeql-action/init](https://github.com/github/codeql-action) | `4.36.2` | `4.36.3` | | [github/codeql-action/autobuild](https://github.com/github/codeql-action) | `4.36.2` | `4.36.3` | | [github/codeql-action/analyze](https://github.com/github/codeql-action) | `4.36.2` | `4.36.3` | | [docker/metadata-action](https://github.com/docker/metadata-action) | `6.1.0` | `6.2.0` | | [docker/build-push-action](https://github.com/docker/build-push-action) | `7.2.0` | `7.3.0` | | [github/codeql-action/upload-sarif](https://github.com/github/codeql-action) | `4.36.2` | `4.36.3` | Updates `docker/setup-buildx-action` from 4.1.0 to 4.2.0 - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](https://github.com/docker/setup-buildx-action/compare/d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5...bb05f3f5519dd87d3ba754cc423b652a5edd6d2c) Updates `docker/login-action` from 4.2.0 to 4.4.0 - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/650006c6eb7dba73a995cc03b0b2d7f5ca915bee...af1e73f918a031802d376d3c8bbc3fe56130a9b0) Updates `github/codeql-action/init` from 4.36.2 to 4.36.3 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/8aad20d150bbac5944a9f9d289da16a4b0d87c1e...54f647b7e1bb85c95cddabcd46b0c578ec92bc1a) Updates `github/codeql-action/autobuild` from 4.36.2 to 4.36.3 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/8aad20d150bbac5944a9f9d289da16a4b0d87c1e...54f647b7e1bb85c95cddabcd46b0c578ec92bc1a) Updates `github/codeql-action/analyze` from 4.36.2 to 4.36.3 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/8aad20d150bbac5944a9f9d289da16a4b0d87c1e...54f647b7e1bb85c95cddabcd46b0c578ec92bc1a) Updates `docker/metadata-action` from 6.1.0 to 6.2.0 - [Release notes](https://github.com/docker/metadata-action/releases) - [Commits](https://github.com/docker/metadata-action/compare/80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9...dc802804100637a589fabce1cb79ff13a1411302) Updates `docker/build-push-action` from 7.2.0 to 7.3.0 - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/f9f3042f7e2789586610d6e8b85c8f03e5195baf...53b7df96c91f9c12dcc8a07bcb9ccacbed38856a) Updates `github/codeql-action/upload-sarif` from 4.36.2 to 4.36.3 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/8aad20d150bbac5944a9f9d289da16a4b0d87c1e...54f647b7e1bb85c95cddabcd46b0c578ec92bc1a) --- updated-dependencies: - dependency-name: docker/setup-buildx-action dependency-version: 4.2.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: docker/login-action dependency-version: 4.4.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: github/codeql-action/init dependency-version: 4.36.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: github/codeql-action/autobuild dependency-version: 4.36.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: github/codeql-action/analyze dependency-version: 4.36.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: docker/metadata-action dependency-version: 6.2.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: docker/build-push-action dependency-version: 7.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: github/codeql-action/upload-sarif dependency-version: 4.36.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
266 lines
8.5 KiB
YAML
266 lines
8.5 KiB
YAML
name: AI Bundles
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: "Version to build bundles for (e.g., 2.0.0)"
|
|
required: true
|
|
type: string
|
|
workflow_call:
|
|
inputs:
|
|
version:
|
|
type: string
|
|
required: true
|
|
|
|
concurrency:
|
|
group: ai-bundles-${{ inputs.version }}
|
|
cancel-in-progress: false
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
build:
|
|
name: ${{ matrix.bundle }} (${{ matrix.arch }})
|
|
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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
ref: v${{ inputs.version }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
|
|
|
|
- name: Log in to GHCR
|
|
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GHCR_TOKEN }}
|
|
|
|
- name: Build bundle inside Docker image
|
|
env:
|
|
BUNDLE: ${{ matrix.bundle }}
|
|
ARCH: ${{ matrix.arch }}
|
|
VERSION: ${{ inputs.version }}
|
|
run: |
|
|
mkdir -p /tmp/bundles
|
|
docker run --rm --entrypoint bash \
|
|
-v "$PWD/docker/build-bundle.sh:/build-bundle.sh:ro" \
|
|
-v "$PWD/docker/feature-manifest.json:/app/docker/feature-manifest.json:ro" \
|
|
-v "/tmp/bundles:/output" \
|
|
"ghcr.io/snapotter-hq/snapotter:${VERSION}" \
|
|
/build-bundle.sh "${BUNDLE}" "${ARCH}" /output
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: ${{ matrix.bundle }}-${{ matrix.arch }}
|
|
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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
ref: v${{ inputs.version }}
|
|
|
|
- name: Log in to GHCR
|
|
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.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: verify
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
with:
|
|
path: /tmp/artifacts
|
|
|
|
- name: Install hf CLI
|
|
run: pip install -U "huggingface_hub[hf_xet]"
|
|
|
|
- name: Organize and upload to HuggingFace
|
|
env:
|
|
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
|
VERSION: ${{ inputs.version }}
|
|
run: |
|
|
mkdir -p "/tmp/upload/v${VERSION}"
|
|
|
|
find /tmp/artifacts -name '*.tar.gz' -exec cp {} "/tmp/upload/v${VERSION}/" \;
|
|
find /tmp/artifacts -name '*.sha256' -exec cp {} "/tmp/upload/v${VERSION}/" \;
|
|
|
|
cd "/tmp/upload/v${VERSION}"
|
|
echo '{"version":"'"${VERSION}"'","archives":[' > manifest.json
|
|
first=true
|
|
for archive in *.tar.gz; do
|
|
[ -f "$archive" ] || continue
|
|
sha=$(sha256sum "$archive" | cut -d' ' -f1)
|
|
size=$(stat --format=%s "$archive")
|
|
if [ "$first" = true ]; then
|
|
first=false
|
|
else
|
|
echo ',' >> manifest.json
|
|
fi
|
|
printf '{"file":"%s","sha256":"%s","size":%s}' "$archive" "$sha" "$size" >> manifest.json
|
|
done
|
|
echo ']}' >> manifest.json
|
|
|
|
# Interim: publish to the deepsafe account (the HF_TOKEN secret is deepsafe's).
|
|
# Switch back to snapotter/feature-bundles once that account is restored.
|
|
hf upload deepsafe/feature-bundles \
|
|
"/tmp/upload/v${VERSION}" "v${VERSION}" \
|
|
--repo-type model
|
|
|
|
echo "Published: https://huggingface.co/deepsafe/feature-bundles/tree/main/v${VERSION}"
|