Merge pull request #828 from NeptuneHub/devel #1538
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This workflow builds a Docker image for CPUs WITHOUT AVX2 instruction support. | |
| # It uses Dockerfile-noavx2 (based on v0.8.6: Ubuntu 22.04 / Python 3.10) with | |
| # proven non-AVX2 dependency versions (numpy 1.23.5, torch 2.5.1 CPU, etc.). | |
| # ARM64 is included because the v0.8.6 Dockerfile already supported it natively. | |
| # | |
| # Tags: | |
| # - version tags (e.g., v1.2.3) -> '1.2.3-noavx2' + 'latest-noavx2' | |
| # - push to main (e.g. a merged PR) -> 'devel-noavx2' | |
| # - manual run with version input (e.g., '0.8.7') -> '0.8.7-noavx2' + 'latest-noavx2' | |
| name: Build and Push AudioMuse AI Docker Image (NOAVX2) | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*.*.*' | |
| pull_request: | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to tag (e.g., 0.8.7). Will produce <version>-noavx2 and latest-noavx2 tags.' | |
| required: true | |
| type: string | |
| jobs: | |
| build-and-push-noavx2: | |
| # Run on non-PR events; for PR events skip drafts and fork PRs (the | |
| # latter only get a read-only GITHUB_TOKEN and cannot push to ghcr.io). | |
| # Maintainers can build a fork PR manually via workflow_dispatch. | |
| if: >- | |
| github.event_name != 'pull_request' || | |
| (github.event.pull_request.draft == false && | |
| github.event.pull_request.head.repo.full_name == github.repository) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Check initial disk space | |
| run: | | |
| echo "Disk space before cleanup:" | |
| df -h | |
| - name: Free Disk Space (Ubuntu) | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| swap-storage: false | |
| large-packages: true | |
| tool-cache: true | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| docker-images: true | |
| - name: Check disk space after cleanup | |
| run: | | |
| echo "Disk space after cleanup:" | |
| df -h | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| driver: docker-container | |
| driver-opts: image=moby/buildkit:latest | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set lower-case repository name | |
| id: repo_name | |
| run: echo "name=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ steps.repo_name.outputs.name }} | |
| flavor: | | |
| latest=false | |
| tags: | | |
| # Tag push: 1.2.3-noavx2 + latest-noavx2 | |
| type=raw,value=latest-noavx2,enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
| type=semver,pattern={{version}}-noavx2 | |
| # Push to main (merged PR): devel-noavx2 | |
| type=raw,value=devel-noavx2,enable=${{ github.ref == 'refs/heads/main' }} | |
| # Pull request: pr-<number>-noavx2 | |
| type=raw,value=pr-${{ github.event.pull_request.number }}-noavx2,enable=${{ github.event_name == 'pull_request' && github.event.pull_request.draft == false }} | |
| # Manual run: <input>-noavx2 + latest-noavx2 | |
| type=raw,value=${{ inputs.version }}-noavx2,enable=${{ inputs.version != '' }} | |
| type=raw,value=latest-noavx2,enable=${{ inputs.version != '' }} | |
| - name: Build and push AudioMuse AI Image (NOAVX2) | |
| id: docker_build_and_push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ${{ github.workspace }} | |
| file: Dockerfile-noavx2 | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha,scope=noavx2-${{ github.ref_name }} | |
| cache-to: type=gha,scope=noavx2-${{ github.ref_name }},mode=max | |
| - name: Final cleanup | |
| if: always() | |
| run: | | |
| echo "Final disk space:" | |
| df -h |