wheels #49
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: | |
push: | |
branches: | |
- develop | |
pull_request: | |
branches: | |
- develop | |
schedule: | |
- cron: '00 12 1 * *' # First day of each month 12 PM UTC | |
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 | |
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 | |
bazel-build-and-test-wheels: | |
name: Build wheels for python${{ matrix.python-version }} (${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 120 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ['ubuntu-latest', 'macos-latest'] | |
python-version: ['3.10', '3.11.8'] | |
exclude: | |
- os: 'macos-latest' | |
python-version: '3.10' | |
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 |