Skip to content

Commit

Permalink
feat: CI/CD and windows with/ without GPU (#64)
Browse files Browse the repository at this point in the history
* feat(ci): init commit for windows with/ without GPU support

* fix(ci): Update windows-nvidia runners and git clone recursive

* fix(ci-windows): Update cmake for preparation

* fix(ci-windows): Update step name, remove cuda-toolkit installation, Add release job

* fix(ci-windows): Use 1 value in windows matrix, package nitro windows GPU dll

* fix(ci-windows): Update cmd as shell

* fix(ci-windows): Fix cmake build -j nproc

* fix(ci-windows): Update nproc

* Refactor CICD windows nitro

---------

Co-authored-by: Hien To <[email protected]>
  • Loading branch information
hiro-v and hiento09 authored Oct 13, 2023
1 parent 1a82c95 commit c45cbfd
Showing 1 changed file with 132 additions and 2 deletions.
134 changes: 132 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,139 @@ jobs:
asset_path: ./nitro.zip
asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-mac-amd64.zip
asset_content_type: application/zip

windows-amd64-build:
runs-on: windows-latest
needs: create-draft-release
if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped')
permissions:
contents: write

env:
OPENBLAS_VERSION: 0.3.23
OPENCL_VERSION: 2023.04.17
CLBLAST_VERSION: 1.6.0

strategy:
matrix:
include:
- build: 'normal'
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"'

steps:
- name: Clone

id: checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup VSWhere.exe
uses: warrenbuckley/Setup-VSWhere@v1
with:
version: latest
silent: true
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true


- name: actions-setup-cmake
uses: jwlawson/[email protected]

- name: Build
id: cmake_build
shell: cmd
run: |
cmake -S ./nitro_deps -B ./build_deps/nitro_deps
cmake --build ./build_deps/nitro_deps --config Release
mkdir build
cd build
cmake ..
cmake --build . --config Release -j 4
- name: Pack artifacts
id: pack_artifacts
run: |
$dst='.\build\Release'
robocopy build_deps\_install\bin\zlib.dll $dst
robocopy build\bin\Release\llama.dll $dst
mkdir -p .\build\Release\config
robocopy config.json .\build\Release\config
7z a nitro.zip .\build\Release\*
- uses: actions/[email protected]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
asset_path: ./nitro.zip
asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-win-amd64-${{ matrix.build }}.zip
asset_content_type: application/zip

windows-amd64-cuda-build:
runs-on: windows-nvidia
needs: create-draft-release
if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped')
permissions:
contents: write

strategy:
matrix:
cuda: ['12.2.0']
build: ['cublas']

steps:
- name: Clone
id: checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup VSWhere.exe
uses: warrenbuckley/Setup-VSWhere@v1
with:
version: latest
silent: true
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true

- name: Build
id: cmake_build
shell: cmd
run: |
cmake -S ./nitro_deps -B ./build_deps/nitro_deps
cmake --build ./build_deps/nitro_deps --config Release
mkdir build
cd build
cmake .. -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_CUBLAS=ON -DBUILD_SHARED_LIBS=ON
cmake --build . --config Release -j 4
- name: Pack artifacts
id: pack_artifacts
shell: cmd
run: |
set PATH=%PATH%;C:\Program Files\7-Zip\
echo %PATH%
$dst='.\build\Release'
robocopy build_deps\_install\bin\zlib.dll $dst
robocopy build\bin\Release\llama.dll $dst
mkdir -p .\build\Release\config
robocopy config.json .\build\Release\config
7z a nitro.zip .\build\Release\*
- uses: actions/[email protected]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
asset_path: ./nitro.zip
asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-win-amd64-${{ matrix.build }}-cu${{ matrix.cuda }}.zip
asset_content_type: application/zip

update_release_draft:
needs: [ubuntu-amd64-build, ubuntu-amd64-cuda-build, macOS-M-build, macOS-Intel-build]
needs: [ubuntu-amd64-build, ubuntu-amd64-cuda-build, macOS-M-build, macOS-Intel-build, windows-amd64-build, windows-amd64-cuda-build]
permissions:
# write permission is required to create a github release
contents: write
Expand All @@ -247,4 +377,4 @@ jobs:
# config-name: my-config.yml
# disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit c45cbfd

Please sign in to comment.