Use git describe to get version and bump actions to newest versions too #108
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: Wheels | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- release | |
release: | |
types: | |
- published | |
jobs: | |
build_sdist: | |
name: Build SDist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Build SDist | |
run: pipx run build --sdist | |
- name: Check metadata | |
run: pipx run twine check dist/* | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: dist/*.tar.gz | |
build_wheels: | |
name: Wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- run: git describe --tags > version.txt | |
# Used to host cibuildwheel | |
- uses: actions/setup-python@v5 | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel==2.21.3 | |
- name: Build wheels | |
run: python -m cibuildwheel --output-dir wheelhouse | |
env: | |
CIBW_ARCHS: all | |
# for windows setup.py repairwheel step should solve it | |
- name: Verify clean directory | |
run: git diff --exit-code | |
shell: bash | |
- name: List files | |
run: ls wheelhouse | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
path: wheelhouse/*.whl | |
test_wheels: | |
name: Test wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
needs: build_wheels | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
path: wheelhouse | |
- name: Verify artifact download | |
run: | | |
ls -l wheelhouse | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
pip install pytest | |
- name: Install Wheel | |
run: | | |
pip install --no-index --find-links=./wheelhouse pywhispercpp | |
- name: Run tests | |
run: | | |
pytest tests/ | |
upload_all: | |
name: Upload if release | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
verbose: true | |
password: ${{ secrets.PYPI_API_TOKEN }} |