Skip to content

Enhance build workflow: Update Linux wheel build process to use Docke… #58

Enhance build workflow: Update Linux wheel build process to use Docke…

Enhance build workflow: Update Linux wheel build process to use Docke… #58

Workflow file for this run

name: Build and Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_call:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: ['windows-latest', 'macos-latest', 'ubuntu-latest']
python-version: ['3.11', '3.12']
platform: ['x86_64', 'win64']
acceleration: ['cpu', 'cuda']
exclude:
- os: windows-latest
platform: arm64
- os: windows-latest
platform: x86_64
- os: macos-latest
acceleration: cuda
- os: macos-latest
platform: win64
- os: ubuntu-latest
platform: win64
- os: ubuntu-latest
acceleration: cuda
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 non-Ubuntu
if: matrix.os != 'ubuntu-latest'
env:
SIMPLER_WHISPER_ACCELERATION: ${{ matrix.acceleration }}
SIMPLER_WHISPER_PLATFORM: ${{ matrix.platform }}
SIMPLER_WHISPER_PYTHON_VERSION: ${{ matrix.python-version }}
run: |
python setup.py build_ext --inplace
python -m build --wheel
- name: Build wheel for Linux
if: matrix.os == 'ubuntu-latest'
run: |
docker run --rm -v $(pwd):/io quay.io/pypa/manylinux2014_x86_64 bash -c "
cd /io &&
/opt/python/cp${{ matrix.python-version == '3.11' && '311' || '312' }}/bin/pip install numpy cmake wheel setuptools build &&
SIMPLER_WHISPER_ACCELERATION=${{ matrix.acceleration }} \
SIMPLER_WHISPER_PLATFORM=${{ matrix.platform }} \
SIMPLER_WHISPER_PYTHON_VERSION=${{ matrix.python-version }} \
/opt/python/cp${{ matrix.python-version == '3.11' && '311' || '312' }}/bin/python setup.py build_ext --inplace &&
/opt/python/cp${{ matrix.python-version == '3.11' && '311' || '312' }}/bin/python -m build --wheel &&
auditwheel repair dist/*.whl"
- name: Install built wheel Linux
if: matrix.os == 'ubuntu-latest'
run: |
pip install wheelhouse/*.whl
echo "WHEEL_FILE=$(basename $(ls wheelhouse/*.whl))" >> $GITHUB_ENV
- name: Install built wheel Mac
if: startsWith(matrix.os, 'macos') == true
run: |
pip install dist/*.whl
echo "WHEEL_FILE=$(basename $(ls dist/*.whl))" >> $GITHUB_ENV
- 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
echo "WHEEL_FILE=$($wheelFile.Name)" >> $env:GITHUB_ENV
- name: Test import
if: false
run: |
python -c "import sys; sys.path.pop(0); import simpler_whisper; print(simpler_whisper.__file__)"
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: ${{ env.WHEEL_FILE }}
path: |
dist/*.whl
wheelhouse/*.whl