-
Notifications
You must be signed in to change notification settings - Fork 3
255 lines (218 loc) · 10.7 KB
/
build.yaml
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
name: Cross-Platform Build with PyInstaller
on:
pull_request:
branches: [ main ]
workflow_call:
jobs:
check-format:
name: Check Formatting 🔍
uses: ./.github/workflows/check-format.yaml
permissions:
contents: read
build:
needs: check-format
strategy:
matrix:
include:
# - os: macos-14-large
# target: macos-x86
- os: macos-latest
target: macos-arm64
- os: ubuntu-latest
target: linux
- os: windows-latest
target: windows-cpu
- os: windows-latest
target: windows-cuda
runs-on: ${{ matrix.os }}
env:
simpler-whisper-version: 0.2.2
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install pyinstaller for Windows
if: startsWith(matrix.os, 'windows')
run: |
Invoke-WebRequest -Uri https://github.com/pyinstaller/pyinstaller/archive/refs/tags/v6.10.0.zip -OutFile pyinstaller-6.10.0.zip
Expand-Archive -Path pyinstaller-6.10.0.zip -DestinationPath .
cd pyinstaller-6.10.0
python -m pip install .
cd ..
Remove-Item -Recurse -Force pyinstaller-6.10.0
Remove-Item -Force pyinstaller-6.10.0.zip
- name: Install Linux simpler-whisper
if: matrix.target == 'linux'
run: |
curl -L https://github.com/locaal-ai/simpler-whisper/releases/download/${{ env.simpler-whisper-version }}/simpler_whisper-${{ env.simpler-whisper-version }}+cpu-cp311-cp311-linux_x86_64.whl -o simpler_whisper-${{ env.simpler-whisper-version }}-cp311-cp311-linux_x86_64.whl
python -m pip install simpler_whisper-${{ env.simpler-whisper-version }}-cp311-cp311-linux_x86_64.whl
- name: Install MacOS dependencies
if: startsWith(matrix.os, 'macos')
run: |
python -m pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/metal
curl -L https://github.com/locaal-ai/simpler-whisper/releases/download/${{ env.simpler-whisper-version }}/simpler_whisper-${{ env.simpler-whisper-version }}+cpu-cp311-cp311-macosx_14_0_universal2.whl -o simpler_whisper-${{ env.simpler-whisper-version }}-cp311-cp311-macosx_14_0_universal2.whl
python -m pip install simpler_whisper-${{ env.simpler-whisper-version }}-cp311-cp311-macosx_14_0_universal2.whl
- name: Install Windows CPU dependencies
if: matrix.target == 'windows-cpu'
run: |
Invoke-WebRequest -Uri https://github.com/abetlen/llama-cpp-python/releases/download/v0.3.1/llama_cpp_python-0.3.1-cp311-cp311-win_amd64.whl -OutFile llama_cpp_python-0.3.1-cp311-cp311-win_amd64.whl
python -m pip install llama_cpp_python-0.3.1-cp311-cp311-win_amd64.whl
Invoke-WebRequest -Uri https://github.com/locaal-ai/simpler-whisper/releases/download/${{ env.simpler-whisper-version }}/simpler_whisper-${{ env.simpler-whisper-version }}+cpu-cp311-cp311-win_amd64.whl -OutFile simpler_whisper-${{ env.simpler-whisper-version }}-cp311-cp311-win_amd64.whl
python -m pip install simpler_whisper-${{ env.simpler-whisper-version }}-cp311-cp311-win_amd64.whl
- name: Install Windows CUDA dependencies
if: matrix.target == 'windows-cuda'
run: |
python -m pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu125
Invoke-WebRequest -Uri https://github.com/locaal-ai/simpler-whisper/releases/download/${{ env.simpler-whisper-version }}/simpler_whisper-${{ env.simpler-whisper-version }}+cuda-cp311-cp311-win_amd64.whl -OutFile simpler_whisper-${{ env.simpler-whisper-version }}-cp311-cp311-win_amd64.whl
python -m pip install simpler_whisper-${{ env.simpler-whisper-version }}-cp311-cp311-win_amd64.whl
- name: Install dependencies
run: |
python -m pip install -r requirements.txt
- name: Download Whisper Model Windows
if: startsWith(matrix.target, 'windows')
run: |
if (-Not (Test-Path -Path data)) {
mkdir data
}
Invoke-WebRequest -Uri https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.en-q5_1.bin?download=true -OutFile data/ggml-small.en-q5_1.bin
- name: Download Whisper Model MacOS and Linux
if: startsWith(matrix.os, 'macos') || matrix.os == 'ubuntu-latest'
run: |
mkdir -p data
curl -L https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.en-q5_1.bin?download=true -o data/ggml-small.en-q5_1.bin
- name: Download MacOS CoreML Model
if: startsWith(matrix.os, 'macos')
run: |
mkdir -p data
curl -L https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.en-encoder.mlmodelc.zip?download=true -o data/ggml-small.en-encoder.mlmodelc.zip
unzip data/ggml-small.en-encoder.mlmodelc.zip -d data
rm data/ggml-small.en-encoder.mlmodelc.zip
- name: Import Apple Certificate
if: startsWith(matrix.os, 'macos')
run: |
if security list-keychains | grep -q "github_build.keychain"; then
security delete-keychain github_build.keychain
fi
security create-keychain -p "" github_build.keychain
security default-keychain -s github_build.keychain
security set-keychain-settings -lut 21600 github_build.keychain
echo "${{ secrets.APPLE_CERTIFICATE }}" | base64 --decode > apple_certificate.p12
security import apple_certificate.p12 -k github_build.keychain -P "${{ secrets.APPLE_CERTIFICATE_PASSWORD }}" \
-t cert -f pkcs12 -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/xcrun
security unlock-keychain -p "" github_build.keychain
security set-key-partition-list -S 'apple-tool:,apple:' -s -k "" github_build.keychain
security list-keychain -d user -s github_build.keychain 'login-keychain'
env:
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
- name: Unlock keychain on Mac
if: startsWith(matrix.os, 'macos')
run: |
security unlock-keychain -p "" github_build.keychain
security set-key-partition-list -S apple-tool:,apple: -k "" -D "Developer" -t private github_build.keychain
- name: List available signing identities
if: startsWith(matrix.os, 'macos')
run: |
security find-identity -v -p codesigning
- name: Write .env file for Windows CUDA
if: matrix.target == 'windows-cuda'
run: |
@"
WHISPER_EXEC_BACKEND=cuda
WHISPER_COMPUTE_TYPE=float32
LOCAL_RELEASE_TAG=$env:GITHUB_REF_NAME
LOCAL_RELEASE_DATE=$(Get-Date -Format 'yyyy-MM-ddTHH:mm:ssZ')
"@ | Out-File -FilePath .env -Encoding ASCII
shell: pwsh
- name: Write .env file for other platforms
if: matrix.target != 'windows-cuda'
run: |
echo "WHISPER_EXEC_BACKEND=auto" >> .env
echo "WHISPER_COMPUTE_TYPE=float16" >> .env
echo "LOCAL_RELEASE_TAG=${GITHUB_REF_NAME}" >> .env
echo "LOCAL_RELEASE_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> .env
- name: Build with PyInstaller (MacOS)
if: startsWith(matrix.target, 'macos-')
run: |
ARCH=$(echo ${{ matrix.target }} | sed 's/macos-//')
if [ "$ARCH" = "x86" ]; then
ARCH="x86_64"
fi
pyinstaller --clean --noconfirm note-taker.spec -- --mac_osx --arch $ARCH
env:
APPLE_APP_DEVELOPER_ID: ${{ secrets.APPLE_APP_DEVELOPER_ID }}
- name: Build with PyInstaller (Windows)
if: startsWith(matrix.target, 'windows-')
run: |
if ("${{ github.event_name }}" -eq "pull_request") {
pyinstaller --clean --noconfirm note-taker.spec -- --win --debug
} else {
pyinstaller --clean --noconfirm note-taker.spec -- --win
}
- name: Build with PyInstaller (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
pyinstaller --clean --noconfirm note-taker.spec
- name: Zip Application for Notarization
if: startsWith(matrix.os, 'macos')
run: |
ditto -c -k --keepParent dist/note-taker note-taker.zip
- name: Notarize and Staple
if: startsWith(matrix.os, 'macos')
run: |
xcrun notarytool submit note-taker.zip --apple-id \
"${{ secrets.APPLE_DEVELOPER_ID_USER }}" --password \
"${{ secrets.APPLE_DEVELOPER_ID_PASSWORD }}" --team-id \
"${{ secrets.APPLE_DEVELOPER_ID_TEAM }}" --wait --verbose
# Unzip the notarized app
rm -rf dist/note-taker
unzip note-taker.zip -d dist/
chmod 755 dist/note-taker
# Staple the notarization
xcrun stapler staple dist/note-taker
- name: Verify Notarization
if: startsWith(matrix.os, 'macos')
run: |
xcrun stapler validate dist/note-taker
spctl -a -v dist/note-taker
rm note-taker.zip
- name: Add version to .iss file
if: matrix.os == 'windows-latest'
run: |
$version = (Get-Content -Path note-taker.iss -Raw) -replace '@note-taker_VERSION@', $env:GITHUB_REF_NAME
$version | Out-File -FilePath note-taker.iss -Encoding ASCII
shell: pwsh
- name: Compile .ISS to .EXE Installer
if: matrix.os == 'windows-latest'
uses: Minionguyjpro/[email protected]
with:
path: note-taker.iss
options: /O+
- name: Create tar Linux
if: matrix.os == 'ubuntu-latest'
# strip the folder name from the tar
run: |
chmod a+x dist/note-taker
tar -cvf note-taker.tar -C dist note-taker
- name: Create dmg MacOS
if: startsWith(matrix.os, 'macos')
run: |
chmod a+x dist/note-taker
hdiutil create -volname "note-taker" -srcfolder dist/note-taker -ov -format UDRO note-taker-${{ matrix.target }}.dmg
- name: Create zip on Windows
if: matrix.os == 'windows-latest'
run: |
Compress-Archive -Path "dist/note-taker-setup.exe" -DestinationPath "./note-taker-${{ matrix.target }}.zip"
shell: pwsh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: note-taker-${{ matrix.target }}
path: |
note-taker-macos-arm64.dmg
note-taker-macos-x86.dmg
note-taker.tar
note-taker-windows-cpu.zip
note-taker-windows-cuda.zip