-
Notifications
You must be signed in to change notification settings - Fork 278
892 lines (698 loc) · 34.7 KB
/
ci.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
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
#
# DO NOT MODIFY! AUTO-GENERATED FROM:
# .github/workflows/ci/workflow_template.yml
#
name: CI
on:
push:
branches:
- '*'
tags-ignore:
# Ignore continuous releases' tag.
- 'continuous'
pull_request:
defaults:
run:
# Powershell on Windows? No thank you...
shell: bash --noprofile --norc -eo pipefail .github/workflows/ci/helpers.sh . {0}
jobs:
# Job: Analyze {{{
analyze:
name: Analyze
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Calculate skip cache keys
id: set_cache
run: |
job_cache_extra_deps=(); job_id=test_linux; job_name='Test (Linux)'; job_needs=(); job_os=Linux; job_platform=ubuntu-22.04; job_python=3.9; job_reqs=(reqs/dist.txt reqs/test.txt); job_skip_cache_name=skip_test_linux_py-3.9_ubuntu-22.04; job_skip_cache_path=.skip_cache_test_linux; job_skiplists=(job_test os_linux); job_test_args='-p no:pytest-qt --ignore=test/gui_qt'; job_type=test; job_variant=Linux; analyze_set_job_skip_cache_key
job_cache_extra_deps=(osx/deps.sh); job_id=test_macos; job_name='Test (macOS)'; job_needs=(); job_os=macOS; job_platform=macos-12; job_python=3.9; job_reqs=(reqs/dist.txt reqs/test.txt); job_skip_cache_name=skip_test_macos_py-3.9_macos-12; job_skip_cache_path=.skip_cache_test_macos; job_skiplists=(job_test os_macos); job_test_args='-p no:pytest-qt --ignore=test/gui_qt'; job_type=test; job_variant=macOS; analyze_set_job_skip_cache_key
job_cache_extra_deps=(); job_id=test_windows; job_name='Test (Windows)'; job_needs=(); job_os=Windows; job_platform=windows-2022; job_python=3.9; job_reqs=(reqs/dist.txt reqs/test.txt); job_skip_cache_name=skip_test_windows_py-3.9_windows-2022; job_skip_cache_path=.skip_cache_test_windows; job_skiplists=(job_test os_windows); job_test_args='-p no:pytest-qt --ignore=test/gui_qt'; job_type=test; job_variant=Windows; analyze_set_job_skip_cache_key
job_cache_extra_deps=(); job_id=test_python_38; job_name='Test (Python 3.8)'; job_needs=(); job_os=Linux; job_platform=ubuntu-latest; job_python=3.8; job_reqs=(reqs/dist.txt reqs/test.txt); job_skip_cache_name=skip_test_python_38_py-3.8_ubuntu-latest; job_skip_cache_path=.skip_cache_test_python_38; job_skiplists=(job_test os_linux os_macos os_windows); job_test_args='-p no:pytest-qt --ignore=test/gui_qt'; job_type=test; job_variant='Python 3.8'; analyze_set_job_skip_cache_key
job_cache_extra_deps=(); job_id=test_python_310; job_name='Test (Python 3.10)'; job_needs=(); job_os=Linux; job_platform=ubuntu-latest; job_python=3.10; job_reqs=(reqs/dist.txt reqs/test.txt); job_skip_cache_name=skip_test_python_310_py-3.10_ubuntu-latest; job_skip_cache_path=.skip_cache_test_python_310; job_skiplists=(job_test os_linux os_macos os_windows); job_test_args='-p no:pytest-qt --ignore=test/gui_qt'; job_type=test; job_variant='Python 3.10'; analyze_set_job_skip_cache_key
job_cache_extra_deps=(); job_id=test_qt_gui; job_name='Test (Qt GUI)'; job_needs=(); job_os=Linux; job_platform=ubuntu-22.04; job_python=3.9; job_reqs=(reqs/dist.txt reqs/dist_extra_gui_qt.txt reqs/test.txt); job_skip_cache_name=skip_test_qt_gui_py-3.9_ubuntu-22.04; job_skip_cache_path=.skip_cache_test_qt_gui; job_skiplists=(job_test_gui_qt); job_test_args=test/gui_qt; job_type=test_gui_qt; job_variant='Qt GUI'; analyze_set_job_skip_cache_key
job_cache_extra_deps=(); job_id=test_packaging; job_name='Test (Packaging)'; job_needs=(); job_os=Linux; job_platform=ubuntu-latest; job_python=3.9; job_reqs=(reqs/packaging.txt reqs/setup.txt); job_skip_cache_name=skip_test_packaging_py-3.9_ubuntu-latest; job_skip_cache_path=.skip_cache_test_packaging; job_skiplists=(job_test_packaging); job_type=test_packaging; job_variant=Packaging; analyze_set_job_skip_cache_key
job_cache_extra_deps=('reqs/dist_*.txt' linux/appimage/deps.sh); job_id=build_linux; job_name='Build (Linux)'; job_needs=(test_linux); job_os=Linux; job_platform=ubuntu-22.04; job_python=3.9; job_reqs=(reqs/build.txt reqs/setup.txt); job_skip_cache_name=skip_build_linux_py-3.9_ubuntu-22.04; job_skip_cache_path=.skip_cache_build_linux; job_skiplists=(job_build os_linux); job_type=build; job_variant=Linux; analyze_set_job_skip_cache_key
job_cache_extra_deps=('reqs/dist_*.txt' osx/deps.sh); job_id=build_macos; job_name='Build (macOS)'; job_needs=(test_macos); job_os=macOS; job_platform=macos-12; job_python=3.9; job_reqs=(reqs/build.txt reqs/setup.txt); job_skip_cache_name=skip_build_macos_py-3.9_macos-12; job_skip_cache_path=.skip_cache_build_macos; job_skiplists=(job_build os_macos); job_type=build; job_variant=macOS; analyze_set_job_skip_cache_key
job_cache_extra_deps=('reqs/dist_*.txt' windows/dist_deps.sh); job_id=build_windows; job_name='Build (Windows)'; job_needs=(test_windows); job_os=Windows; job_platform=windows-2022; job_python=3.9; job_reqs=(reqs/build.txt reqs/setup.txt); job_skip_cache_name=skip_build_windows_py-3.9_windows-2022; job_skip_cache_path=.skip_cache_build_windows; job_skiplists=(job_build os_windows); job_type=build; job_variant=Windows; analyze_set_job_skip_cache_key
- name: Check skip cache for Test (Linux)
uses: actions/cache@v3
with:
path: .skip_cache_test_linux
key: 0_check_${{ steps.set_cache.outputs.test_linux_skip_cache_key }}_${{ github.run_id }}
restore-keys:
0_${{ steps.set_cache.outputs.test_linux_skip_cache_key }}
- name: Check skip cache for Test (macOS)
uses: actions/cache@v3
with:
path: .skip_cache_test_macos
key: 0_check_${{ steps.set_cache.outputs.test_macos_skip_cache_key }}_${{ github.run_id }}
restore-keys:
0_${{ steps.set_cache.outputs.test_macos_skip_cache_key }}
- name: Check skip cache for Test (Windows)
uses: actions/cache@v3
with:
path: .skip_cache_test_windows
key: 0_check_${{ steps.set_cache.outputs.test_windows_skip_cache_key }}_${{ github.run_id }}
restore-keys:
0_${{ steps.set_cache.outputs.test_windows_skip_cache_key }}
- name: Check skip cache for Test (Python 3.8)
uses: actions/cache@v3
with:
path: .skip_cache_test_python_38
key: 0_check_${{ steps.set_cache.outputs.test_python_38_skip_cache_key }}_${{ github.run_id }}
restore-keys:
0_${{ steps.set_cache.outputs.test_python_38_skip_cache_key }}
- name: Check skip cache for Test (Python 3.10)
uses: actions/cache@v3
with:
path: .skip_cache_test_python_310
key: 0_check_${{ steps.set_cache.outputs.test_python_310_skip_cache_key }}_${{ github.run_id }}
restore-keys:
0_${{ steps.set_cache.outputs.test_python_310_skip_cache_key }}
- name: Check skip cache for Test (Qt GUI)
uses: actions/cache@v3
with:
path: .skip_cache_test_qt_gui
key: 0_check_${{ steps.set_cache.outputs.test_qt_gui_skip_cache_key }}_${{ github.run_id }}
restore-keys:
0_${{ steps.set_cache.outputs.test_qt_gui_skip_cache_key }}
- name: Check skip cache for Test (Packaging)
uses: actions/cache@v3
with:
path: .skip_cache_test_packaging
key: 0_check_${{ steps.set_cache.outputs.test_packaging_skip_cache_key }}_${{ github.run_id }}
restore-keys:
0_${{ steps.set_cache.outputs.test_packaging_skip_cache_key }}
- name: Check skip cache for Build (Linux)
uses: actions/cache@v3
with:
path: .skip_cache_build_linux
key: 0_check_${{ steps.set_cache.outputs.build_linux_skip_cache_key }}_${{ github.run_id }}
restore-keys:
0_${{ steps.set_cache.outputs.build_linux_skip_cache_key }}
- name: Check skip cache for Build (macOS)
uses: actions/cache@v3
with:
path: .skip_cache_build_macos
key: 0_check_${{ steps.set_cache.outputs.build_macos_skip_cache_key }}_${{ github.run_id }}
restore-keys:
0_${{ steps.set_cache.outputs.build_macos_skip_cache_key }}
- name: Check skip cache for Build (Windows)
uses: actions/cache@v3
with:
path: .skip_cache_build_windows
key: 0_check_${{ steps.set_cache.outputs.build_windows_skip_cache_key }}_${{ github.run_id }}
restore-keys:
0_${{ steps.set_cache.outputs.build_windows_skip_cache_key }}
- name: Set outputs
id: set_ouputs
env:
CONTINUOUS_RELEASE_BRANCH: ${{ secrets.CONTINUOUS_RELEASE_BRANCH }}
run: |
analyze_set_release_info
job_cache_extra_deps=(); job_id=test_linux; job_name='Test (Linux)'; job_needs=(); job_os=Linux; job_platform=ubuntu-22.04; job_python=3.9; job_reqs=(reqs/dist.txt reqs/test.txt); job_skip_cache_name=skip_test_linux_py-3.9_ubuntu-22.04; job_skip_cache_path=.skip_cache_test_linux; job_skiplists=(job_test os_linux); job_test_args='-p no:pytest-qt --ignore=test/gui_qt'; job_type=test; job_variant=Linux; analyze_set_job_skip_job
job_cache_extra_deps=(osx/deps.sh); job_id=test_macos; job_name='Test (macOS)'; job_needs=(); job_os=macOS; job_platform=macos-12; job_python=3.9; job_reqs=(reqs/dist.txt reqs/test.txt); job_skip_cache_name=skip_test_macos_py-3.9_macos-12; job_skip_cache_path=.skip_cache_test_macos; job_skiplists=(job_test os_macos); job_test_args='-p no:pytest-qt --ignore=test/gui_qt'; job_type=test; job_variant=macOS; analyze_set_job_skip_job
job_cache_extra_deps=(); job_id=test_windows; job_name='Test (Windows)'; job_needs=(); job_os=Windows; job_platform=windows-2022; job_python=3.9; job_reqs=(reqs/dist.txt reqs/test.txt); job_skip_cache_name=skip_test_windows_py-3.9_windows-2022; job_skip_cache_path=.skip_cache_test_windows; job_skiplists=(job_test os_windows); job_test_args='-p no:pytest-qt --ignore=test/gui_qt'; job_type=test; job_variant=Windows; analyze_set_job_skip_job
job_cache_extra_deps=(); job_id=test_python_38; job_name='Test (Python 3.8)'; job_needs=(); job_os=Linux; job_platform=ubuntu-latest; job_python=3.8; job_reqs=(reqs/dist.txt reqs/test.txt); job_skip_cache_name=skip_test_python_38_py-3.8_ubuntu-latest; job_skip_cache_path=.skip_cache_test_python_38; job_skiplists=(job_test os_linux os_macos os_windows); job_test_args='-p no:pytest-qt --ignore=test/gui_qt'; job_type=test; job_variant='Python 3.8'; analyze_set_job_skip_job
job_cache_extra_deps=(); job_id=test_python_310; job_name='Test (Python 3.10)'; job_needs=(); job_os=Linux; job_platform=ubuntu-latest; job_python=3.10; job_reqs=(reqs/dist.txt reqs/test.txt); job_skip_cache_name=skip_test_python_310_py-3.10_ubuntu-latest; job_skip_cache_path=.skip_cache_test_python_310; job_skiplists=(job_test os_linux os_macos os_windows); job_test_args='-p no:pytest-qt --ignore=test/gui_qt'; job_type=test; job_variant='Python 3.10'; analyze_set_job_skip_job
job_cache_extra_deps=(); job_id=test_qt_gui; job_name='Test (Qt GUI)'; job_needs=(); job_os=Linux; job_platform=ubuntu-22.04; job_python=3.9; job_reqs=(reqs/dist.txt reqs/dist_extra_gui_qt.txt reqs/test.txt); job_skip_cache_name=skip_test_qt_gui_py-3.9_ubuntu-22.04; job_skip_cache_path=.skip_cache_test_qt_gui; job_skiplists=(job_test_gui_qt); job_test_args=test/gui_qt; job_type=test_gui_qt; job_variant='Qt GUI'; analyze_set_job_skip_job
job_cache_extra_deps=(); job_id=test_packaging; job_name='Test (Packaging)'; job_needs=(); job_os=Linux; job_platform=ubuntu-latest; job_python=3.9; job_reqs=(reqs/packaging.txt reqs/setup.txt); job_skip_cache_name=skip_test_packaging_py-3.9_ubuntu-latest; job_skip_cache_path=.skip_cache_test_packaging; job_skiplists=(job_test_packaging); job_type=test_packaging; job_variant=Packaging; analyze_set_job_skip_job
job_cache_extra_deps=('reqs/dist_*.txt' linux/appimage/deps.sh); job_id=build_linux; job_name='Build (Linux)'; job_needs=(test_linux); job_os=Linux; job_platform=ubuntu-22.04; job_python=3.9; job_reqs=(reqs/build.txt reqs/setup.txt); job_skip_cache_name=skip_build_linux_py-3.9_ubuntu-22.04; job_skip_cache_path=.skip_cache_build_linux; job_skiplists=(job_build os_linux); job_type=build; job_variant=Linux; analyze_set_job_skip_job
job_cache_extra_deps=('reqs/dist_*.txt' osx/deps.sh); job_id=build_macos; job_name='Build (macOS)'; job_needs=(test_macos); job_os=macOS; job_platform=macos-12; job_python=3.9; job_reqs=(reqs/build.txt reqs/setup.txt); job_skip_cache_name=skip_build_macos_py-3.9_macos-12; job_skip_cache_path=.skip_cache_build_macos; job_skiplists=(job_build os_macos); job_type=build; job_variant=macOS; analyze_set_job_skip_job
job_cache_extra_deps=('reqs/dist_*.txt' windows/dist_deps.sh); job_id=build_windows; job_name='Build (Windows)'; job_needs=(test_windows); job_os=Windows; job_platform=windows-2022; job_python=3.9; job_reqs=(reqs/build.txt reqs/setup.txt); job_skip_cache_name=skip_build_windows_py-3.9_windows-2022; job_skip_cache_path=.skip_cache_build_windows; job_skiplists=(job_build os_windows); job_type=build; job_variant=Windows; analyze_set_job_skip_job
outputs:
is_release: ${{ steps.set_ouputs.outputs.is_release }}
release_type: ${{ steps.set_ouputs.outputs.release_type }}
test_linux_skip_job: ${{ steps.set_ouputs.outputs.test_linux_skip_job }}
test_linux_skip_cache_key: ${{ steps.set_cache.outputs.test_linux_skip_cache_key }}
test_macos_skip_job: ${{ steps.set_ouputs.outputs.test_macos_skip_job }}
test_macos_skip_cache_key: ${{ steps.set_cache.outputs.test_macos_skip_cache_key }}
test_windows_skip_job: ${{ steps.set_ouputs.outputs.test_windows_skip_job }}
test_windows_skip_cache_key: ${{ steps.set_cache.outputs.test_windows_skip_cache_key }}
test_python_38_skip_job: ${{ steps.set_ouputs.outputs.test_python_38_skip_job }}
test_python_38_skip_cache_key: ${{ steps.set_cache.outputs.test_python_38_skip_cache_key }}
test_python_310_skip_job: ${{ steps.set_ouputs.outputs.test_python_310_skip_job }}
test_python_310_skip_cache_key: ${{ steps.set_cache.outputs.test_python_310_skip_cache_key }}
test_qt_gui_skip_job: ${{ steps.set_ouputs.outputs.test_qt_gui_skip_job }}
test_qt_gui_skip_cache_key: ${{ steps.set_cache.outputs.test_qt_gui_skip_cache_key }}
test_packaging_skip_job: ${{ steps.set_ouputs.outputs.test_packaging_skip_job }}
test_packaging_skip_cache_key: ${{ steps.set_cache.outputs.test_packaging_skip_cache_key }}
build_linux_skip_job: ${{ steps.set_ouputs.outputs.build_linux_skip_job }}
build_linux_skip_cache_key: ${{ steps.set_cache.outputs.build_linux_skip_cache_key }}
build_macos_skip_job: ${{ steps.set_ouputs.outputs.build_macos_skip_job }}
build_macos_skip_cache_key: ${{ steps.set_cache.outputs.build_macos_skip_cache_key }}
build_windows_skip_job: ${{ steps.set_ouputs.outputs.build_windows_skip_job }}
build_windows_skip_cache_key: ${{ steps.set_cache.outputs.build_windows_skip_cache_key }}
release_skip_job: ${{ steps.set_ouputs.outputs.release_skip_job }}
# }}}
# Job: Test (Linux) {{{
test_linux:
name: Test (Linux)
runs-on: ubuntu-22.04
needs: [analyze, ]
if: >-
!cancelled()
&& needs.analyze.outputs.test_linux_skip_job == 'no'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Set cache name
id: set_cache
run: setup_cache_name '3.9' 'ubuntu-22.04'
- name: Setup cache
uses: actions/cache@v3
with:
path: .cache
key: 0_${{ steps.set_cache.outputs.cache_name }}_${{ hashFiles('reqs/constraints.txt', 'reqs/dist.txt', 'reqs/test.txt') }}
- name: Setup pip options
run: setup_pip_options
- name: Setup Python environment
run: setup_python_env -c reqs/constraints.txt -r reqs/dist.txt -r reqs/test.txt
# Test {{{
- name: Run tests
run: run_tests -p no:pytest-qt --ignore=test/gui_qt
# }}}
- name: Update skip cache 1
uses: actions/cache@v3
with:
path: .skip_cache_test_linux
key: 0_${{ needs.analyze.outputs.test_linux_skip_cache_key }}
- name: Update skip cache 2
run: run_eval "echo 'https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID' >'.skip_cache_test_linux'"
- name: List cache contents
run: list_cache
# }}}
# Job: Test (macOS) {{{
test_macos:
name: Test (macOS)
runs-on: macos-12
needs: [analyze, ]
if: >-
!cancelled()
&& needs.analyze.outputs.test_macos_skip_job == 'no'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set cache name
id: set_cache
run: setup_cache_name '3.9' 'macos-12'
- name: Setup cache
uses: actions/cache@v3
with:
path: .cache
key: 0_${{ steps.set_cache.outputs.cache_name }}_${{ hashFiles('reqs/constraints.txt', 'reqs/dist.txt', 'reqs/test.txt', 'osx/deps.sh') }}
- name: Setup pip options
run: setup_pip_options
# To support older macOS versions, setup Python from an official installer.
- name: Setup Python
run: setup_osx_python '3.9'
- name: Setup Python environment
run: setup_python_env -c reqs/constraints.txt -r reqs/dist.txt -r reqs/test.txt
# Test {{{
- name: Run tests
run: run_tests -p no:pytest-qt --ignore=test/gui_qt
# }}}
- name: Update skip cache 1
uses: actions/cache@v3
with:
path: .skip_cache_test_macos
key: 0_${{ needs.analyze.outputs.test_macos_skip_cache_key }}
- name: Update skip cache 2
run: run_eval "echo 'https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID' >'.skip_cache_test_macos'"
- name: List cache contents
run: list_cache
# }}}
# Job: Test (Windows) {{{
test_windows:
name: Test (Windows)
runs-on: windows-2022
needs: [analyze, ]
if: >-
!cancelled()
&& needs.analyze.outputs.test_windows_skip_job == 'no'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
# On Windows, ensure we use a tar compatible
# with the one used in the analyze job.
- name: Fix tar
run: rm C:/Windows/System32/tar
- name: Set cache name
id: set_cache
run: setup_cache_name '3.9' 'windows-2022'
- name: Setup cache
uses: actions/cache@v3
with:
path: .cache
key: 0_${{ steps.set_cache.outputs.cache_name }}_${{ hashFiles('reqs/constraints.txt', 'reqs/dist.txt', 'reqs/test.txt') }}
- name: Setup pip options
run: setup_pip_options
- name: Setup Python environment
run: setup_python_env -c reqs/constraints.txt -r reqs/dist.txt -r reqs/test.txt
# Test {{{
- name: Run tests
run: run_tests -p no:pytest-qt --ignore=test/gui_qt
# }}}
- name: Update skip cache 1
uses: actions/cache@v3
with:
path: .skip_cache_test_windows
key: 0_${{ needs.analyze.outputs.test_windows_skip_cache_key }}
- name: Update skip cache 2
run: run_eval "echo 'https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID' >'.skip_cache_test_windows'"
- name: List cache contents
run: list_cache
# }}}
# Job: Test (Python 3.8) {{{
test_python_38:
name: Test (Python 3.8)
runs-on: ubuntu-latest
needs: [analyze, ]
if: >-
!cancelled()
&& needs.analyze.outputs.test_python_38_skip_job == 'no'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Set cache name
id: set_cache
run: setup_cache_name '3.8' 'ubuntu-latest'
- name: Setup cache
uses: actions/cache@v3
with:
path: .cache
key: 0_${{ steps.set_cache.outputs.cache_name }}_${{ hashFiles('reqs/constraints.txt', 'reqs/dist.txt', 'reqs/test.txt') }}
- name: Setup pip options
run: setup_pip_options
- name: Setup Python environment
run: setup_python_env -c reqs/constraints.txt -r reqs/dist.txt -r reqs/test.txt
# Test {{{
- name: Run tests
run: run_tests -p no:pytest-qt --ignore=test/gui_qt
# }}}
- name: Update skip cache 1
uses: actions/cache@v3
with:
path: .skip_cache_test_python_38
key: 0_${{ needs.analyze.outputs.test_python_38_skip_cache_key }}
- name: Update skip cache 2
run: run_eval "echo 'https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID' >'.skip_cache_test_python_38'"
- name: List cache contents
run: list_cache
# }}}
# Job: Test (Python 3.10) {{{
test_python_310:
name: Test (Python 3.10)
runs-on: ubuntu-latest
needs: [analyze, ]
if: >-
!cancelled()
&& needs.analyze.outputs.test_python_310_skip_job == 'no'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Set cache name
id: set_cache
run: setup_cache_name '3.10' 'ubuntu-latest'
- name: Setup cache
uses: actions/cache@v3
with:
path: .cache
key: 0_${{ steps.set_cache.outputs.cache_name }}_${{ hashFiles('reqs/constraints.txt', 'reqs/dist.txt', 'reqs/test.txt') }}
- name: Setup pip options
run: setup_pip_options
- name: Setup Python environment
run: setup_python_env -c reqs/constraints.txt -r reqs/dist.txt -r reqs/test.txt
# Test {{{
- name: Run tests
run: run_tests -p no:pytest-qt --ignore=test/gui_qt
# }}}
- name: Update skip cache 1
uses: actions/cache@v3
with:
path: .skip_cache_test_python_310
key: 0_${{ needs.analyze.outputs.test_python_310_skip_cache_key }}
- name: Update skip cache 2
run: run_eval "echo 'https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID' >'.skip_cache_test_python_310'"
- name: List cache contents
run: list_cache
# }}}
# Job: Test (Qt GUI) {{{
test_qt_gui:
name: Test (Qt GUI)
runs-on: ubuntu-22.04
needs: [analyze, ]
if: >-
!cancelled()
&& needs.analyze.outputs.test_qt_gui_skip_job == 'no'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Set cache name
id: set_cache
run: setup_cache_name '3.9' 'ubuntu-22.04'
- name: Setup cache
uses: actions/cache@v3
with:
path: .cache
key: 0_${{ steps.set_cache.outputs.cache_name }}_${{ hashFiles('reqs/constraints.txt', 'reqs/dist.txt', 'reqs/dist_extra_gui_qt.txt', 'reqs/test.txt') }}
- name: Setup pip options
run: setup_pip_options
- name: Setup Python environment
run: setup_python_env -c reqs/constraints.txt -r reqs/dist.txt -r reqs/dist_extra_gui_qt.txt -r reqs/test.txt
- name: Build UI
run: python setup.py build_ui
# Test {{{
- name: Run tests
run: run_tests test/gui_qt
# }}}
- name: Update skip cache 1
uses: actions/cache@v3
with:
path: .skip_cache_test_qt_gui
key: 0_${{ needs.analyze.outputs.test_qt_gui_skip_cache_key }}
- name: Update skip cache 2
run: run_eval "echo 'https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID' >'.skip_cache_test_qt_gui'"
- name: List cache contents
run: list_cache
# }}}
# Job: Test (Packaging) {{{
test_packaging:
name: Test (Packaging)
runs-on: ubuntu-latest
needs: [analyze, ]
if: >-
!cancelled()
&& needs.analyze.outputs.test_packaging_skip_job == 'no'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# We need the whole history for patching the version.
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Set cache name
id: set_cache
run: setup_cache_name '3.9' 'ubuntu-latest'
- name: Setup cache
uses: actions/cache@v3
with:
path: .cache
key: 0_${{ steps.set_cache.outputs.cache_name }}_${{ hashFiles('reqs/constraints.txt', 'reqs/packaging.txt', 'reqs/setup.txt') }}
- name: Setup pip options
run: setup_pip_options
- name: Setup Python environment
run: setup_python_env -c reqs/constraints.txt -r reqs/packaging.txt -r reqs/setup.txt
- name: Patch version
id: set_version
run: |
python setup.py patch_version
echo "version=$(python setup.py --version)" >> $GITHUB_OUTPUT
# Test packaging {{{
- name: Run packaging sanity checks
run: packaging_checks
- name: Archive artifact (sdist)
if: needs.analyze.outputs.is_release == 'yes'
uses: actions/upload-artifact@v3
with:
name: Source
path: dist/*.tar.gz
- name: Archive artifact (wheel)
if: needs.analyze.outputs.is_release == 'yes'
uses: actions/upload-artifact@v3
with:
name: Wheel
path: dist/*.whl
- name: Generate translations catalogs archive
if: needs.analyze.outputs.is_release == 'yes'
run: generate_translations_catalogs_archive
- name: Archive artifact (translations catalogs)
if: needs.analyze.outputs.is_release == 'yes'
uses: actions/upload-artifact@v3
with:
name: Translations Catalogs
path: dist/*-messages.zip
# }}}
- name: Update skip cache 1
uses: actions/cache@v3
with:
path: .skip_cache_test_packaging
key: 0_${{ needs.analyze.outputs.test_packaging_skip_cache_key }}
- name: Update skip cache 2
run: run_eval "echo 'https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID' >'.skip_cache_test_packaging'"
- name: List cache contents
run: list_cache
outputs:
version: ${{ steps.set_version.outputs.version }}
# }}}
# Job: Build (Linux) {{{
build_linux:
name: Build (Linux)
runs-on: ubuntu-22.04
needs: [analyze, test_linux]
if: >-
!cancelled()
&& (needs.test_linux.result == 'success' || needs.test_linux.result == 'skipped')
&& needs.analyze.outputs.build_linux_skip_job == 'no'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# We need the whole history for patching the version.
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Set cache name
id: set_cache
run: setup_cache_name '3.9' 'ubuntu-22.04'
- name: Setup cache
uses: actions/cache@v3
with:
path: .cache
key: 0_${{ steps.set_cache.outputs.cache_name }}_${{ hashFiles('reqs/constraints.txt', 'reqs/build.txt', 'reqs/setup.txt', 'reqs/dist_*.txt', 'linux/appimage/deps.sh') }}
- name: Setup pip options
run: setup_pip_options
- name: Install system dependencies
run: apt_get_install libdbus-1-dev libdbus-glib-1-dev libudev-dev libusb-1.0-0-dev
- name: Setup Python environment
run: setup_python_env -c reqs/constraints.txt -r reqs/build.txt -r reqs/setup.txt
- name: Patch version
id: set_version
run: |
python setup.py patch_version
# Build {{{
- name: Build distribution (Linux AppImage)
run: python setup.py -q bdist_appimage --no-update-tools
- name: Archive artifact (Linux AppImage)
uses: actions/upload-artifact@v3
with:
name: Linux AppImage
path: dist/*.AppImage
# }}}
- name: Update skip cache 1
uses: actions/cache@v3
with:
path: .skip_cache_build_linux
key: 0_${{ needs.analyze.outputs.build_linux_skip_cache_key }}
- name: Update skip cache 2
run: run_eval "echo 'https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID' >'.skip_cache_build_linux'"
- name: List cache contents
run: list_cache
# }}}
# Job: Build (macOS) {{{
build_macos:
name: Build (macOS)
runs-on: macos-12
needs: [analyze, test_macos]
if: >-
!cancelled()
&& (needs.test_macos.result == 'success' || needs.test_macos.result == 'skipped')
&& needs.analyze.outputs.build_macos_skip_job == 'no'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# We need the whole history for patching the version.
fetch-depth: 0
- name: Set cache name
id: set_cache
run: setup_cache_name '3.9' 'macos-12'
- name: Setup cache
uses: actions/cache@v3
with:
path: .cache
key: 0_${{ steps.set_cache.outputs.cache_name }}_${{ hashFiles('reqs/constraints.txt', 'reqs/build.txt', 'reqs/setup.txt', 'reqs/dist_*.txt', 'osx/deps.sh') }}
- name: Setup pip options
run: setup_pip_options
# To support older macOS versions, setup Python from an official installer.
- name: Setup Python
run: setup_osx_python '3.9'
- name: Setup Python environment
run: setup_python_env -c reqs/constraints.txt -r reqs/build.txt -r reqs/setup.txt
- name: Patch version
id: set_version
run: |
python setup.py patch_version
# Build {{{
- name: Build distribution (macOS DMG)
run: python setup.py -q bdist_dmg
- name: Archive artifact (macOS DMG)
uses: actions/upload-artifact@v3
with:
name: macOS DMG
path: dist/*.dmg
# }}}
- name: Update skip cache 1
uses: actions/cache@v3
with:
path: .skip_cache_build_macos
key: 0_${{ needs.analyze.outputs.build_macos_skip_cache_key }}
- name: Update skip cache 2
run: run_eval "echo 'https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID' >'.skip_cache_build_macos'"
- name: List cache contents
run: list_cache
# }}}
# Job: Build (Windows) {{{
build_windows:
name: Build (Windows)
runs-on: windows-2022
needs: [analyze, test_windows]
if: >-
!cancelled()
&& (needs.test_windows.result == 'success' || needs.test_windows.result == 'skipped')
&& needs.analyze.outputs.build_windows_skip_job == 'no'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# We need the whole history for patching the version.
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
# On Windows, ensure we use a tar compatible
# with the one used in the analyze job.
- name: Fix tar
run: rm C:/Windows/System32/tar
- name: Set cache name
id: set_cache
run: setup_cache_name '3.9' 'windows-2022'
- name: Setup cache
uses: actions/cache@v3
with:
path: .cache
key: 0_${{ steps.set_cache.outputs.cache_name }}_${{ hashFiles('reqs/constraints.txt', 'reqs/build.txt', 'reqs/setup.txt', 'reqs/dist_*.txt', 'windows/dist_deps.sh') }}
- name: Setup pip options
run: setup_pip_options
- name: Setup Python environment
run: setup_python_env -c reqs/constraints.txt -r reqs/build.txt -r reqs/setup.txt
- name: Patch version
id: set_version
run: |
python setup.py patch_version
# Build {{{
- name: Build distributions (Windows)
run: |
# Note: we avoid using the WSL bash (which does not work).
bash="$(cygpath -w -a "$(which bash)")"
python setup.py -q bdist_win -t -z -i --bash="$bash"
- name: Archive artifact (Windows Installer)
uses: actions/upload-artifact@v3
with:
name: Windows Installer
path: dist/*.exe
- name: Archive artifact (Windows ZIP)
uses: actions/upload-artifact@v3
with:
name: Windows ZIP
path: dist/*.zip
# }}}
- name: Update skip cache 1
uses: actions/cache@v3
with:
path: .skip_cache_build_windows
key: 0_${{ needs.analyze.outputs.build_windows_skip_cache_key }}
- name: Update skip cache 2
run: run_eval "echo 'https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID' >'.skip_cache_build_windows'"
- name: List cache contents
run: list_cache
# }}}
# Job: Release {{{
release:
name: Release
environment: release
runs-on: ubuntu-latest
needs: [analyze, test_linux, test_macos, test_windows, test_python_38, test_python_310, test_qt_gui, test_packaging, build_linux, build_macos, build_windows]
if: >-
!cancelled()
&& needs.test_linux.result == 'success'
&& needs.test_macos.result == 'success'
&& needs.test_windows.result == 'success'
&& needs.test_python_38.result == 'success'
&& needs.test_python_310.result == 'success'
&& needs.test_qt_gui.result == 'success'
&& needs.test_packaging.result == 'success'
&& needs.build_linux.result == 'success'
&& needs.build_macos.result == 'success'
&& needs.build_windows.result == 'success'
&& needs.analyze.outputs.release_skip_job == 'no'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
run: |
run apt_get_install -qq pandoc
run "$python" -m pip install -c reqs/constraints.txt -r reqs/release.txt
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: dist
- name: Publish PyPI release
if: needs.analyze.outputs.release_type == 'tagged'
env:
TWINE_NON_INTERACTIVE: 1
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
# Optional: twine will fallback to default if empty.
TWINE_REPOSITORY_URL: ${{ secrets.PYPI_URL }}
run: publish_pypi_release
- name: Publish GitHub release (${{ needs.analyze.outputs.release_type }})
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TYPE: ${{ needs.analyze.outputs.release_type }}
RELEASE_VERSION: ${{ needs.test_packaging.outputs.version }}
run: publish_github_release
# }}}
# vim: foldmethod=marker foldlevel=0