Skip to content

Refactor build.yaml workflow: Add support for Python versions 3.9, 3.… #14

Refactor build.yaml workflow: Add support for Python versions 3.9, 3.…

Refactor build.yaml workflow: Add support for Python versions 3.9, 3.… #14

Workflow file for this run

name: Build and Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
# Windows builds
- os: windows-latest
platform: win64
acceleration: cpu
python-version: ['3.9', '3.10', '3.11', '3.12']
- os: windows-latest
platform: win64
acceleration: cuda
python-version: ['3.9', '3.10', '3.11', '3.12']
- os: windows-latest
platform: win64
acceleration: hipblas
python-version: ['3.9', '3.10', '3.11', '3.12']
- os: windows-latest
platform: win64
acceleration: vulkan
python-version: ['3.9', '3.10', '3.11', '3.12']
# macOS builds
- os: macos-latest
platform: x86_64
python-version: ['3.9', '3.10', '3.11', '3.12']
- os: macos-latest
platform: arm64
python-version: ['3.9', '3.10', '3.11', '3.12']
# Linux build
- os: ubuntu-latest
platform: x86_64
python-version: ['3.9', '3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install numpy cmake wheel setuptools build
- name: Build wheel
env:
SIMPLER_WHISPER_ACCELERATION: ${{ matrix.acceleration }}
SIMPLER_WHISPER_PLATFORM: ${{ matrix.platform }}
run: |
python -m build --wheel
- name: Install built wheel Non-Windows
if: startsWith(matrix.os, 'windows') == false
run: |
pip install dist/*.whl
- name: Install built wheel Windows
if: startsWith(matrix.os, 'windows') == true
shell: pwsh
run: |
$wheelFile = Get-ChildItem dist/*.whl | Select-Object -First 1
if (-not $wheelFile) {
Write-Error "No wheel file found in dist directory"
exit 1
}
Write-Output "Installing wheel file: $($wheelFile.FullName)"
pip install $wheelFile.FullName
- name: Test import
run: |
python -c "import simpler_whisper; print(simpler_whisper.__file__)"
- name: Set wheel name
shell: pwsh
run: |
$wheelName = "wheel-${{ matrix.os }}-${{ matrix.platform }}-py${{ matrix.python-version }}"
if ("${{ matrix.acceleration }}" -ne "") {
$wheelName += "-${{ matrix.acceleration }}"
}
echo "WHEEL_NAME=$wheelName" >> $env:GITHUB_ENV
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: ${{ env.WHEEL_NAME }}
path: dist/*.whl