-
-
Notifications
You must be signed in to change notification settings - Fork 98
91 lines (77 loc) · 3.29 KB
/
windows-native-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Windows native build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: windows-2019
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: true
ref: ${{ github.head_ref }}
- name: Check for submodule update
id: check_submodule
run: |
Set-Location whisper.cpp
$SubmoduleCommitId = git rev-parse HEAD
Write-Host "Submodule commit ID: $SubmoduleCommitId"
Set-Location $Env:GITHUB_WORKSPACE
$StoredCommitId = Get-Content native-commit-id-windows
Write-Host "Stored commit ID: $StoredCommitId"
if ($SubmoduleCommitId -ne $StoredCommitId) {
Write-Host "Submodule has new commits. Triggering build."
Write-Output "trigger_build=true" | Out-File -Append $Env:GITHUB_OUTPUT
Set-Content -Path native-commit-id-windows -Value $SubmoduleCommitId
} else {
Write-Host "No new commits in submodule."
Write-Output "trigger_build=false" | Out-File -Append $Env:GITHUB_OUTPUT
}
shell: pwsh
- name: Add msbuild to PATH
if: steps.check_submodule.outputs.trigger_build == 'true'
uses: microsoft/setup-msbuild@v1
- name: Install OpenCl with vcpkg
if: steps.check_submodule.outputs.trigger_build == 'true'
run: |
vcpkg --triplet=x64-windows install opencl
- name: Add Clblast to path
if: steps.check_submodule.outputs.trigger_build == 'true'
run: |
New-Item -ItemType Directory -Force -Path build
Invoke-WebRequest -Uri "https://github.com/CNugteren/CLBlast/releases/download/1.6.1/CLBlast-1.6.1-windows-x64.zip" -OutFile "build\clblast.zip"
Expand-Archive -LiteralPath "build\clblast.zip" -DestinationPath "build/clblast" -Force
7z x "build/clblast/CLBlast-1.6.1-windows-x64.7z" -o"build/clblast" -y
Remove-Item "./build/clblast.zip"
Remove-Item "./build/clblast/CLBlast-1.6.1-windows-x64.7z"
$currentPath = (Get-Location).Path
$clblastPath = $currentPath + "\build\clblast\CLBlast-1.6.1-windows-x64"
$env:Path = $env:Path + ";" + $clblastPath
Write-Output "PATH=$env:Path" | Out-File -Append -FilePath $env:GITHUB_ENV
shell: pwsh
- name: Install CUDA Toolkit
if: steps.check_submodule.outputs.trigger_build == 'true'
uses: Jimver/[email protected]
with:
cuda: '12.1.0'
- name: Run Build
if: steps.check_submodule.outputs.trigger_build == 'true'
run: |
Import-Module ./windows-scripts.ps1
BuildWindowsAll
shell: pwsh
- name: Remove CUDA installer
if: steps.check_submodule.outputs.trigger_build == 'true'
run: Remove-Item -Path 'cuda_installer-*' -Recurse -Force -ErrorAction Ignore
- name: Pull latest commits
if: steps.check_submodule.outputs.trigger_build == 'true'
run: git pull origin ${{ github.head_ref }}
- name: Commit and Push
if: steps.check_submodule.outputs.trigger_build == 'true'
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Add native changes windows