Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 0b08e1c

Browse files
committed
fix(ci-windows): Use 1 value in windows matrix, package nitro windows GPU dll
1 parent 3770272 commit 0b08e1c

File tree

1 file changed

+44
-141
lines changed

1 file changed

+44
-141
lines changed

.github/workflows/build.yml

Lines changed: 44 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,13 @@ jobs:
226226
# with:
227227
# repo_token: ${{ secrets.GITHUB_TOKEN }}
228228
# file: nitro.zip
229-
# asset_name: nitro-${{ steps.extract_commit_id.outputs.sha_short }}-mac-amd64.zip.zip
229+
# asset_name: nitro-${{ steps.extract_commit_id.outputs.sha_short }}-mac-amd64.zip
230230
# tag: ${{ steps.extract_branch.outputs.branch }}-${{ steps.extract_commit_id.outputs.sha_short }}
231231

232232
windows-amd64-build:
233233
runs-on: windows-latest
234+
permissions:
235+
contents: write
234236

235237
env:
236238
OPENBLAS_VERSION: 0.3.23
@@ -240,39 +242,17 @@ jobs:
240242
strategy:
241243
matrix:
242244
include:
243-
- build: 'avx512'
244-
defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_AVX512=ON -DBUILD_SHARED_LIBS=ON'
245245
- build: 'openblas'
246246
defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_BLAS=ON -DBUILD_SHARED_LIBS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS -DBLAS_INCLUDE_DIRS="$env:RUNNER_TEMP/openblas/include" -DBLAS_LIBRARIES="$env:RUNNER_TEMP/openblas/lib/openblas.lib"'
247247

248248
steps:
249249
- name: Clone
250+
250251
id: checkout
251252
uses: actions/checkout@v3
252253
with:
253254
submodules: recursive
254255

255-
- name: Download OpenCL SDK
256-
id: get_opencl
257-
if: ${{ matrix.build == 'clblast' }}
258-
run: |
259-
curl.exe -o $env:RUNNER_TEMP/opencl.zip -L "https://github.com/KhronosGroup/OpenCL-SDK/releases/download/v${env:OPENCL_VERSION}/OpenCL-SDK-v${env:OPENCL_VERSION}-Win-x64.zip"
260-
mkdir $env:RUNNER_TEMP/opencl
261-
tar.exe -xvf $env:RUNNER_TEMP/opencl.zip --strip-components=1 -C $env:RUNNER_TEMP/opencl
262-
263-
- name: Download CLBlast
264-
id: get_clblast
265-
if: ${{ matrix.build == 'clblast' }}
266-
run: |
267-
curl.exe -o $env:RUNNER_TEMP/clblast.7z -L "https://github.com/CNugteren/CLBlast/releases/download/${env:CLBLAST_VERSION}/CLBlast-${env:CLBLAST_VERSION}-windows-x64.7z"
268-
curl.exe -o $env:RUNNER_TEMP/CLBlast.LICENSE.txt -L "https://github.com/CNugteren/CLBlast/raw/${env:CLBLAST_VERSION}/LICENSE"
269-
7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/clblast.7z
270-
rename-item $env:RUNNER_TEMP/CLBlast-${env:CLBLAST_VERSION}-windows-x64 clblast
271-
foreach ($f in (gci -Recurse -Path "$env:RUNNER_TEMP/clblast" -Filter '*.cmake')) {
272-
$txt = Get-Content -Path $f -Raw
273-
$txt.Replace('C:/vcpkg/packages/opencl_x64-windows/', "$($env:RUNNER_TEMP.Replace('\','/'))/opencl/") | Set-Content -Path $f -Encoding UTF8
274-
}
275-
276256
- name: Download OpenBLAS
277257
id: get_openblas
278258
if: ${{ matrix.build == 'openblas' }}
@@ -296,51 +276,46 @@ jobs:
296276
cmake .. ${{ matrix.defines }}
297277
cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS}
298278
299-
- name: Add clblast.dll
300-
id: add_clblast_dll
301-
if: ${{ matrix.build == 'clblast' }}
302-
run: |
303-
cp $env:RUNNER_TEMP/clblast/lib/clblast.dll ./build/bin/Release
304-
cp $env:RUNNER_TEMP/CLBlast.LICENSE.txt ./build/bin/Release/CLBlast-${env:CLBLAST_VERSION}.txt
305-
306279
- name: Add libopenblas.dll
307280
id: add_libopenblas_dll
308281
if: ${{ matrix.build == 'openblas' }}
309282
run: |
310-
cp $env:RUNNER_TEMP/openblas/bin/libopenblas.dll ./build/bin/Release/openblas.dll
311-
cp $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt ./build/bin/Release/OpenBLAS-${env:OPENBLAS_VERSION}.txt
283+
cp $env:RUNNER_TEMP/openblas/bin/libopenblas.dll ./build/Release/openblas.dll
284+
cp $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt ./build/Release/OpenBLAS-${env:OPENBLAS_VERSION}.txt
312285
313-
- name: Determine tag name
314-
id: tag
286+
- name: Extract branch name
315287
shell: bash
316-
run: |
317-
BUILD_NUMBER="$(git rev-list --count HEAD)"
318-
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
319-
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
320-
echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
321-
else
322-
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
323-
echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
324-
fi
288+
id: extract_branch
289+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
290+
291+
- name: Extract commit short SHA
292+
id: extract_commit_id
293+
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
325294

