Skip to content

chore(deps): bump github/codeql-action from 2 to 3 #312

chore(deps): bump github/codeql-action from 2 to 3

chore(deps): bump github/codeql-action from 2 to 3 #312

Workflow file for this run

name: wheels
on:
workflow_dispatch:
push:
tags:
- 'v*'
pull_request:
branches:
- main
concurrency:
group: wheels-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
LINES: 200
COLUMNS: 200
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrun
defaults:
run:
shell: bash --noprofile --norc -exo pipefail {0}
jobs:
build-sdist:
name: Build source distribution
runs-on: ubuntu-latest
timeout-minutes: 120
if: github.repository_owner == 'aarnphm' # Don't run on fork repository
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all tags and branches
submodules: true
- name: Setup CI
uses: ./.github/actions/setup-repo
with:
python-version: '3.8'
- name: Build source distributions
run: |
# TODO: when bazel support releasing sdist, we can remove this.
pipx run build --sdist
- name: Test built sdist
run: |
python -m venv venv
source venv/bin/activate
pip install dist/*.tar.gz && python -c "import whispercpp as w;print(dir(w.api)); print(dir(w.audio));"
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
build-arm-musl-wheels:
name: Build wheels for ${{ matrix.python[1] }}-${{ startsWith(matrix.platform[0], 'macosx') && 'macosx' || matrix.platform[0] }}
runs-on: ${{ matrix.platform[1] }}
if: ${{ failure() }} # Don't run on fork repository
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
python:
- ['cp38', '3.8']
- ['cp39', '3.9']
- ['cp310', '3.10']
- ['cp311', '3.11']
platform:
- [manylinux_aarch64, ubuntu-latest]
- [musllinux_x86_64, ubuntu-latest]
- ['macosx_*', macos-latest]
exclude:
# TODO: disable manylinux_aarch64 for now
- platform: [manylinux_aarch64, ubuntu-latest]
- platform: [musllinux_x86_64, ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all tags and branches
- name: Setup CI
uses: ./.github/actions/setup-repo
with:
python-version: ${{ matrix.python[1] }}
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.platform[0] }}
CIBW_ARCHS_MACOS: x86_64 arm64
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.python[0] }}-${{ startsWith(matrix.platform[0], 'macosx') && 'macosx' || matrix.platform[0] }}
path: ./wheelhouse/*.whl
release-wheels-sdist:
needs: [build-sdist]
runs-on: ubuntu-latest
if: github.repository_owner == 'aarnphm'
steps:
- uses: actions/download-artifact@v3
- name: Sanity check and setup dist folder
run: |
ls -R
mkdir -p dist
cp -r artifact/* dist/
# MacOS wheels
cp -r cp310-macosx/*.whl dist/
cp -r cp311-macosx/*.whl dist/
cp -r cp38-macosx/*.whl dist/
cp -r cp39-macosx/*.whl dist/
- uses: pypa/[email protected]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
bazel-build-and-release-wheels:
name: Build wheels for python${{ matrix.python-version }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 120
if: github.repository_owner == 'aarnphm' # Don't run on fork repository
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python-version: ['3.8', '3.9', '3.10', '3.11']
exclude:
- os: 'windows-latest'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all tags and branches
- name: Setup CI
uses: ./.github/actions/setup-repo
with:
python-version: ${{ matrix.python-version }}
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Building wheels
run: bazel build whispercpp_wheel
- name: Test built wheel
run: |
python -m venv venv
source venv/bin/activate
pip install $(bazel info bazel-bin)/*.whl && python -c "import whispercpp as w;print(dir(w.api)); print(dir(w.audio));"
- name: Retrieving versions
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
id: get-info
run: |
VERSION=${{ github.ref_name }}
echo "version=${VERSION:1}" >>$GITHUB_OUTPUT
- name: Publish built wheels with bazel
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
bazel run --define=ci=true --stamp --embed_label=${{ steps.get-info.outputs.version }} -- //:whispercpp_wheel.publish --repository pypi --verbose