-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (115 loc) · 4.07 KB
/
build.yaml
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
129
130
131
132
133
134
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']
python-version: ['3.11', '3.12']
platform: ['x86_64', 'arm64', 'win64']
acceleration: ['cpu', 'cuda', 'hipblas', 'vulkan']
exclude:
- os: windows-latest
platform: arm64
- os: windows-latest
platform: x86_64
- os: macos-latest
acceleration: cuda
- os: macos-latest
acceleration: hipblas
- os: macos-latest
acceleration: vulkan
- os: macos-latest
platform: win64
- os: ubuntu-latest
platform: win64
- os: ubuntu-latest
platform: arm64
- os: ubuntu-latest
acceleration: cuda
- os: ubuntu-latest
acceleration: hipblas
- os: ubuntu-latest
acceleration: vulkan
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python Non-Mac
if: ${{ matrix.os != 'macos-latest' }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up Python Mac arm64
if: ${{ matrix.os == 'macos-latest' && matrix.platform == 'arm64' }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: 'arm64'
- name: Set up Python Mac x86_64
if: ${{ matrix.os == 'macos-latest' && matrix.platform == 'x86_64' }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install numpy cmake wheel setuptools build
- name: Build wheel
env:
SIMPLER_WHISPER_ACCELERATION: ${{ matrix.acceleration }}
SIMPLER_WHISPER_PLATFORM: ${{ matrix.platform }}
run: |
python setup.py build_ext --inplace
python -m build --wheel
- name: Install built wheel Non-Windows
if: startsWith(matrix.os, 'windows') == false
run: |
pip install dist/*.whl
- name: Install built wheel Windows
if: startsWith(matrix.os, 'windows') == true
shell: pwsh
run: |
$wheelFile = Get-ChildItem dist/*.whl | Select-Object -First 1
if (-not $wheelFile) {
Write-Error "No wheel file found in dist directory"
exit 1
}
Write-Output "Installing wheel file: $($wheelFile.FullName)"
pip install $wheelFile.FullName
- name: Test import
run: |
python -c "import simpler_whisper; print(simpler_whisper.__file__)"
- name: Rename wheel file
shell: python
run: |
import os
import glob
wheel_file = glob.glob('dist/*.whl')[0]
base_name = os.path.basename(wheel_file)
name_parts = base_name.split('-')
# Insert acceleration and platform before the last part (which is like 'any.whl')
new_name_parts = name_parts[:-1] + ['${{ matrix.acceleration }}', '${{ matrix.platform }}'] + [name_parts[-1]]
new_name = '-'.join(new_name_parts)
new_path = os.path.join('dist', new_name)
os.rename(wheel_file, new_path)
print(f"Renamed {base_name} to {new_name}")
- name: Set wheel name
shell: pwsh
run: |
$wheelName = "wheel-${{ matrix.os }}-${{ matrix.platform }}-py${{ matrix.python-version }}"
if ("${{ matrix.acceleration }}" -ne "") {
$wheelName += "-${{ matrix.acceleration }}"
}
echo "WHEEL_NAME=$wheelName" >> $env:GITHUB_ENV
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: ${{ env.WHEEL_NAME }}
path: dist/*.whl