forked from aarnphm/whispercpp
-
Notifications
You must be signed in to change notification settings - Fork 9
128 lines (128 loc) · 4.14 KB
/
wheels.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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
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
bazel-build-and-release-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', '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