-
Notifications
You must be signed in to change notification settings - Fork 117
270 lines (232 loc) · 9.72 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
name: Wheels
on:
push:
branches:
- master
- stable
- docs
- actions*
tags:
- v*
workflow_dispatch:
jobs:
sdist:
name: Source distribution
runs-on: ubuntu-latest
if: startsWith(github.ref_name, 'docs') != true
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Setup CMake
uses: jwlawson/[email protected]
- name: Install requirements
run: |
pip install --user check-manifest twine
- name: Run check-manifest
run: |
python -m check_manifest
- name: Build sdist
run: |
python -m build --sdist --outdir wheelhouse
- name: Install from sdist
run: |
pip install --user wheelhouse/*.tar.gz
- name: Check sdist
run: |
python -m twine check wheelhouse/*
- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: wheels
path: wheelhouse/*.tar.gz
wheels:
strategy:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-latest
cibw-arch: manylinux_x86_64
manylinux: manylinux2010
cibw-skip: pp39-manylinux_* pp310-manylinux_* cp311-* cp312-*
- runs-on: ubuntu-latest
cibw-arch: manylinux_i686
manylinux: manylinux2010
cibw-skip: pp39-manylinux_* pp310-manylinux_* cp311-* cp312-*
- runs-on: ubuntu-latest
cibw-arch: manylinux_x86_64
manylinux: manylinux2014
cibw-skip: cp36-* cp37-* cp38-* cp39-* cp310-* pp37-* pp38-*
- runs-on: ubuntu-latest
cibw-arch: manylinux_i686
manylinux: manylinux2014
cibw-skip: cp36-* cp37-* cp38-* cp39-* cp310-* pp37-* pp38-*
- runs-on: macos-latest
cibw-arch: macosx_x86_64
- runs-on: macos-latest
cibw-arch: macosx_arm64
- runs-on: macos-latest
cibw-arch: macosx_universal2
- runs-on: windows-2019
cibw-arch: win_amd64
- runs-on: windows-2019
cibw-arch: win32
python-arch: x86
name: Wheels • ${{ matrix.cibw-arch }}
runs-on: ${{ matrix.runs-on }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
architecture: ${{ matrix.python-arch }}
- name: Setup CMake
uses: jwlawson/[email protected]
- name: Install requirements
run: |
python -m pip install cibuildwheel twine
- name: Configure cibuildwheel
shell: bash
run: |
CMAKE_ARCH="${{ matrix.cibw-arch == 'win32' && '-A Win32' || '' }}"
CMAKE_OSX_ARCHITECTURES=${{ matrix.cibw-arch == 'macosx_x86_64' && 'x86_64' || matrix.cibw-arch == 'macosx_arm64' && 'arm64' || matrix.cibw-arch == 'macosx_universal2' && '"arm64;x86_64"' || '' }}
echo "CIBW_ARCHS_MACOS=x86_64 arm64 universal2" >> $GITHUB_ENV
echo "CIBW_BUILD=*-${{ matrix.cibw-arch }}" >> $GITHUB_ENV
echo "CIBW_SKIP=${{ matrix.cibw-skip }}" >> $GITHUB_ENV
echo "CIBW_MANYLINUX_X86_64_IMAGE=${{ matrix.manylinux }}" >> $GITHUB_ENV
echo "CIBW_MANYLINUX_I686_IMAGE=${{ matrix.manylinux }}" >> $GITHUB_ENV
CIBW_ENVIRONMENT_COMMON="PARSELMOUTH_EXTRA_CMAKE_ARGS=\"-DPREBUILT_DEPENDENCIES=\$(python -c 'import os; print(os.getcwd().replace(os.path.sep, '/'))')/build_dependencies\" CMAKE_BUILD_PARALLEL_LEVEL=2"
echo "CIBW_ENVIRONMENT=$CIBW_ENVIRONMENT_COMMON" >> $GITHUB_ENV
echo "CIBW_ENVIRONMENT_LINUX=$CIBW_ENVIRONMENT_COMMON PIP_ONLY_BINARY='numpy'" >> $GITHUB_ENV
echo "CIBW_ENVIRONMENT_MACOS=$CIBW_ENVIRONMENT_COMMON MACOSX_DEPLOYMENT_TARGET=10.9 CMAKE_OSX_ARCHITECTURES=\"$CMAKE_OSX_ARCHITECTURES\"" >> $GITHUB_ENV
CIBW_BEFORE_ALL_COMMON="cmake -S . -B build_dependencies $CMAKE_ARCH && cmake --build build_dependencies --target praat -j 2"
echo "CIBW_BEFORE_ALL=$CIBW_BEFORE_ALL_COMMON" >> $GITHUB_ENV
echo "CIBW_BEFORE_ALL_WINDOWS=$CIBW_BEFORE_ALL_COMMON --config Release" >> $GITHUB_ENV
echo "CIBW_BEFORE_BUILD=rm -rf _skbuild" >> $GITHUB_ENV
- name: Only build ReadTheDocs wheel
if: startsWith(github.ref_name, 'docs')
shell: bash
run: |
echo "CIBW_BUILD=cp39-manylinux_x86_64" >> $GITHUB_ENV
- name: Run cibuildwheel
if: startsWith(github.ref_name, 'docs') != true || matrix.cibw-arch == 'manylinux_x86_64'
run: |
cibuildwheel
- name: Check built wheels
if: startsWith(github.ref_name, 'docs') != true || matrix.cibw-arch == 'manylinux_x86_64'
run: |
twine check wheelhouse/*
- name: Upload built wheels
if: startsWith(github.ref_name, 'docs') != true
uses: actions/upload-artifact@v3
with:
name: wheels
path: wheelhouse/praat_parselmouth-*.whl
if-no-files-found: error
- name: Upload wheel for ReadTheDocs
if: matrix.cibw-arch == 'manylinux_x86_64' && matrix.manylinux == 'manylinux2010' && github.ref_type == 'branch' && !startsWith(github.ref_name, 'actions')
uses: actions/upload-artifact@v3
with:
name: rtd-wheel
path: wheelhouse/praat_parselmouth-*-cp39-cp39-*manylinux2010_x86_64*.whl
if-no-files-found: error
legacy-wheels:
strategy:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-latest
cibw-arch: manylinux_x86_64
- runs-on: ubuntu-latest
cibw-arch: manylinux_i686
- runs-on: macos-11
cibw-arch: macosx_x86_64
- runs-on: windows-2019
cibw-arch: win_amd64
- runs-on: windows-2019
cibw-arch: win32
python-arch: x86
name: Wheels (legacy) • ${{ matrix.cibw-arch }}
runs-on: ${{ matrix.runs-on }}
if: startsWith(github.ref_name, 'docs') != true
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
architecture: ${{ matrix.python-arch }}
- name: Setup CMake
uses: jwlawson/[email protected]
- name: Install requirements
run: |
python -m pip install "cibuildwheel<2" twine
- name: Configure cibuildwheel
shell: bash
run: |
CMAKE_ARCH="${{ matrix.cibw-arch == 'win32' && '-A Win32' || '' }}"
echo "DISTUTILS_USE_SDK=1" >> $GITHUB_ENV
echo "MSSdk=1" >> $GITHUB_ENV
echo "CIBW_BUILD=cp27-${{ matrix.cibw-arch }} cp35-${{ matrix.cibw-arch }} pp27-${{ matrix.cibw-arch }} pp36-${{ matrix.cibw-arch }} ${{ matrix.cibw-arch == 'win32' && 'pp37-win32' || '' }}" >> $GITHUB_ENV
echo "CIBW_MANYLINUX_X86_64_IMAGE=manylinux2010" >> $GITHUB_ENV
echo "CIBW_MANYLINUX_I686_IMAGE=manylinux2010" >> $GITHUB_ENV
CIBW_ENVIRONMENT_COMMON="PARSELMOUTH_EXTRA_CMAKE_ARGS=\"-DPREBUILT_DEPENDENCIES=\$(python -c 'import os; print(os.getcwd().replace(os.path.sep, '/'))')/build_dependencies\" CMAKE_BUILD_PARALLEL_LEVEL=2"
echo "CIBW_ENVIRONMENT=$CIBW_ENVIRONMENT_COMMON" >> $GITHUB_ENV
echo "CIBW_ENVIRONMENT_LINUX=$CIBW_ENVIRONMENT_COMMON PIP_ONLY_BINARY='numpy'" >> $GITHUB_ENV
echo "CIBW_ENVIRONMENT_MACOS=$CIBW_ENVIRONMENT_COMMON MACOSX_DEPLOYMENT_TARGET=10.9" >> $GITHUB_ENV
CIBW_BEFORE_ALL_COMMON="pip install cmake && cmake -S . -B build_dependencies $CMAKE_ARCH && cmake --build build_dependencies --target praat -j 2"
echo "CIBW_BEFORE_ALL=$CIBW_BEFORE_ALL_COMMON" >> $GITHUB_ENV
echo "CIBW_BEFORE_ALL_WINDOWS=$CIBW_BEFORE_ALL_COMMON --config Release" >> $GITHUB_ENV
echo "CIBW_BEFORE_BUILD=python -m pip install -U pip && rm -rf _skbuild" >> $GITHUB_ENV
- name: Run cibuildwheel
run: |
python -c "import toml; p = toml.load(open('pyproject.toml')); r = p['build-system']['requires']; r[r.index('wheel')] += '<0.40'; r[r.index('cmake>=3.18')] += ',<3.27.9'; toml.dump(p, open('pyproject.toml', 'w'))"
cibuildwheel
- name: Check built wheels
run: |
twine check wheelhouse/*
- name: Upload built wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: wheelhouse/praat_parselmouth-*.whl
if-no-files-found: error
trigger_rtd:
name: Trigger ReadTheDocs build
runs-on: ubuntu-latest
if: github.ref_type == 'branch' && !startsWith(github.ref_name, 'actions')
needs: [wheels]
steps:
- name: Trigger ReadTheDocs webhook
run: |
curl -X POST -d "branches=${{ github.ref_name }}" -d "token=${{ secrets.READTHEDOCS_WEBHOOK_TOKEN }}" https://readthedocs.org/api/v2/webhook/parselmouth/15985/
create_release:
name: Create release
runs-on: ubuntu-latest
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
needs: [sdist, wheels, legacy-wheels]
steps:
- name: Collect sdist and wheels
uses: actions/download-artifact@v3
with:
name: wheels
path: wheelhouse
- name: Upload sdist and wheels to release
uses: ncipollo/release-action@v1
with:
name: ${{ github.ref_name }}
draft: true
artifacts: wheelhouse/*
token: ${{ secrets.GITHUB_TOKEN }}