-
Notifications
You must be signed in to change notification settings - Fork 262
780 lines (768 loc) Β· 37.5 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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
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.12']
os: ['ubuntu-20.04']
name: Lint Python
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v4
- name: Install Ruff
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Lint Python code
run: ruff check ${{ runner.workspace }}/pedalboard --ignore=E203,F541 --exclude .git,dist,doc,build,vendors,'*.pyi' --line-length 100
- name: Check Python formatting
run: ruff format --check ${{ runner.workspace }}/pedalboard --exclude .git,dist,doc,build,JUCE,examples,vendors,'*.pyi' --diff --line-length 100
lint-cpp:
runs-on: 'ubuntu-20.04'
continue-on-error: true
name: Lint C++
steps:
- uses: actions/checkout@v4
# 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
# Build the native module with ccache enabled so we can share object files between builds:
prime-ubuntu-build-caches:
runs-on: ${{ matrix.os }}
continue-on-error: false
strategy:
matrix:
include:
- { os: ubuntu-20.04, python-version: "3.12", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }
name: Pre-build on ${{ matrix.os }} with ${{ matrix.compiler }}
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v4
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
# We depend on ccache features that are only present in 4.8.0 and later, but installing from apt-get gives us v3.
- name: Install ccache on Linux
if: runner.os == 'Linux'
run: |
mkdir ccache
curl -L https://github.com/ccache/ccache/releases/download/v4.9.1/ccache-4.9.1-linux-x86_64.tar.xz | tar xvJf - -C ccache
mv ccache/ccache*/ccache /usr/local/bin/ccache
chmod +x /usr/local/bin/ccache
- name: Install ccache on macOS
if: runner.os == 'macOS'
run: brew install ccache
- 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
# TensorFlow is an optional dependency; if present, we'll run tests with it:
# There are no environment specifiers to select when TensorFlow binaries are available.
pip install tensorflow==2.13 || true
- name: Restore Cached ${{ runner.os }} Objects
id: cache-objects-restore
uses: actions/cache/restore@v4
with:
enableCrossOsArchive: true
path: |
${{ runner.workspace }}/.ccache
${{ runner.workspace }}/pedalboard/build/lib*
${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/pedalboard/juce_overrides
${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/vendors
key: ${{ runner.os }}-${{ matrix.compiler }}-ccache
- name: Build pedalboard locally
env:
CCACHE_DIR: ${{ runner.workspace }}/.ccache
CCACHE_BASEDIR: ${{ runner.workspace }}
CCACHE_DEBUGDIR: ${{ runner.workspace }}/.ccache_debug
CCACHE_SLOPPINESS: "pch_defines,include_file_mtime,include_file_ctime,time_macros,locale,random_seed,system_headers"
CCACHE_COMPILERCHECK: none
CCACHE_NOINODECACHE: 1
CCACHE_IGNOREOPTIONS: "-fno-strict-overflow -fwrapv -W* -arch x86_64 arm64 -dynamic -fno-common -g -I/usr/local/opt/*"
CCACHE_LOGFILE: ${{ runner.workspace }}/.ccache_log
CCACHE_DEBUG: "1"
DISABLE_LTO: "1" # Speeds up un-cacheable link step which doesn't really increase performance in tests anyways
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
run: python setup.py develop
- name: Ensure ccache worked
env:
CCACHE_DIR: ${{ runner.workspace }}/.ccache
run: |
ccache --show-stats --verbose
ccache --zero-stats
# cat ${{ runner.workspace }}/.ccache_log || true
- name: Save Cached ${{ runner.os }} Objects
id: cache-objects-save
uses: actions/cache/save@v4
with:
enableCrossOsArchive: true
path: |
${{ runner.workspace }}/.ccache
${{ runner.workspace }}/pedalboard/build/lib*
${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/pedalboard/juce_overrides
${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/vendors
key: ${{ steps.cache-objects-restore.outputs.cache-primary-key }}
prime-macos-build-caches:
runs-on: ${{ matrix.os }}
continue-on-error: false
strategy:
matrix:
include:
- { os: macos-13, python-version: "3.12", compiler: "clang", cc: "ccache clang", cxx: "ccache clang++" }
name: Pre-build on ${{ matrix.os }} with ${{ matrix.compiler }}
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install ccache on macOS
if: runner.os == 'macOS'
run: brew install ccache
- 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: Restore Cached ${{ runner.os }} Objects
id: cache-objects-restore
uses: actions/cache/restore@v4
with:
enableCrossOsArchive: true
path: |
${{ runner.workspace }}/.ccache
${{ runner.workspace }}/pedalboard/build/lib*
${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/pedalboard/juce_overrides
${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/vendors
key: ${{ runner.os }}-${{ matrix.compiler }}-ccache
- name: Build pedalboard locally
env:
CCACHE_DIR: ${{ runner.workspace }}/.ccache
CCACHE_BASEDIR: ${{ runner.workspace }}
CCACHE_DEBUGDIR: ${{ runner.workspace }}/.ccache_debug
CCACHE_SLOPPINESS: "pch_defines,include_file_mtime,include_file_ctime,time_macros,locale,random_seed,system_headers"
CCACHE_COMPILERCHECK: none
CCACHE_NOINODECACHE: 1
CCACHE_IGNOREOPTIONS: "-fno-strict-overflow -fwrapv -W* -arch x86_64 arm64 -dynamic -fno-common -g -I/usr/local/opt/*"
CCACHE_DEBUG: "1"
MACOSX_DEPLOYMENT_TARGET: "10.13"
CCACHE_LOGFILE: ${{ runner.workspace }}/.ccache_log
# This build caching is only to speed up tests on CI, so we only care about x86_64 for now.
# Without limiting to a single architecture, ccache can't properly cache mixed Objective-C and C++ builds.
# Fun fact: this is supported in Python itself! https://github.com/python/cpython/blob/893c9cc/Lib/_osx_support.py#L314-L328
ARCHFLAGS: -arch x86_64
DISABLE_LTO: "1" # Speeds up un-cacheable link step which doesn't really increase performance in tests anyways
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
run: python setup.py develop
- name: Ensure ccache worked
env:
CCACHE_DIR: ${{ runner.workspace }}/.ccache
run: |
ccache --show-stats --verbose
ccache --zero-stats
# cat ${{ runner.workspace }}/.ccache_log || true
# ls -lashR ${{ runner.workspace }}/pedalboard
- name: Save Cached ${{ runner.os }} Objects
id: cache-objects-save
uses: actions/cache/save@v4
with:
enableCrossOsArchive: true
path: |
${{ runner.workspace }}/.ccache
${{ runner.workspace }}/pedalboard/build/lib*
${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/pedalboard/juce_overrides
${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/vendors
key: ${{ steps.cache-objects-restore.outputs.cache-primary-key }}
# Build the native module with ccache enabled so we can share object files between builds:
prime-asan-build-caches:
runs-on: ${{ matrix.os }}
continue-on-error: false
strategy:
matrix:
include:
- { os: ubuntu-20.04, python-version: "3.12", compiler: "clang", cc: "ccache clang", cxx: "ccache clang++" }
name: Pre-build on ${{ matrix.os }} with ${{ matrix.compiler }}
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v4
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
# We depend on ccache features that are only present in 4.8.0 and later, but installing from apt-get gives us v3.
- name: Install ccache on Linux
if: runner.os == 'Linux'
run: |
mkdir ccache
curl -L https://github.com/ccache/ccache/releases/download/v4.9.1/ccache-4.9.1-linux-x86_64.tar.xz | tar xvJf - -C ccache
mv ccache/ccache*/ccache /usr/local/bin/ccache
chmod +x /usr/local/bin/ccache
- name: Install ccache on macOS
if: runner.os == 'macOS'
run: brew install ccache
- 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
# TensorFlow is an optional dependency; if present, we'll run tests with it:
# There are no environment specifiers to select when TensorFlow binaries are available.
pip install tensorflow==2.13 || true
- name: Restore Cached ${{ runner.os }} Objects
id: cache-objects-restore
uses: actions/cache/restore@v4
with:
enableCrossOsArchive: true
path: |
${{ runner.workspace }}/.ccache
${{ runner.workspace }}/pedalboard/build/lib*
${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/pedalboard/juce_overrides
${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/vendors
key: ${{ runner.os }}-${{ matrix.compiler }}-ccache
- name: Build pedalboard locally
env:
CCACHE_DIR: ${{ runner.workspace }}/.ccache
CCACHE_BASEDIR: ${{ runner.workspace }}
CCACHE_DEBUGDIR: ${{ runner.workspace }}/.ccache_debug
CCACHE_SLOPPINESS: "pch_defines,include_file_mtime,include_file_ctime,time_macros,locale,random_seed,system_headers"
CCACHE_COMPILERCHECK: none
CCACHE_NOINODECACHE: 1
CCACHE_IGNOREOPTIONS: "-fno-strict-overflow -fwrapv -W* -arch x86_64 arm64 -dynamic -fno-common -g -I/usr/local/opt/*"
CCACHE_LOGFILE: ${{ runner.workspace }}/.ccache_log
USE_ASAN: "1"
DISABLE_LTO: "1" # Speeds up un-cacheable link step which doesn't really increase performance in tests anyways
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
run: python setup.py develop
- name: Ensure ccache worked
env:
CCACHE_DIR: ${{ runner.workspace }}/.ccache
run: |
ccache --show-stats --verbose
ccache --zero-stats
# cat ${{ runner.workspace }}/.ccache_log || true
# ls -lashR ${{ runner.workspace }}
- name: Save Cached ${{ runner.os }} Objects
id: cache-objects-save
uses: actions/cache/save@v4
with:
enableCrossOsArchive: true
path: |
${{ runner.workspace }}/.ccache
${{ runner.workspace }}/pedalboard/build/lib*
${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/pedalboard/juce_overrides
${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/vendors
key: ${{ steps.cache-objects-restore.outputs.cache-primary-key }}
# This initial job catches obvious failures faster by running tests in parallel on just Ubuntu.
run-tests-in-parallel:
runs-on: ${{ matrix.os }}
continue-on-error: false
needs:
- prime-ubuntu-build-caches
strategy:
matrix:
os: ["ubuntu-20.04"]
python-version: ["3.12"]
compiler: ["gcc"]
cc: ["ccache gcc"]
cxx: ["ccache g++"]
runner_index: ["1", "2", "3", "4", "5", "6", "7", "8"]
runner_total: ["8"]
name: Test ${{ matrix.runner_index }} / ${{ matrix.runner_total }} with Python ${{ matrix.python-version }} on ${{ matrix.os }}
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v4
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
# We depend on ccache features that are only present in 4.8.0 and later, but installing from apt-get gives us v3.
- name: Install ccache on Linux
if: runner.os == 'Linux'
run: |
mkdir ccache
curl -L https://github.com/ccache/ccache/releases/download/v4.9.1/ccache-4.9.1-linux-x86_64.tar.xz | tar xvJf - -C ccache
mv ccache/ccache*/ccache /usr/local/bin/ccache
chmod +x /usr/local/bin/ccache
- 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
# TensorFlow is an optional dependency; if present, we'll run tests with it:
# There are no environment specifiers to select when TensorFlow binaries are available.
pip install tensorflow==2.13 || true
- name: Restore Cached ${{ runner.os }} Objects
id: cache-objects-restore
uses: actions/cache/restore@v4
with:
enableCrossOsArchive: true
path: |
${{ runner.workspace }}/.ccache
${{ runner.workspace }}/pedalboard/build/lib*
${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/pedalboard/juce_overrides
${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/vendors
key: ${{ runner.os }}-${{ matrix.compiler }}-ccache
- name: Print Restored ${{ runner.os }} Objects
run: ls -lashR ${{ runner.workspace }}
# Without this, distutils will recompile the extension even though we already have the .so built:
- name: Touch Restored ${{ runner.os }} Objects to Prevent Cache Miss
if: runner.os == 'Linux' || runner.os == 'macOS'
run: |
find ${{ runner.workspace }} -name '*.so' -exec touch {} \; || true
find ${{ runner.workspace }} -name '*.o' -exec touch {} \; || true
ls -lR ${{ runner.workspace }}/pedalboard
- name: Build pedalboard locally
run: python setup.py develop
env:
CCACHE_DIR: ${{ runner.workspace }}/.ccache
CCACHE_BASEDIR: ${{ runner.workspace }}
CCACHE_DEBUGDIR: ${{ runner.workspace }}/.ccache_debug
CCACHE_SLOPPINESS: "pch_defines,include_file_mtime,include_file_ctime,time_macros,locale,random_seed,system_headers"
CCACHE_COMPILERCHECK: none
CCACHE_NOINODECACHE: 1
CCACHE_IGNOREOPTIONS: "-fno-strict-overflow -fwrapv -W* -arch x86_64 arm64 -dynamic -fno-common -g -I/usr/local/opt/*"
CCACHE_LOGFILE: ${{ runner.workspace }}/.ccache_log
DISABLE_LTO: "1" # Speeds up un-cacheable link step which doesn't really increase performance in tests anyways
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
- name: Ensure ccache worked
env:
CCACHE_DIR: ${{ runner.workspace }}/.ccache
run: |
ccache --show-stats --verbose
ccache --zero-stats
# cat ${{ runner.workspace }}/.ccache_log || true
# ls -lashR ${{ runner.workspace }}
- 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
env:
TEST_WORKER_INDEX: ${{ matrix.runner_index }}
NUM_TEST_WORKERS: ${{ matrix.runner_total }}
run: pytest --maxfail=1 --durations=10
run-tests:
runs-on: ${{ matrix.os }}
continue-on-error: false
needs:
- prime-ubuntu-build-caches
- prime-macos-build-caches
env:
MINIMUM_COVERAGE_PERCENTAGE: 80
strategy:
matrix:
include:
- { os: macos-13, python-version: "3.7", compiler: "clang", cc: "ccache clang", cxx: "ccache clang++" }
- { os: macos-13, python-version: "3.8", compiler: "clang", cc: "ccache clang", cxx: "ccache clang++" }
- { os: macos-13, python-version: "3.9", compiler: "clang", cc: "ccache clang", cxx: "ccache clang++" }
- { os: macos-13, python-version: "3.10", compiler: "clang", cc: "ccache clang", cxx: "ccache clang++" }
- { os: macos-13, python-version: "3.11", compiler: "clang", cc: "ccache clang", cxx: "ccache clang++" }
- { os: macos-13, python-version: "3.12", compiler: "clang", cc: "ccache clang", cxx: "ccache clang++" }
- { os: ubuntu-20.04, python-version: "3.7", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }
- { os: ubuntu-20.04, python-version: "3.8", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }
- { os: ubuntu-20.04, python-version: "3.9", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }
- { os: ubuntu-20.04, python-version: "3.10", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }
- { os: ubuntu-20.04, python-version: "3.11", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }
- { os: ubuntu-20.04, python-version: "3.12", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }
# - { os: windows-latest, python-version: "3.7", compiler: "msvc", cc: "msvc", cxx: "msvc" }
# - { os: windows-latest, python-version: "3.8", compiler: "msvc", cc: "msvc", cxx: "msvc" }
# - { os: windows-latest, python-version: "3.9", compiler: "msvc", cc: "msvc", cxx: "msvc" }
# - { os: windows-latest, python-version: "3.10", compiler: "msvc", cc: "msvc", cxx: "msvc" }
# - { os: windows-latest, python-version: "3.11", compiler: "msvc", cc: "msvc", cxx: "msvc" }
- { os: windows-latest, python-version: "3.12", compiler: "msvc", cc: "msvc", cxx: "msvc" }
name: Test with Python ${{ matrix.python-version }} on ${{ matrix.os }}
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v4
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
# We depend on ccache features that are only present in 4.8.0 and later, but installing from apt-get gives us v3.
- name: Install ccache on Linux
if: runner.os == 'Linux'
run: |
mkdir ccache
curl -L https://github.com/ccache/ccache/releases/download/v4.9.1/ccache-4.9.1-linux-x86_64.tar.xz | tar xvJf - -C ccache
mv ccache/ccache*/ccache /usr/local/bin/ccache
chmod +x /usr/local/bin/ccache
- name: Install ccache on macOS
if: runner.os == 'macOS'
run: brew install ccache
- 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
# TensorFlow is an optional dependency; if present, we'll run tests with it:
# There are no environment specifiers to select when TensorFlow binaries are available.
pip install tensorflow==2.13 || true
- 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: Restore Cached ${{ runner.os }} Objects
id: cache-objects-restore
uses: actions/cache/restore@v4
with:
enableCrossOsArchive: true
path: |
${{ runner.workspace }}/.ccache
${{ runner.workspace }}/pedalboard/build/lib*
${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/pedalboard/juce_overrides
${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/vendors
key: ${{ runner.os }}-${{ matrix.compiler }}-ccache
# Without this, distutils will recompile the extension even though we already have the shared object built:
- name: Touch Restored ${{ runner.os }} Objects to Prevent Cache Miss
if: runner.os == 'Linux' || runner.os == 'macOS'
run: |
find ${{ runner.workspace }} -name '*.so' -exec touch {} \; || true
find ${{ runner.workspace }} -name '*.o' -exec touch {} \; || true
ls -lR ${{ runner.workspace }}/pedalboard
- name: Build pedalboard locally
run: python setup.py develop
env:
CCACHE_DIR: ${{ runner.workspace }}/.ccache
CCACHE_BASEDIR: ${{ runner.workspace }}
CCACHE_DEBUGDIR: ${{ runner.workspace }}/.ccache_debug
CCACHE_SLOPPINESS: "pch_defines,include_file_mtime,include_file_ctime,time_macros,locale,random_seed,system_headers"
CCACHE_COMPILERCHECK: none
CCACHE_NOINODECACHE: 1
CCACHE_IGNOREOPTIONS: "-fno-strict-overflow -fwrapv -W* -arch x86_64 arm64 -dynamic -fno-common -g -I/usr/local/opt/*"
CCACHE_LOGFILE: ${{ runner.workspace }}/.ccache_log
CCACHE_DEBUG: "1"
MACOSX_DEPLOYMENT_TARGET: "10.13"
# This build caching is only to speed up tests on CI, so we only care about x86_64 for now.
# Without limiting to a single architecture, ccache can't properly cache mixed Objective-C and C++ builds.
# Fun fact: this is supported in Python itself! https://github.com/python/cpython/blob/893c9cc/Lib/_osx_support.py#L314-L328
ARCHFLAGS: -arch x86_64
DISABLE_LTO: "1" # Speeds up un-cacheable link step which doesn't really increase performance in tests anyways
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
- name: Ensure ccache worked
if: runner.os == 'Linux' || runner.os == 'macOS'
env:
CCACHE_DIR: ${{ runner.workspace }}/.ccache
run: |
ccache --show-stats --verbose
ccache --zero-stats
# cat ${{ runner.workspace }}/.ccache_log || true
- 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 --maxfail=4 --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 --maxfail=4 --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 }}
needs: [prime-asan-build-caches]
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@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v4
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
# We depend on ccache features that are only present in 4.8.0 and later, but installing from apt-get gives us v3.
- name: Install ccache on Linux
if: runner.os == 'Linux'
run: |
mkdir ccache
curl -L https://github.com/ccache/ccache/releases/download/v4.9.1/ccache-4.9.1-linux-x86_64.tar.xz | tar xvJf - -C ccache
mv ccache/ccache*/ccache /usr/local/bin/ccache
chmod +x /usr/local/bin/ccache
- name: Install test dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
pip install -r test-requirements.txt
# TensorFlow is an optional dependency; if present, we'll run tests with it:
# There are no environment specifiers to select when TensorFlow binaries are available.
pip install tensorflow==2.13 || true
- name: Restore Cached ${{ runner.os }} Objects
id: cache-objects-restore
uses: actions/cache/restore@v4
with:
enableCrossOsArchive: true
path: |
${{ runner.workspace }}/.ccache
${{ runner.workspace }}/pedalboard/build/lib*
${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/pedalboard/juce_overrides
${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/vendors
key: ${{ runner.os }}-clang-ccache
- name: Build pedalboard locally
env:
DEBUG: "0"
USE_ASAN: "1"
CCACHE_DIR: ${{ runner.workspace }}/.ccache
CCACHE_BASEDIR: ${{ runner.workspace }}
CCACHE_DEBUGDIR: ${{ runner.workspace }}/.ccache_debug
CCACHE_SLOPPINESS: "pch_defines,include_file_mtime,include_file_ctime,time_macros,locale,random_seed,system_headers"
CCACHE_COMPILERCHECK: none
CCACHE_NOINODECACHE: 1
CCACHE_IGNOREOPTIONS: "-fno-strict-overflow -fwrapv -W* -arch x86_64 arm64 -dynamic -fno-common -g -I/usr/local/opt/*"
CCACHE_LOGFILE: ${{ runner.workspace }}/.ccache_log
CCACHE_DEBUG: "1"
DISABLE_LTO: "1" # Speeds up un-cacheable link step which doesn't really increase performance in tests anyways
CC: ccache clang
CXX: ccache clang++
run: python setup.py develop
- name: Ensure ccache worked
env:
CCACHE_DIR: ${{ runner.workspace }}/.ccache
run: |
ccache --show-stats --verbose
ccache --zero-stats
# cat ${{ runner.workspace }}/.ccache_log || true
- 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 --maxfail=4
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: cp312-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: cp312-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: cp312-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: cp312-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: cp38-musllinux_x86_64 }
- { os: 'ubuntu-20.04', build: cp38-musllinux_aarch64 }
- { os: 'ubuntu-20.04', build: cp39-manylinux_x86_64 }
- { os: 'ubuntu-20.04', build: cp39-manylinux_aarch64 }
- { os: 'ubuntu-20.04', build: cp39-musllinux_x86_64 }
- { os: 'ubuntu-20.04', build: cp39-musllinux_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: cp312-manylinux_x86_64 }
- { os: 'ubuntu-20.04', build: cp312-manylinux_aarch64 }
- { os: 'ubuntu-20.04', build: cp312-musllinux_x86_64 }
- { os: 'ubuntu-20.04', build: cp312-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@v4
with:
submodules: recursive
# Used to host cibuildwheel, so version doesn't really matter
- uses: actions/setup-python@v5
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.
# The musllinux containers on aarch64 take 6+ hours to test.
# Also testing any pypy versions fails, as TensorFlow isn't pypy compatible.
CIBW_TEST_SKIP: "*manylinux* *musllinux_aarch* *pp* *-macosx_universal2:arm64"
# Use the minimum macOS deployment target that has C++17 support:
MACOSX_DEPLOYMENT_TARGET: "10.13"
CIBW_MUSLLINUX_X86_64_IMAGE: quay.io/pypa/musllinux_1_1_x86_64:2024-04-29-07d05a0
CIBW_MUSLLINUX_AARCH64_IMAGE: quay.io/pypa/musllinux_1_1_aarch64:2024-04-29-07d05a0
- 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 }}