Build & Release Binaries #21
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
| name: Build & Release Binaries | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| release_tag: | |
| description: 'Release tag to attach binaries to (e.g. v0.1.0)' | |
| required: true | |
| type: string | |
| skip_linux: | |
| description: 'Skip Linux build' | |
| required: false | |
| type: boolean | |
| default: false | |
| skip_mac: | |
| description: 'Skip macOS build' | |
| required: false | |
| type: boolean | |
| default: false | |
| skip_windows: | |
| description: 'Skip Windows build' | |
| required: false | |
| type: boolean | |
| default: false | |
| permissions: | |
| contents: write | |
| jobs: | |
| # ───────────────────────────────────────────── | |
| # Linux x64 | |
| # ───────────────────────────────────────────── | |
| build-linux: | |
| name: Build · linux-x64 | |
| runs-on: ubuntu-22.04 | |
| if: github.event_name != 'workflow_dispatch' || !inputs.skip_linux | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install build tools | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y -qq cmake build-essential pkg-config libopenblas-dev | |
| - name: ccache | |
| uses: hendrikmuhs/ccache-action@v1.2 | |
| with: | |
| create-symlink: true | |
| key: build-linux-ubuntu-22.04 | |
| - name: Install CUDA toolkit | |
| uses: Jimver/cuda-toolkit@v0.2.30 | |
| with: | |
| log-file-suffix: 'ubuntu-22.04.txt' | |
| - name: Install Vulkan SDK | |
| uses: humbletim/install-vulkan-sdk@v1.2 | |
| with: | |
| version: 1.4.309.0 | |
| cache: true | |
| - name: Configure & Build | |
| run: | | |
| ./buildall.sh | |
| - name: Smoke test | |
| continue-on-error: true | |
| shell: bash | |
| run: | | |
| BIN="build" | |
| "$BIN/ace-lm" 2>&1 | head -5 | |
| "$BIN/ace-synth" 2>&1 | head -5 | |
| "$BIN/ace-understand" 2>&1 | head -5 | |
| "$BIN/neural-codec" 2>&1 | head -5 | |
| "$BIN/quantize" 2>&1 | head -3 | |
| "$BIN/mp3-codec" 2>&1 | head -3 | |
| - name: Resolve release tag | |
| id: tag | |
| shell: bash | |
| run: | | |
| if [ "${{ github.event_name }}" = "release" ]; then | |
| echo "value=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "value=${{ inputs.release_tag }}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Package binaries | |
| run: | | |
| mkdir -p dist | |
| cp build/ace-* \ | |
| build/quantize build/neural-codec build/mp3-codec build/*.so dist/ | |
| tar -C dist -czf "acestep-linux-x64.tar.gz" . | |
| - name: Upload to release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release upload "${{ steps.tag.outputs.value }}" \ | |
| "acestep-linux-x64.tar.gz" \ | |
| --clobber | |
| # ───────────────────────────────────────────── | |
| # macOS arm64 (Metal) | |
| # ───────────────────────────────────────────── | |
| build-mac: | |
| name: Build · macos-arm64-metal | |
| runs-on: macos-latest | |
| if: github.event_name != 'workflow_dispatch' || !inputs.skip_mac | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: ccache | |
| uses: hendrikmuhs/ccache-action@v1.2 | |
| with: | |
| create-symlink: true | |
| key: build-mac-macos-latest | |
| - name: Configure & Build | |
| run: | | |
| mkdir build | |
| cd build | |
| cmake .. | |
| cmake --build . --config Release -j "$(nproc)" | |
| - name: Smoke test | |
| continue-on-error: true | |
| shell: bash | |
| run: | | |
| BIN="build" | |
| "$BIN/ace-lm" 2>&1 | head -5 | |
| "$BIN/ace-synth" 2>&1 | head -5 | |
| "$BIN/ace-understand" 2>&1 | head -5 | |
| "$BIN/neural-codec" 2>&1 | head -5 | |
| "$BIN/quantize" 2>&1 | head -3 | |
| "$BIN/mp3-codec" 2>&1 | head -3 | |
| - name: Resolve release tag | |
| id: tag | |
| shell: bash | |
| run: | | |
| if [ "${{ github.event_name }}" = "release" ]; then | |
| echo "value=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "value=${{ inputs.release_tag }}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Package binaries | |
| run: | | |
| mkdir -p dist | |
| cd build | |
| for bin in ace-* quantize neural-codec mp3-codec; do | |
| install_name_tool -add_rpath @executable_path "$bin" | |
| done | |
| cp -P ace-* quantize neural-codec mp3-codec libacestep*.a libggml*.dylib ../dist/ | |
| cd .. | |
| tar -C dist -czf "acestep-macos-arm64-metal.tar.gz" . | |
| - name: Upload to release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release upload "${{ steps.tag.outputs.value }}" \ | |
| "acestep-macos-arm64-metal.tar.gz" \ | |
| --clobber | |
| # ───────────────────────────────────────────── | |
| # Windows x64 | |
| # ───────────────────────────────────────────── | |
| build-windows: | |
| name: Build · windows-x64 | |
| runs-on: windows-latest | |
| if: github.event_name != 'workflow_dispatch' || !inputs.skip_windows | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| # Cache the CUDA toolkit installation (~5 GB, takes 20-30 min without cache) | |
| - name: Cache CUDA toolkit | |
| id: cache-cuda | |
| uses: actions/cache@v4 | |
| with: | |
| path: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA | |
| key: cuda-12-windows-latest | |
| - name: Install CUDA toolkit | |
| if: steps.cache-cuda.outputs.cache-hit != 'true' | |
| uses: Jimver/cuda-toolkit@v0.2.30 | |
| with: | |
| log-file-suffix: 'windows-latest.txt' | |
| # Vulkan SDK has built-in cache support | |
| - name: Install Vulkan SDK | |
| uses: humbletim/install-vulkan-sdk@v1.2 | |
| with: | |
| version: 1.4.309.0 | |
| cache: true | |
| # Cache the CMake build directory to speed up incremental builds | |
| - name: Cache build directory | |
| uses: actions/cache@v4 | |
| with: | |
| path: build-msvc | |
| key: build-msvc-${{ github.sha }} | |
| restore-keys: | | |
| build-msvc- | |
| - name: Configure & Build | |
| shell: pwsh | |
| run: | | |
| # Configure — only print errors | |
| cmake -S . -B build-msvc ` | |
| -DGGML_CPU_ALL_VARIANTS=ON ` | |
| -DGGML_CUDA=ON ` | |
| -DGGML_VULKAN=ON ` | |
| -DGGML_BACKEND_DL=ON ` | |
| --log-level=ERROR 2>&1 | Where-Object { $_ -notmatch '^--' } | |
| # Build — suppress per-file progress, only show warnings/errors | |
| cmake --build build-msvc --config Release -j $env:NUMBER_OF_PROCESSORS ` | |
| -- /v:minimal /consoleloggerparameters:ErrorsOnly 2>&1 ` | |
| | Where-Object { $_ -match '(error|warning|FAILED|fatal)' -or $_ -eq '' } ` | |
| | Select-Object -Last 50 | |
| - name: Smoke test | |
| continue-on-error: true | |
| shell: bash | |
| run: | | |
| BIN="build-msvc/Release" | |
| "$BIN/ace-lm.exe" 2>&1 | head -5 | |
| "$BIN/ace-synth.exe" 2>&1 | head -5 | |
| "$BIN/ace-understand.exe" 2>&1 | head -5 | |
| "$BIN/neural-codec.exe" 2>&1 | head -5 | |
| "$BIN/quantize.exe" 2>&1 | head -3 | |
| "$BIN/mp3-codec.exe" 2>&1 | head -3 | |
| - name: Resolve release tag | |
| id: tag | |
| shell: bash | |
| run: | | |
| if [ "${{ github.event_name }}" = "release" ]; then | |
| echo "value=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "value=${{ inputs.release_tag }}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Package binaries | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Path dist | Out-Null | |
| Copy-Item "build-msvc\Release\*.exe" dist\ -ErrorAction SilentlyContinue | |
| Copy-Item "build-msvc\Release\*.dll" dist\ -ErrorAction SilentlyContinue | |
| Compress-Archive -Path dist\* -DestinationPath "acestep-windows-x64.zip" | |
| - name: Upload to release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| shell: pwsh | |
| run: | | |
| gh release upload "${{ steps.tag.outputs.value }}" ` | |
| "acestep-windows-x64.zip" ` | |
| --clobber |