Settings screen #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
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 | |
- name: Verify Code Signing | |
if: startsWith(matrix.os, 'macos') | |
run: | | |
codesign -vv --deep 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 |