Skip to content

Commit

Permalink
ci: change to powershell script instead bash
Browse files Browse the repository at this point in the history
  • Loading branch information
hans00 committed May 5, 2024
1 parent 74f2877 commit 1be2356
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 82 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,24 @@ jobs:
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
- name: externals cache
uses: actions/[email protected]
if: runner.os != 'Windows'
with:
path: externals
key: ${{ runner.os }}-externals-${{ hashFiles('scripts/prepare-*.sh') }}
- name: externals cache (Windows)
uses: actions/[email protected]
if: runner.os == 'Windows'
with:
path: externals
key: ${{ runner.os }}-externals-${{ hashFiles('scripts/prepare-*.ps1') }}
- name: Install dependencies
run: yarn install
- name: Prepare (Windows)
if: runner.os == 'Windows'
shell: bash
run: bash ./scripts/prepare-windows.sh
run: powershell ./scripts/prepare-windows.ps1
- name: Build (Windows)
if: runner.os == 'Windows'
shell: bash
run: bash ./scripts/build-windows.sh
run: powershell ./scripts/build-windows.ps1
- name: Prepare (Linux)
if: runner.os == 'Linux'
run: bash ./scripts/prepare-linux.sh
Expand Down
13 changes: 13 additions & 0 deletions scripts/build-windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$ErrorActionPreference='Stop'

# General

yarn clean ; yarn build-native -a x86_64
yarn clean ; yarn build-native -a arm64

# build with CLBlast
$X64_CLBlast=Resolve-Path 'externals/win32-x64/SDK/lib/cmake/CLBlast'
$ARM64_CLBlast=Resolve-Path 'externals/win32-arm64/SDK/lib/cmake/CLBlast'

yarn clean ; yarn build-native -a x86_64 --CDVARIANT=opencl --CDLLAMA_CLBLAST=ON --CDCMAKE_PREFIX_PATH=$X64_CLBlast
yarn clean ; yarn build-native -a arm64 --CDVARIANT=opencl --CDLLAMA_CLBLAST=ON --CDCMAKE_PREFIX_PATH=$ARM64_CLBlast
17 changes: 0 additions & 17 deletions scripts/build-windows.sh

This file was deleted.

59 changes: 59 additions & 0 deletions scripts/prepare-windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
$ErrorActionPreference='Stop'

New-Item -ItemType Directory -Force -Path "externals/win32-x64/SDK" | Out-Null
New-Item -ItemType Directory -Force -Path "externals/win32-arm64" | Out-Null

# x64

cd "externals/win32-x64"

# OpenCL-SDK
if (-not (Test-Path "OpenCL-SDK.zip")) {
Invoke-WebRequest -Uri "https://github.com/KhronosGroup/OpenCL-SDK/releases/download/v2023.12.14/OpenCL-SDK-v2023.12.14-Win-x64.zip" -OutFile "OpenCL-SDK.zip"
7z x OpenCL-SDK.zip
Copy-Item -Recurse -Force OpenCL-SDK-*/* SDK
Remove-Item -Recurse -Force OpenCL-SDK-*
}

# CLBlast
if (-not (Test-Path "CLBlast.zip")) {
Invoke-WebRequest -Uri "https://github.com/CNugteren/CLBlast/releases/download/1.6.2/CLBlast-1.6.2-windows-x64.zip" -OutFile "CLBlast.zip"
7z x CLBlast.zip
7z x CLBlast*.7z
Copy-Item -Recurse -Force CLBlast-*/* SDK
Remove-Item -Recurse -Force CLBlast-*
}

cd ".."

# ARM64

cd "win32-arm64"

if (-not (Test-Path "OpenCL-SDK-source")) {
git clone "https://github.com/KhronosGroup/OpenCL-SDK.git" "OpenCL-SDK-source" --recursive
cd "OpenCL-SDK-source"
git checkout v2023.12.14
cd ".."
}

if (-not (Test-Path "CLBlast-source")) {
git clone "https://github.com/CNugteren/CLBlast.git" "CLBlast-source" --recursive
cd "CLBlast-source"
git checkout 1.6.2
cd ".."
}

if (-not (Test-Path "SDK")) {
New-Item -ItemType Directory -Force -Path "SDK" | Out-Null
$SDK_ROOT = (Resolve-Path "SDK").Path
# build from source
cd "OpenCL-SDK-source"
cmake -B build -DBUILD_DOCS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DOPENCL_SDK_BUILD_SAMPLES=OFF -DOPENCL_SDK_TEST_SAMPLES=OFF -G "Visual Studio 17 2022" -A arm64
cmake --build build --config Release
cmake --install build --prefix $SDK_ROOT
cd "../CLBlast-source"
cmake -B build -DBUILD_SHARED_LIBS=ON -DOVERRIDE_MSVC_FLAGS_TO_MT=OFF -DTUNERS=OFF -DOPENCL_ROOT="$SDK_ROOT" -G "Visual Studio 17 2022" -A arm64
cmake --build build --config Release
cmake --install build --prefix $SDK_ROOT
}
61 changes: 0 additions & 61 deletions scripts/prepare-windows.sh

This file was deleted.

0 comments on commit 1be2356

Please sign in to comment.