Skip to content

Settings screen

Settings screen #2

Workflow file for this run

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.0
steps:
- uses: actions/checkout@v4
- name: Set up Python Non-Mac
if: startsWith(matrix.os, 'windows') || matrix.os == 'ubuntu-latest'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Set up Python Mac arm64
if: matrix.target == 'macos-arm64'
uses: actions/setup-python@v5
with:
python-version: '3.11'
architecture: 'arm64'
- name: Set up Python Mac x86
if: matrix.target == 'macos-x86'
uses: actions/setup-python@v5
with:
python-version: '3.11'
architecture: 'x64'
- 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 }}-cp311-cp311-cpu-x86_64-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 llama-cpp-python
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
- name: Install MacOS arm64 simpler-whisper
if: matrix.target == 'macos-arm64'
run: |
curl -L https://github.com/locaal-ai/simpler-whisper/releases/download/${{ env.simpler-whisper-version }}/simpler_whisper-${{ env.simpler-whisper-version }}-cp311-cp311-cpu-arm64-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 MacOS x86_64 simpler-whisper
if: matrix.target == 'macos-x86'
run: |
curl -L https://github.com/locaal-ai/simpler-whisper/releases/download/${{ env.simpler-whisper-version }}/simpler_whisper-${{ env.simpler-whisper-version }}-cp311-cp311-cpu-x86_64-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 }}-cp311-cp311-cpu-win64-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 }}-cp311-cp311-cuda-win64-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: |
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 CPU)
if: matrix.target == 'windows-cpu'
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 (Windows CUDA)
if: matrix.target == 'windows-cuda'
run: |
if ("${{ github.event_name }}" -eq "pull_request") {
pyinstaller --clean --noconfirm note-taker.spec -- --win --cuda --debug
} else {
pyinstaller --clean --noconfirm note-taker.spec -- --win --cuda
}
- 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') && github.event_name != 'pull_request'
run: |
ditto -c -k --keepParent dist/note-taker note-taker.zip
- name: Notarize and Staple
if: startsWith(matrix.os, 'macos') && github.event_name != 'pull_request'
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
chmod 755 dist/note-taker
xcrun stapler staple dist/note-taker
- name: Verify Notarization
if: startsWith(matrix.os, 'macos') && github.event_name != 'pull_request'
run: |
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