-
Notifications
You must be signed in to change notification settings - Fork 260
314 lines (305 loc) Β· 13.2 KB
/
all.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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
name: Compile, Test, and Deploy
on:
pull_request: {}
push:
branches:
- master
release:
types: [published]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lint-python:
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
matrix:
python-version: ['3.11']
os: ['ubuntu-20.04']
name: Lint Python
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Install lint dependencies
env:
# on macOS and with Python 3.10: building NumPy from source fails without these options:
NPY_BLAS_ORDER: ""
NPY_LAPACK_ORDER: ""
run: |
python -m pip install --upgrade pip
pip install wheel
pip install -r test-requirements.txt
- name: Lint Python code
run: flake8 . --count --ignore=W503,E203 --exclude .git,dist,doc,build,vendors --show-source --statistics --max-line-length 100
- name: Check Python formatting
run: black pedalboard tests --line-length 100 --preview --diff --check
lint-cpp:
runs-on: 'ubuntu-20.04'
continue-on-error: true
name: Lint C++
steps:
- uses: actions/checkout@v2
# Don't check out submodules, as the action below will look at ALL C++ code!
- name: Check C++ Formatting
uses: jidicula/clang-format-action@v4.4.1
with:
clang-format-version: 14
fallback-style: LLVM
run-tests:
runs-on: ${{ matrix.os }}
continue-on-error: false
env:
MINIMUM_COVERAGE_PERCENTAGE: 80
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
# TODO: Switch back to macos-latest once https://github.com/actions/python-versions/pull/114 is fixed
os: ['ubuntu-20.04', windows-latest, macos-12]
name: Test with Python ${{ matrix.python-version }} on ${{ matrix.os }}
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update \
&& sudo apt-get install -y pkg-config libsndfile1 \
libx11-dev libxrandr-dev libxinerama-dev \
libxrender-dev libxcomposite-dev libxcb-xinerama0-dev \
libxcursor-dev libfreetype6 libfreetype6-dev
- name: Install test dependencies
env:
# on macOS and with Python 3.10: building NumPy from source fails without these options:
NPY_BLAS_ORDER: ""
NPY_LAPACK_ORDER: ""
run: |
python -m pip install --upgrade pip
pip install wheel
pip install -r test-requirements.txt
- name: Install JQ for coverage badge on Linux
run: sudo apt-get install -y jq
if: runner.os == 'Linux'
- name: Install JQ for coverage badge on macOS
run: brew install jq
if: runner.os == 'macOS'
- name: Install JQ for coverage badge on Windows
if: runner.os == 'Windows'
uses: crazy-max/ghaction-chocolatey@v2
with:
args: install jq
- name: Build pedalboard locally
run: python setup.py develop
- name: Install VSTs for testing
env:
GCS_ASSET_BUCKET_NAME: ${{ secrets.GCS_ASSET_BUCKET_NAME }}
GCS_READER_SERVICE_ACCOUNT_KEY: ${{ secrets.GCS_READER_SERVICE_ACCOUNT_KEY }}
run: python ./tests/download_test_plugins.py
- name: Run tests
if: matrix.os != 'ubuntu-20.04' || matrix.python-version != '3.8'
run: pytest -v --cov-report term --cov-fail-under=${{ env.MINIMUM_COVERAGE_PERCENTAGE }} --cov=pedalboard --durations=100
- name: Run tests with coverage reporting
if: matrix.os == 'ubuntu-20.04' && matrix.python-version == '3.8'
run: |
pytest -v --cov-report term --cov-fail-under=${{ env.MINIMUM_COVERAGE_PERCENTAGE }} --cov=pedalboard \
&& coverage json --fail-under=${{ env.MINIMUM_COVERAGE_PERCENTAGE }} \
&& jq -r 'def roundit: .*100.0 + 0.5|floor/100.0; .totals.percent_covered | round | "COVERAGE_PERCENTAGE=" + (. | tostring) + "%" ' coverage.json >> $GITHUB_ENV \
&& jq -r 'if .totals.percent_covered > ${{ env.MINIMUM_COVERAGE_PERCENTAGE }} then "COVERAGE_COLOR=green" else "COVERAGE_COLOR=red" end' coverage.json >> $GITHUB_ENV
- name: Create coverage badge
uses: schneegans/dynamic-badges-action@v1.1.0
if: matrix.os == 'ubuntu-20.04' && matrix.python-version == '3.8' && github.event_name == 'release' && github.event.action == 'published'
with:
auth: ${{ secrets.COVERAGE_GIST_SECRET }}
gistID: 8736467e9952991ef44a67915ee7c762
filename: coverage.json
label: Test Coverage
message: ${{ env.COVERAGE_PERCENTAGE }}
color: ${{ env.COVERAGE_COLOR }}
run-tests-with-address-sanitizer:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
os: ['ubuntu-20.04']
name: Test with Python ${{ matrix.python-version }} + Address Sanitizer
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update \
&& sudo apt-get install -y pkg-config libsndfile1 \
libx11-dev libxrandr-dev libxinerama-dev \
libxrender-dev libxcomposite-dev libxcb-xinerama0-dev \
libxcursor-dev libfreetype6 libfreetype6-dev
- name: Install test dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
pip install -r test-requirements.txt
- name: Build pedalboard locally
env:
DEBUG: "0"
USE_ASAN: "1"
CC: clang
CXX: clang++
run: python setup.py develop
- name: Run tests with ASan loaded
# pytest can exit before all Python objects have been destroyed,
# so we tell ASan to ignore leaks.
run: |
ASAN_OPTIONS=detect_leaks=0 \
LD_PRELOAD=$(clang -print-file-name=libclang_rt.asan-x86_64.so) \
pytest -v
test-docs:
runs-on: macos-12
continue-on-error: true
needs: [run-tests]
name: Ensure docs match auto-generated docs
if: github.ref == 'refs/heads/master'
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Install test dependencies
env:
# on macOS and with Python 3.10: building NumPy from source fails without these options:
NPY_BLAS_ORDER: ""
NPY_LAPACK_ORDER: ""
run: |
python -m pip install --upgrade pip
pip install wheel
pip install -r test-requirements.txt
- name: Build pedalboard locally
run: python setup.py develop
- name: Generate type stubs and documentation, and validate they match
# Only validate documentation on macOS, as Linux and Windows have a subset of the classes
# TODO: 3.11.0-rc1 doesn't include type hints when generating type stubs.
run: python3 -m scripts.generate_type_stubs_and_docs --check
build-wheels:
needs: [lint-python, lint-cpp]
runs-on: ${{ matrix.os }}
continue-on-error: false
if: (github.event_name == 'release' && github.event.action == 'published') || contains(github.event.pull_request.labels.*.name, 'Also Test Wheels')
strategy:
matrix:
include:
- { os: macos-12, build: cp36-macosx_x86_64 }
- { os: macos-12, build: cp37-macosx_x86_64 }
- { os: macos-12, build: cp38-macosx_x86_64 }
- { os: macos-12, build: cp39-macosx_x86_64 }
- { os: macos-12, build: cp310-macosx_x86_64 }
- { os: macos-12, build: cp311-macosx_x86_64 }
- { os: macos-12, build: cp38-macosx_universal2 }
- { os: macos-12, build: cp39-macosx_universal2 }
- { os: macos-12, build: cp310-macosx_universal2 }
- { os: macos-12, build: cp311-macosx_universal2 }
- { os: macos-12, build: cp38-macosx_arm64 }
- { os: macos-12, build: cp39-macosx_arm64 }
- { os: macos-12, build: cp310-macosx_arm64 }
- { os: macos-12, build: cp311-macosx_arm64 }
- { os: macos-12, build: pp37-macosx_x86_64 }
- { os: macos-12, build: pp38-macosx_x86_64 }
- { os: macos-12, build: pp39-macosx_x86_64 }
- { os: windows-latest, build: cp36-win_amd64 }
- { os: windows-latest, build: cp37-win_amd64 }
- { os: windows-latest, build: cp38-win_amd64 }
- { os: windows-latest, build: cp39-win_amd64 }
- { os: windows-latest, build: cp310-win_amd64 }
- { os: windows-latest, build: cp311-win_amd64 }
- { os: windows-latest, build: pp37-win_amd64 }
- { os: windows-latest, build: pp38-win_amd64 }
- { os: windows-latest, build: pp39-win_amd64 }
- { os: 'ubuntu-20.04', build: cp36-manylinux_x86_64 }
- { os: 'ubuntu-20.04', build: cp36-manylinux_aarch64 }
- { os: 'ubuntu-20.04', build: cp37-manylinux_x86_64 }
- { os: 'ubuntu-20.04', build: cp37-manylinux_aarch64 }
- { os: 'ubuntu-20.04', build: cp38-manylinux_x86_64 }
- { os: 'ubuntu-20.04', build: cp38-manylinux_aarch64 }
- { os: 'ubuntu-20.04', build: cp39-manylinux_x86_64 }
- { os: 'ubuntu-20.04', build: cp39-manylinux_aarch64 }
- { os: 'ubuntu-20.04', build: cp310-manylinux_x86_64 }
- { os: 'ubuntu-20.04', build: cp310-manylinux_aarch64 }
- { os: 'ubuntu-20.04', build: cp310-musllinux_x86_64 }
- { os: 'ubuntu-20.04', build: cp310-musllinux_aarch64 }
- { os: 'ubuntu-20.04', build: cp311-manylinux_x86_64 }
- { os: 'ubuntu-20.04', build: cp311-manylinux_aarch64 }
- { os: 'ubuntu-20.04', build: cp311-musllinux_x86_64 }
- { os: 'ubuntu-20.04', build: cp311-musllinux_aarch64 }
- { os: 'ubuntu-20.04', build: pp37-manylinux_x86_64 }
- { os: 'ubuntu-20.04', build: pp37-manylinux_aarch64 }
- { os: 'ubuntu-20.04', build: pp38-manylinux_x86_64 }
- { os: 'ubuntu-20.04', build: pp38-manylinux_aarch64 }
- { os: 'ubuntu-20.04', build: pp39-manylinux_x86_64 }
- { os: 'ubuntu-20.04', build: pp39-manylinux_aarch64 }
name: Build wheel for ${{ matrix.build }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
# Used to host cibuildwheel, so version doesn't really matter
- uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install cibuildwheel
run: python -m pip install 'cibuildwheel>=2.11.0'
- name: Set up QEMU for aarch64 on Linux
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_TEST_REQUIRES: -r test-requirements.txt
CIBW_TEST_COMMAND: "pytest {project}/tests"
CIBW_BUILD: ${{ matrix.build }}
CIBW_ARCHS: auto64 # Only support building 64-bit wheels. It's 2022!
CIBW_ARCHS_LINUX: auto64 aarch64 # Useful for building linux images with Apple Silicon
CIBW_ARCHS_MACOS: x86_64 universal2 arm64 # Support Apple Silicon
# on macOS and with Python 3.10: building NumPy from source fails without these options:
CIBW_ENVIRONMENT: NPY_BLAS_ORDER="" NPY_LAPACK_ORDER="" CIBW_BUILD="${{ matrix.build }}"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: pip install auditwheel-symbols && (auditwheel repair -w {dest_dir} {wheel} || auditwheel-symbols --manylinux 2010 {wheel})
# The manylinux container doesn't have a new enough glibc version,
# so we can't run post-wheel-build tests there.
# Also testing any pypy versions fails, as TensorFlow isn't pypy compatible.
CIBW_TEST_SKIP: "*manylinux* *pp* *-macosx_universal2:arm64"
# Use the minimum macOS deployment target that has C++17 support:
MACOSX_DEPLOYMENT_TARGET: "10.13"
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
upload-pypi:
needs: [build-wheels, run-tests-with-address-sanitizer, run-tests]
runs-on: 'ubuntu-20.04'
name: "Upload wheels to PyPI"
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@v1.4.2
with:
user: __token__
password: ${{ secrets.PYPI_DEPLOY_TOKEN }}