326295
- name: Pack artifacts
327296
id: pack_artifacts
328297
# if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
329298
run: |
330-
Copy-Item LICENSE .\build\bin\Release\llama.cpp.txt
299+
$dst='.\build\Release'
331300
robocopy build_deps\_install\bin\zlib.dll $dst
332301
robocopy build\bin\Release\llama.dll $dst
333-
7z a nitro-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-x64.zip .\build\bin\Release\*
302+
mkdir -p .\build\Release\config
303+
robocopy config.json .\build\Release\config
304+
7z a nitro.zip .\build\Release\*
334305
335-
- name: Upload artifacts
306+
- name: Upload binaries to release
336307
# if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
337-
uses: actions/upload-artifact@v3
308+
uses: svenstaro/upload-release-action@v2
338309
with:
339-
path: |
340-
nitro-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-x64.zip
310+
repo_token: ${{ secrets.GITHUB_TOKEN }}
311+
file: nitro.zip
312+
asset_name: nitro-${{ steps.extract_commit_id.outputs.sha_short }}-win-amd64-${{ matrix.build }}.zip
313+
tag: ${{ steps.extract_branch.outputs.branch }}-${{ steps.extract_commit_id.outputs.sha_short }}
341314

342315
windows-amd64-cuda-build:
343316
runs-on: windows-nvidia
317+
permissions:
318+
contents: write
344319

345320
strategy:
346321
matrix:
@@ -371,105 +346,33 @@ jobs:
371346
cmake .. -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_CUBLAS=ON -DBUILD_SHARED_LIBS=ON
372347
cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS}
373348
374-
- name: Determine tag name
375-
id: tag
349+
- name: Extract branch name
376350
shell: bash
377-
run: |
378-
BUILD_NUMBER="$(git rev-list --count HEAD)"
379-
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
380-
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
381-
echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
382-
else
383-
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
384-
echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
385-
fi
351+
id: extract_branch
352+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
353+
354+
- name: Extract commit short SHA
355+
id: extract_commit_id
356+
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
357+
386358

387359
- name: Pack artifacts
388360
id: pack_artifacts
389361
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
390362
run: |
391-
7z a nitro-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip .\build\bin\Release\*
392-
393-
- name: Upload artifacts
394-
# if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
395-
uses: actions/upload-artifact@v3
396-
with:
397-
path: |
398-
nitro-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip
399-
400-
- name: Copy and pack Cuda runtime
401-
run: |
402-
echo "Cuda install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}"
403-
$dst='.\build\bin\cudart\'
404-
robocopy "${{steps.cuda-toolkit.outputs.CUDA_PATH}}\bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
363+
$dst='.\build\Release'
405364
robocopy build_deps\_install\bin\zlib.dll $dst
406365
robocopy build\bin\Release\llama.dll $dst
407-
7z a cudart-nitro-bin-win-cu${{ matrix.cuda }}-x64.zip $dst\*
366+
robocopy "${{steps.cuda-toolkit.outputs.CUDA_PATH}}\bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
367+
mkdir -p .\build\Release\config
368+
robocopy config.json .\build\Release\config
369+
7z a nitro.zip .\build\Release\*
408370
409-
- name: Upload Cuda runtime
371+
- name: Upload binaries to release
410372
# if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
411-
uses: actions/upload-artifact@v3
412-
with:
413-
path: |
414-
cudart-nitro-bin-win-cu${{ matrix.cuda }}-x64.zip
415-
416-
release:
417-
runs-on: ubuntu-latest
418-
419-
needs:
420-
- windows-amd64-build
421-
- windows-amd64-cuda-build
422-
423-
steps:
424-
- name: Clone
425-
id: checkout
426-
uses: actions/checkout@v3
427-
with:
428-
fetch-depth: 0
429-
430-
- name: Determine tag name
431-
id: tag
432-
shell: bash
433-
run: |
434-
BUILD_NUMBER="$(git rev-list --count HEAD)"
435-
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
436-
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
437-
echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
438-
else
439-
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
440-
echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
441-
fi
442-
443-
- name: Download artifacts
444-
id: download-artifact
445-
uses: actions/download-artifact@v3
446-
447-
- name: Create release
448-
id: create_release
449-
uses: anzz1/action-create-release@v1
450-
env:
451-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
452-
with:
453-
tag_name: ${{ steps.tag.outputs.name }}
454-
455-
- name: Upload release
456-
id: upload_release
457-
uses: actions/github-script@v3
373+
uses: svenstaro/upload-release-action@v2
458374
with:
459-
github-token: ${{secrets.GITHUB_TOKEN}}
460-
script: |
461-
const path = require('path');
462-
const fs = require('fs');
463-
const release_id = '${{ steps.create_release.outputs.id }}';
464-
for (let file of await fs.readdirSync('./artifact')) {
465-
if (path.extname(file) === '.zip') {
466-
console.log('uploadReleaseAsset', file);
467-
await github.repos.uploadReleaseAsset({
468-
owner: context.repo.owner,
469-
repo: context.repo.repo,
470-
release_id: release_id,
471-
name: file,
472-
data: await fs.readFileSync(`./artifact/${file}`)
473-
});
474-
}
475-
}
375+
repo_token: ${{ secrets.GITHUB_TOKEN }}
376+
file: nitro.zip
377+
asset_name: nitro-${{ steps.extract_commit_id.outputs.sha_short }}-win-amd64-${{ matrix.build }}-cu${{ matrix.cuda }}.zip
378+
tag: ${{ steps.extract_branch.outputs.branch }}-${{ steps.extract_commit_id.outputs.sha_short }}

0 commit comments

Comments
 (0)