vs2026 test #59
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: Release | |
| on: | |
| workflow_dispatch: # allows manual triggering | |
| inputs: | |
| create_release: | |
| description: 'Create new release' | |
| required: true | |
| type: boolean | |
| push: | |
| branches: | |
| - master | |
| paths: [ | |
| '.github/workflows/release.yml', | |
| '**/CMakeLists.txt', | |
| '**/.cmake', | |
| '**/*.h', | |
| '**/*.hpp', | |
| '**/*.c', | |
| '**/*.cpp', | |
| '**/*.cu', | |
| '**/*.cuh', | |
| '**/*.swift', | |
| '**/*.m', | |
| '**/*.metal', | |
| '**/*.comp', | |
| '**/*.glsl' | |
| ] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} | |
| cancel-in-progress: true | |
| env: | |
| BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
| CMAKE_ARGS: "-DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_TOOLS=ON -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON" | |
| jobs: | |
| windows-cpu: | |
| runs-on: windows-2025-vs2026 | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: 'x64' | |
| - arch: 'arm64' | |
| steps: | |
| - name: Clone | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "24" | |
| cache: "npm" | |
| cache-dependency-path: "tools/ui/package-lock.json" | |
| - name: ccache | |
| uses: ggml-org/ccache-action@v1.2.21 | |
| with: | |
| key: windows-latest-cpu-${{ matrix.arch }} | |
| variant: ccache | |
| evict-old-files: 1d | |
| - name: Install Ninja | |
| run: | | |
| choco install ninja | |
| - name: Build | |
| shell: cmd | |
| run: | | |
| call "C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.arch == 'x64' && 'x64' || 'amd64_arm64' }} | |
| cmake -S . -B build -G "Ninja Multi-Config" ^ | |
| -D CMAKE_TOOLCHAIN_FILE=cmake/${{ matrix.arch }}-windows-llvm.cmake ^ | |
| -DLLAMA_BUILD_BORINGSSL=ON ^ | |
| -DGGML_NATIVE=OFF ^ | |
| -DGGML_BACKEND_DL=ON ^ | |
| -DGGML_CPU_ALL_VARIANTS=${{ matrix.arch == 'x64' && 'ON' || 'OFF' }} ^ | |
| -DGGML_OPENMP=ON ^ | |
| ${{ env.CMAKE_ARGS }} | |
| cmake --build build --config Release | |
| - name: Pack artifacts | |
| id: pack_artifacts | |
| run: | | |
| Copy-Item "C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Redist\MSVC\14.51.36231\debug_nonredist\${{ matrix.arch }}\Microsoft.VC145.OpenMP.LLVM\libomp140.${{ matrix.arch == 'x64' && 'x86_64' || 'aarch64' }}.dll" .\build\bin\Release\ | |
| 7z a -snl llama-bin-win-cpu-${{ matrix.arch }}.zip .\build\bin\Release\* | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| path: llama-bin-win-cpu-${{ matrix.arch }}.zip | |
| name: llama-bin-win-cpu-${{ matrix.arch }}.zip | |
| windows-cuda: | |
| runs-on: windows-2022 | |
| strategy: | |
| matrix: | |
| cuda: ['13.3'] | |
| steps: | |
| - name: Clone | |
| id: checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "24" | |
| cache: "npm" | |
| cache-dependency-path: "tools/ui/package-lock.json" | |
| - name: Install ccache | |
| uses: ggml-org/ccache-action@v1.2.21 | |
| with: | |
| key: windows-cuda-${{ matrix.cuda }} | |
| variant: ccache | |
| evict-old-files: 1d | |
| - name: Install Cuda Toolkit | |
| uses: ./.github/actions/windows-setup-cuda | |
| with: | |
| cuda_version: ${{ matrix.cuda }} | |
| - name: Install Ninja | |
| id: install_ninja | |
| run: | | |
| choco install ninja | |
| - name: Build | |
| id: cmake_build | |
| shell: cmd | |
| # TODO: Remove GGML_CUDA_CUB_3DOT2 flag once CCCL 3.2 is bundled within CTK and that CTK version is used in this project | |
| run: | | |
| call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 | |
| cmake -S . -B build -G "Ninja Multi-Config" ^ | |
| -DGGML_BACKEND_DL=ON ^ | |
| -DGGML_NATIVE=OFF ^ | |
| -DGGML_CPU=OFF ^ | |
| -DGGML_CUDA=ON ^ | |
| -DLLAMA_BUILD_BORINGSSL=ON ^ | |
| -DGGML_CUDA_CUB_3DOT2=ON | |
| set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-1 | |
| cmake --build build --config Release -j %NINJA_JOBS% --target ggml-cuda | |
| - name: Pack artifacts | |
| id: pack_artifacts | |
| run: | | |
| 7z a -snl llama-bin-win-cuda-${{ matrix.cuda }}-x64.zip .\build\bin\Release\ggml-cuda.dll | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| path: llama-bin-win-cuda-${{ matrix.cuda }}-x64.zip | |
| name: llama-bin-win-cuda-${{ matrix.cuda }}-x64.zip | |
| - name: Copy and pack Cuda runtime | |
| run: | | |
| echo "Cuda install location: ${{ env.CUDA_PATH }}" | |
| $dst='.\build\bin\cudart\' | |
| robocopy "${{env.CUDA_PATH}}\bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll | |
| robocopy "${{env.CUDA_PATH}}\lib" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll | |
| robocopy "${{env.CUDA_PATH}}\bin\x64" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll | |
| 7z a cudart-llama-bin-win-cuda-${{ matrix.cuda }}-x64.zip $dst\* | |
| - name: Upload Cuda runtime | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| path: cudart-llama-bin-win-cuda-${{ matrix.cuda }}-x64.zip | |
| name: cudart-llama-bin-win-cuda-${{ matrix.cuda }}-x64.zip | |
| release: | |
| if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} | |
| # Fine-grant permission | |
| # https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token | |
| permissions: | |
| contents: write # for creating release | |
| runs-on: ubuntu-slim | |
| needs: | |
| - windows-cpu | |
| - windows-cuda | |
| outputs: | |
| tag_name: ${{ steps.tag.outputs.name }} | |
| steps: | |
| - name: Clone | |
| id: checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Determine tag name | |
| id: tag | |
| uses: ./.github/actions/get-tag-name | |
| - name: Download artifacts | |
| id: download-artifact | |
| uses: actions/download-artifact@v7 | |
| with: | |
| path: ./artifact | |
| merge-multiple: true | |
| - name: Move artifacts | |
| id: move_artifacts | |
| run: | | |
| mkdir -p release | |
| echo "Adding CPU backend files to existing zips..." | |
| for arch in x64 arm64; do | |
| cpu_zip="artifact/llama-bin-win-cpu-${arch}.zip" | |
| temp_dir=$(mktemp -d) | |
| echo "Extracting CPU backend for $arch..." | |
| unzip "$cpu_zip" -d "$temp_dir" | |
| echo "Adding CPU files to $arch zips..." | |
| for target_zip in artifact/llama-bin-win-*-${arch}.zip; do | |
| if [[ "$target_zip" == "$cpu_zip" ]]; then | |
| continue | |
| fi | |
| echo "Adding CPU backend to $(basename "$target_zip")" | |
| realpath_target_zip=$(realpath "$target_zip") | |
| (cd "$temp_dir" && zip -r "$realpath_target_zip" .) | |
| done | |
| rm -rf "$temp_dir" | |
| done | |
| echo "Renaming and moving zips to release..." | |
| for zip_file in artifact/llama-bin-win-*.zip; do | |
| base_name=$(basename "$zip_file" .zip) | |
| zip_name="llama-${{ steps.tag.outputs.name }}-${base_name#llama-}.zip" | |
| echo "Moving $zip_file to release/$zip_name" | |
| mv "$zip_file" "release/$zip_name" | |
| done | |
| echo "Moving other artifacts..." | |
| mv -v artifact/*.zip release | |
| - name: Create release | |
| id: create_release | |
| uses: ggml-org/action-create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.tag.outputs.name }} | |
| body: | | |
| <details open> | |
| ${{ github.event.head_commit.message }} | |
| </details> | |
| **Windows:** | |
| - [Windows x64 (CPU)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-win-cpu-x64.zip) | |
| - [Windows arm64 (CPU)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-win-cpu-arm64.zip) | |
| - [Windows x64 (CUDA 13)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-win-cuda-13.1-x64.zip) - [CUDA 13.1 DLLs](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/cudart-llama-bin-win-cuda-13.1-x64.zip) | |
| - name: Upload release | |
| id: upload_release | |
| uses: actions/github-script@v8 | |
| with: | |
| github-token: ${{secrets.GITHUB_TOKEN}} | |
| script: | | |
| const path = require('path'); | |
| const fs = require('fs'); | |
| const release_id = '${{ steps.create_release.outputs.id }}'; | |
| for (let file of await fs.readdirSync('./release')) { | |
| if (path.extname(file) === '.zip' || file.endsWith('.tar.gz')) { | |
| console.log('uploadReleaseAsset', file); | |
| await github.rest.repos.uploadReleaseAsset({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| release_id: release_id, | |
| name: file, | |
| data: await fs.readFileSync(`./release/${file}`) | |
| }); | |
| } | |
| } |