Update GitHub Actions workflow to fetch all tags for accurate versioning #99
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: 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'] | |
acceleration: ['cpu'] # , 'cuda' | |
exclude: | |
- os: macos-latest | |
acceleration: cuda | |
- 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: '3.12' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install numpy cmake wheel setuptools build cibuildwheel | |
- name: Get latest tag | |
id: get_tag | |
run: | | |
git fetch --tags | |
echo "tag=$(git describe --tags --abbrev=1 --all)" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Build wheel | |
env: | |
CIBW_ENVIRONMENT: "SIMPLER_WHISPER_ACCELERATION='${{ matrix.acceleration }}' MAOSX_DEPLOYMENT_TARGET=10.13" | |
CIBW_BUILD: "cp310-* cp311-* cp312-*" | |
CIBW_ARCHS_MACOS: "universal2" | |
CIBW_ARCHS_WINDOWS: "AMD64" | |
CIBW_ARCHS_LINUX: "x86_64" | |
CIBW_SKIP: "*-musllinux_*" | |
CIBW_BUILD_VERBOSITY: 1 | |
SIMPLER_WHISPER_VERSION: ${{ steps.get_tag.outputs.tag }} | |
run: | | |
python -m cibuildwheel --output-dir wheelhouse | |
- 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: wheels-${{ matrix.os }}-${{ matrix.acceleration }} | |
path: | | |
wheelhouse/*.whl |