File: ci.yml

package info (click to toggle)
boost1.90 1.90.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 593,120 kB
  • sloc: cpp: 4,190,908; xml: 196,648; python: 34,618; ansic: 23,145; asm: 5,468; sh: 3,774; makefile: 1,161; perl: 1,020; sql: 728; ruby: 676; yacc: 478; java: 77; lisp: 24; csh: 6
file content (1045 lines) | stat: -rw-r--r-- 38,302 bytes parent folder | download | duplicates (3)
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
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
# Copyright 2021-2025 Andrey Semashev
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)

name: CI

on:
  pull_request:
  push:
    branches:
      - master
      - develop
      - feature/**

concurrency:
  group: ${{format('{0}:{1}', github.repository, github.ref)}}
  cancel-in-progress: true

env:
  GIT_FETCH_JOBS: 8
  NET_RETRY_COUNT: 5
  DEFAULT_BUILD_VARIANT: debug,release
  # Note: Various clang versions exhibit problems like ICEs, code miscompiles and timeouts if we use "native" here.
  DEFAULT_INSTRUCTION_SET: sandy-bridge

jobs:
  posix:
    defaults:
      run:
        shell: bash

    strategy:
      fail-fast: false
      matrix:
        include:
          # Note: In the matrix below, we always use a Docker container when we test 32-bit targets since the host runner
          # does not have permissions to configure dpkg/apt, which prevents adding i386 target architecture.
          # Linux, gcc
          - toolset: gcc-4.8
            cxxstd64: "11,1y"
            cxxstd32: "11"
            os: ubuntu-latest
            container: ubuntu:18.04
            install:
              - g++-4.8
              - g++-4.8-multilib
              - linux-libc-dev:i386
          - toolset: gcc-4.9
            cxxstd64: "11,14"
            cxxstd32: "11"
            os: ubuntu-latest
            container: ubuntu:16.04
            install:
              - g++-4.9
              - g++-4.9-multilib
              - linux-libc-dev:i386
          - toolset: gcc-5
            cxxstd64: "11,14,1z"
            cxxstd32: "11"
            os: ubuntu-latest
            container: ubuntu:18.04
            install:
              - g++-5
              - g++-5-multilib
              - linux-libc-dev:i386
          - toolset: gcc-6
            cxxstd64: "11,14,1z"
            cxxstd32: "11"
            os: ubuntu-latest
            container: ubuntu:18.04
            install:
              - g++-6
              - g++-6-multilib
              - linux-libc-dev:i386
          - toolset: gcc-7
            cxxstd64: "11,14,17"
            cxxstd32: "11"
            os: ubuntu-latest
            container: ubuntu:20.04
            install:
              - g++-7
              - g++-7-multilib
              - linux-libc-dev:i386
          - toolset: gcc-8
            cxxstd64: "11,14,17,2a,11-gnu,14-gnu,17-gnu,2a-gnu"
            cxxstd32: "11,11-gnu"
            os: ubuntu-latest
            container: ubuntu:20.04
            install:
              - g++-8
              - g++-8-multilib
              - linux-libc-dev:i386
          - toolset: gcc-9
            cxxstd64: "11,14,17,2a,11-gnu,14-gnu,17-gnu,2a-gnu"
            cxxstd32: "11,11-gnu"
            os: ubuntu-latest
            container: ubuntu:20.04
            install:
              - g++-9
              - g++-9-multilib
              - linux-libc-dev:i386
          - toolset: gcc-10
            cxxstd64: "11,14,17,20,11-gnu,14-gnu,17-gnu,20-gnu"
            cxxstd32: "11,11-gnu"
            os: ubuntu-latest
            container: ubuntu:20.04
            install:
              - g++-10
              - g++-10-multilib
              - linux-libc-dev:i386
          - toolset: gcc-11
            cxxstd64: "11,14,17,20,23,11-gnu,14-gnu,17-gnu,20-gnu,23-gnu"
            cxxstd32: "11,11-gnu"
            os: ubuntu-latest
            container: ubuntu:22.04
            install:
              - g++-11
              - g++-11-multilib
              - linux-libc-dev:i386
          - toolset: gcc-12
            cxxstd64: "11,14,17,20,23,11-gnu,14-gnu,17-gnu,20-gnu,23-gnu"
            cxxstd32: "11,11-gnu"
            os: ubuntu-latest
            container: ubuntu:22.04
            install:
              - g++-12
              - g++-12-multilib
              - linux-libc-dev:i386
          - toolset: gcc-13
            cxxstd64: "11,14,17,20,23,11-gnu,14-gnu,17-gnu,20-gnu,23-gnu"
            cxxstd32: "11,11-gnu"
            os: ubuntu-latest
            container: ubuntu:24.04
            install:
              - g++-13
              - g++-13-multilib
              - linux-libc-dev:i386
          - toolset: gcc-14
            cxxstd64: "11,14,17,20,23,26,11-gnu,14-gnu,17-gnu,20-gnu,23-gnu,26-gnu"
            cxxstd32: "11,11-gnu"
            os: ubuntu-latest
            container: ubuntu:24.04
            install:
              - g++-14
              - g++-14-multilib
              - linux-libc-dev:i386
          - toolset: gcc-15
            cxxstd64: "11,14,17,20,23,26,11-gnu,14-gnu,17-gnu,20-gnu,23-gnu,26-gnu"
            cxxstd32: "11,11-gnu"
            os: ubuntu-latest
            container: ubuntu:25.04
            install:
              - g++-15
              - g++-15-multilib
              - linux-libc-dev:i386
          - name: UBSAN
            toolset: gcc-13
            cxxstd64: "11,14,17,20,23,11-gnu,14-gnu,17-gnu,20-gnu,23-gnu"
            cxxstd32: "11,11-gnu"
            ubsan: 1
            build_variant: debug
            os: ubuntu-latest
            container: ubuntu:24.04
            install:
              - g++-13
              - g++-13-multilib
              - linux-libc-dev:i386
          - name: TSAN
            toolset: gcc-13
            cxxstd64: "11,14,17,20,23,11-gnu,14-gnu,17-gnu,20-gnu,23-gnu"
            tsan: 1
            build_variant: debug
            os: ubuntu-latest
            container: ubuntu:24.04
            install:
              - g++-13
              - g++-13-multilib

          # Linux, clang
          - toolset: clang
            compiler: clang++-3.9
            cxxstd64: "11,14"
            cxxstd32: "11"
            os: ubuntu-latest
            container: ubuntu:18.04
            install:
              - clang-3.9
              - g++-6
              - g++-6-multilib
              - linux-libc-dev:i386
            gcc_toolchain: 6
          - toolset: clang
            compiler: clang++-4.0
            cxxstd64: "11,14"
            cxxstd32: "11"
            os: ubuntu-latest
            container: ubuntu:18.04
            install:
              - clang-4.0
              - g++-6
              - g++-6-multilib
              - linux-libc-dev:i386
            gcc_toolchain: 6
          # Note: clang-5 fails int128 tests on 64-bit x86 target and float128 tests on 32-bit x86 target for some unknown reason. Does not reproduce locally.
          - toolset: clang
            compiler: clang++-5.0
            cxxstd64: "11,14,1z"
            cxxstd32: "11"
            cxxflags: -DBOOST_ATOMIC_TESTS_NO_INT128 -DBOOST_ATOMIC_TESTS_NO_FLOAT128
            os: ubuntu-latest
            container: ubuntu:18.04
            install:
              - clang-5.0
              - g++-7
              - g++-7-multilib
              - linux-libc-dev:i386
            gcc_toolchain: 7
          - toolset: clang
            compiler: clang++-6.0
            cxxstd64: "11,14,17"
            cxxstd32: "11"
            os: ubuntu-latest
            container: ubuntu:18.04
            install:
              - clang-6.0
              - g++-8
              - g++-8-multilib
              - linux-libc-dev:i386
            gcc_toolchain: 8
          - toolset: clang
            compiler: clang++-7
            cxxstd64: "11,14,17"
            cxxstd32: "11"
            os: ubuntu-latest
            container: ubuntu:18.04
            install:
              - clang-7
              - g++-8
              - g++-8-multilib
              - linux-libc-dev:i386
            gcc_toolchain: 8
          # Note: clang-8 does not fully support C++20, so it is not compatible with libstdc++-8 in this mode
          - toolset: clang
            compiler: clang++-8
            cxxstd64: "11,14,17,2a"
            cxxstd32: "11"
            os: ubuntu-latest
            container: ubuntu:18.04
            install:
              - clang-8
              - g++-7
              - g++-7-multilib
              - linux-libc-dev:i386
            gcc_toolchain: 7
          - toolset: clang
            compiler: clang++-9
            cxxstd64: "11,14,17,2a"
            cxxstd32: "11"
            os: ubuntu-latest
            container: ubuntu:20.04
            install:
              - clang-9
              - g++-9
              - g++-9-multilib
              - linux-libc-dev:i386
            gcc_toolchain: 9
          - toolset: clang
            compiler: clang++-10
            cxxstd64: "11,14,17,20,11-gnu,14-gnu,17-gnu,20-gnu"
            cxxstd32: "11,11-gnu"
            os: ubuntu-latest
            container: ubuntu:20.04
            install:
              - clang-10
              - g++-10
              - g++-10-multilib
              - linux-libc-dev:i386
            gcc_toolchain: 10
          - toolset: clang
            compiler: clang++-11
            cxxstd64: "11,14,17,20,11-gnu,14-gnu,17-gnu,20-gnu"
            cxxstd32: "11,11-gnu"
            os: ubuntu-latest
            container: ubuntu:22.04
            install:
              - clang-11
              - g++-10
              - g++-10-multilib
              - linux-libc-dev:i386
            gcc_toolchain: 10
          - toolset: clang
            compiler: clang++-12
            cxxstd64: "11,14,17,20,2b,11-gnu,14-gnu,17-gnu,20-gnu,2b-gnu"
            cxxstd32: "11,11-gnu"
            os: ubuntu-latest
            container: ubuntu:22.04
            install:
              - clang-12
              - g++-11
              - g++-11-multilib
              - linux-libc-dev:i386
            gcc_toolchain: 11
          - toolset: clang
            compiler: clang++-13
            cxxstd64: "11,14,17,20,2b,11-gnu,14-gnu,17-gnu,20-gnu,2b-gnu"
            cxxstd32: "11,11-gnu"
            os: ubuntu-latest
            container: ubuntu:22.04
            install:
              - clang-13
              - g++-11
              - g++-11-multilib
              - linux-libc-dev:i386
            gcc_toolchain: 11
          - toolset: clang
            compiler: clang++-14
            cxxstd64: "11,14,17,20,2b,11-gnu,14-gnu,17-gnu,20-gnu,2b-gnu"
            cxxstd32: "11,11-gnu"
            os: ubuntu-latest
            container: ubuntu:22.04
            install:
              - clang-14
              - g++-11
              - g++-11-multilib
              - linux-libc-dev:i386
            gcc_toolchain: 11
          - toolset: clang
            compiler: clang++-15
            cxxstd64: "11,14,17,20,2b,11-gnu,14-gnu,17-gnu,20-gnu,2b-gnu"
            cxxstd32: "11,11-gnu"
            os: ubuntu-latest
            container: ubuntu:22.04
            install:
              - clang-15
              - g++-11
              - g++-11-multilib
              - linux-libc-dev:i386
            gcc_toolchain: 11
          - toolset: clang
            compiler: clang++-16
            cxxstd64: "11,14,17,20,2b,11-gnu,14-gnu,17-gnu,20-gnu,2b-gnu"
            cxxstd32: "11,11-gnu"
            os: ubuntu-latest
            container: ubuntu:24.04
            install:
              - clang-16
              - g++-11
              - g++-11-multilib
              - linux-libc-dev:i386
            gcc_toolchain: 11
          - toolset: clang
            compiler: clang++-17
            cxxstd64: "11,14,17,20,23,11-gnu,14-gnu,17-gnu,20-gnu,23-gnu"
            cxxstd32: "11,11-gnu"
            os: ubuntu-latest
            container: ubuntu:24.04
            install:
              - clang-17
              - g++-11
              - g++-11-multilib
              - linux-libc-dev:i386
            gcc_toolchain: 11
          - toolset: clang
            compiler: clang++-18
            cxxstd64: "11,14,17,20,23,26,11-gnu,14-gnu,17-gnu,20-gnu,23-gnu,26-gnu"
            cxxstd32: "11,11-gnu"
            os: ubuntu-latest
            container: ubuntu:24.04
            install:
              - clang-18
              - g++-13
              - g++-13-multilib
              - linux-libc-dev:i386
          - toolset: clang
            compiler: clang++-19
            cxxstd64: "11,14,17,20,23,26,11-gnu,14-gnu,17-gnu,20-gnu,23-gnu,26-gnu"
            cxxstd32: "11,11-gnu"
            os: ubuntu-latest
            container: ubuntu:24.04
            install:
              - clang-19
              - g++-13
              - g++-13-multilib
              - linux-libc-dev:i386
          - toolset: clang
            compiler: clang++-20
            cxxstd64: "11,14,17,20,23,26,11-gnu,14-gnu,17-gnu,20-gnu,23-gnu,26-gnu"
            cxxstd32: "11,11-gnu"
            os: ubuntu-latest
            container: ubuntu:25.04
            install:
              - clang-20
              - g++-13
              - g++-13-multilib
              - linux-libc-dev:i386
          - toolset: clang
            compiler: clang++-20
            cxxstd64: "11,14,17,20,23,26"
            cxxflags: -stdlib=libc++
            linkflags: -stdlib=libc++
            os: ubuntu-latest
            container: ubuntu:25.04
            install:
              - clang-20
              - libc++-20-dev
              - libc++abi-20-dev
          - name: UBSAN
            toolset: clang
            compiler: clang++-18
            cxxstd64: "11,14,17,20,23,26,11-gnu,14-gnu,17-gnu,20-gnu,23-gnu,26-gnu"
            cxxflags: -stdlib=libc++
            linkflags: -stdlib=libc++
            ubsan: 1
            build_variant: debug
            os: ubuntu-24.04
            install:
              - clang-18
              - libc++-18-dev
              - libc++abi-18-dev
          - name: TSAN
            toolset: clang
            compiler: clang++-18
            cxxstd64: "11,14,17,20,23,26,11-gnu,14-gnu,17-gnu,20-gnu,23-gnu,26-gnu"
            cxxflags: -stdlib=libc++
            linkflags: -stdlib=libc++
            tsan: 1
            build_variant: debug
            os: ubuntu-24.04
            install:
              - clang-18
              - libc++-18-dev
              - libc++abi-18-dev

          - name: ARM
            toolset: gcc-13
            cxxstd64: "11,14,17,20,23,11-gnu,14-gnu,17-gnu,20-gnu,23-gnu"
            cxxstd32: "11,11-gnu"
            instruction_set: "-"
            os: ubuntu-24.04-arm
            container: ubuntu:24.04
            install:
              - g++-13

          - toolset: clang
            vm: freebsd
            version: "14.3"
            cxxstd64: "11,14,17,20,23,26"
            os: ubuntu-latest

          - toolset: clang
            vm: openbsd
            version: "7.7"
            cxxstd64: "11,14,17,20,2b"
            os: ubuntu-latest

          - toolset: gcc
            vm: netbsd
            version: "10.1"
            cxxstd64: "11,14,17,20"
            os: ubuntu-latest

          - toolset: gcc
            vm: dragonflybsd
            version: "6.4.0"
            cxxstd64: "11,14,17,2a"
            os: ubuntu-latest

          - toolset: gcc
            vm: solaris
            version: "11.4-gcc"
            cxxstd64: "11,14,17,20,23,26"
            os: ubuntu-latest

          - toolset: clang
            os: macos-13
            cxxstd64: "11,14,17,20,2b"
            instruction_set: "-"
          - toolset: clang
            os: macos-14
            cxxstd64: "11,14,17,20,2b"
            instruction_set: "-"

          - toolset: clang
            os: macos-latest
            cxxstd64: "11,14,17,20,2b"
            instruction_set: "-"
            macosx_version_min: 11

          - name: CMake tests
            cmake_tests: 1
            os: ubuntu-22.04

    timeout-minutes: 30
    runs-on: ${{matrix.os}}
    container: ${{matrix.container}}

    steps:
      - name: Setup environment
        run: |
            if [ -f "/etc/debian_version" ]
            then
                echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV
                export DEBIAN_FRONTEND=noninteractive
                if [ -n "${{matrix.cxxstd32}}" -a "$(dpkg --print-architecture)" = "amd64" -a -z "$(dpkg --print-foreign-architectures | fgrep i386)" ]
                then
                    dpkg --add-architecture i386
                fi
            fi
            if [ -n "${{matrix.container}}" ]
            then
                echo "GHA_CONTAINER=${{matrix.container}}" >> $GITHUB_ENV
                if [ -f "/etc/debian_version" ]
                then
                    # Use Azure APT mirrors in containers to avoid HTTP errors due to DDoS filters triggered by lots of CI jobs launching concurrently.
                    # Note that not all Ubuntu versions support "mirror+file:..." URIs in APT sources, so just use Azure mirrors exclusively.
                    # Note also that on recent Ubuntu versions DEB822 format is used for source files.
                    APT_SOURCES=()
                    if [ -d "/etc/apt/sources.list.d" ]
                    then
                        readarray -t APT_SOURCES < <(find "/etc/apt/sources.list.d" -type f -name '*.sources' -print)
                    fi
                    if [ -f "/etc/apt/sources.list" ]
                    then
                        APT_SOURCES+=("/etc/apt/sources.list")
                    fi
                    if [ "${#APT_SOURCES[@]}" -gt 0 ]
                    then
                        sed -i -E -e 's!([^ ]+) (http|https)://(archive|security)\.ubuntu\.com/ubuntu[^ ]*(.*)!\1 http://azure.archive.ubuntu.com/ubuntu/\4!' "${APT_SOURCES[@]}"
                    fi
                    apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
                    if [ "$(apt-cache search "^python-is-python3$" | wc -l)" -ne 0 ]
                    then
                        PYTHON_PACKAGE="python-is-python3"
                    else
                        PYTHON_PACKAGE="python"
                    fi
                    apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common tzdata wget curl apt-transport-https ca-certificates make build-essential g++ $PYTHON_PACKAGE python3 perl git cmake
                fi
            fi
            if [ -n "${{matrix.macosx_version_min}}" -a -d "/Library/Developer/CommandLineTools/SDKs" ]
            then
                echo "Available MacOS SDKs:"
                ls "/Library/Developer/CommandLineTools/SDKs"
            fi
            git config --global pack.threads 0

      - name: Install packages
        if: matrix.install
        run: |
            declare -a SOURCE_KEYS SOURCES
            if [ -n "${{join(matrix.source_keys, ' ')}}" ]
            then
                SOURCE_KEYS=("${{join(matrix.source_keys, '" "')}}")
            fi
            if [ -n "${{join(matrix.sources, ' ')}}" ]
            then
                SOURCES=("${{join(matrix.sources, '" "')}}")
            fi
            for key in "${SOURCE_KEYS[@]}"
            do
                for i in {1..$NET_RETRY_COUNT}
                do
                    echo "Adding key: $key"
                    wget -O - "$key" | sudo apt-key add - && break || sleep 2
                done
            done
            if [ ${#SOURCES[@]} -gt 0 ]
            then
                APT_ADD_REPO_COMMON_ARGS=("-y")
                APT_ADD_REPO_SUPPORTED_ARGS="$(apt-add-repository --help | perl -ne 'if (/^\s*-n/) { print "n"; } elsif (/^\s*-P/) { print "P"; } elsif (/^\s*-S/) { print "S"; } elsif (/^\s*-U/) { print "U"; }')"
                if [ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*n*}" ]
                then
                    APT_ADD_REPO_COMMON_ARGS+=("-n")
                fi
                APT_ADD_REPO_HAS_SOURCE_ARGS="$([ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*P*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*S*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*U*}" ] && echo 1 || echo 0)"
                for source in "${SOURCES[@]}"
                do
                    for i in {1..$NET_RETRY_COUNT}
                    do
                        APT_ADD_REPO_ARGS=("${APT_ADD_REPO_COMMON_ARGS[@]}")
                        if [ $APT_ADD_REPO_HAS_SOURCE_ARGS -ne 0 ]
                        then
                            case "$source" in
                            "ppa:"*)
                                APT_ADD_REPO_ARGS+=("-P")
                                ;;
                            "deb "*)
                                APT_ADD_REPO_ARGS+=("-S")
                                ;;
                            *)
                                APT_ADD_REPO_ARGS+=("-U")
                                ;;
                            esac
                        fi
                        APT_ADD_REPO_ARGS+=("$source")
                        echo "apt-add-repository ${APT_ADD_REPO_ARGS[@]}"
                        sudo -E apt-add-repository "${APT_ADD_REPO_ARGS[@]}" && break || sleep 2
                    done
                done
            fi
            sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
            sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y ${{join(matrix.install, ' ')}}

      - name: Setup GCC Toolchain
        if: matrix.gcc_toolchain
        run: |
            GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain"
            echo "GCC_TOOLCHAIN_ROOT=\"$GCC_TOOLCHAIN_ROOT\"" >> $GITHUB_ENV
            MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)"
            mkdir -p "$GCC_TOOLCHAIN_ROOT"
            ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include"
            ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin"
            mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET"
            ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}"

      - name: Setup Boost
        run: |
            echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
            LIBRARY=${GITHUB_REPOSITORY#*/}
            echo LIBRARY: $LIBRARY
            echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
            echo GITHUB_BASE_REF: $GITHUB_BASE_REF
            echo GITHUB_REF: $GITHUB_REF
            REF=${GITHUB_BASE_REF:-$GITHUB_REF}
            REF=${REF#refs/heads/}
            echo REF: $REF
            BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true
            echo BOOST_BRANCH: $BOOST_BRANCH
            BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null)
            echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV
            echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV
            DEPINST_ARGS=()
            GIT_VERSION="$(git --version | sed -e 's/git version //')"
            GIT_HAS_JOBS=1
            if [ -f "/etc/debian_version" ]
            then
                if $(dpkg --compare-versions "$GIT_VERSION" lt 2.8.0)
                then
                    GIT_HAS_JOBS=0
                fi
            else
                declare -a GIT_VER=(${GIT_VERSION//./ })
                declare -a GIT_MIN_VER=(2 8 0)
                for ((i=0; i<${#GIT_VER[@]}; i++))
                do
                    if [ -z "${GIT_MIN_VER[i]}" ]
                    then
                        GIT_MIN_VER[i]=0
                    fi
                    if [ "${GIT_VER[i]}" -lt "${GIT_MIN_VER[i]}" ]
                    then
                        GIT_HAS_JOBS=0
                        break
                    fi
                done
            fi
            if [ "$GIT_HAS_JOBS" -ne 0 ]
            then
                DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS")
            fi
            mkdir -p snapshot
            cd snapshot
            echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
            curl -L --retry "$NET_RETRY_COUNT" -o "${LIBRARY}-${GITHUB_SHA}.tar.gz" "https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
            tar -xf "${LIBRARY}-${GITHUB_SHA}.tar.gz"
            if [ ! -d "${LIBRARY}-${GITHUB_SHA}" ]
            then
                echo "Library snapshot does not contain the library directory ${LIBRARY}-${GITHUB_SHA}:"
                ls -la
                exit 1
            fi
            rm -f "${LIBRARY}-${GITHUB_SHA}.tar.gz"
            cd ..
            git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root"
            cd boost-root
            mkdir -p libs
            rm -rf "libs/$LIBRARY"
            mv -f "../snapshot/${LIBRARY}-${GITHUB_SHA}" "libs/$LIBRARY"
            rm -rf "../snapshot"
            git submodule update --init tools/boostdep
            DEPINST_ARGS+=("$LIBRARY")
            python tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}"
            rm -rf ".git"
            cd ..
            cat > b2-run-tests.sh << "EOF"
            #!/usr/bin/env bash
            set -e
            cd boost-root
            ./bootstrap.sh
            ./b2 headers
            if [ -n "${{matrix.compiler}}" -o -n "$GCC_TOOLCHAIN_ROOT" ]
            then
                echo -n "using ${{matrix.toolset}} : : ${{matrix.compiler}}" > ~/user-config.jam
                if [ -n "$GCC_TOOLCHAIN_ROOT" ]
                then
                    echo -n " : <compileflags>\"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\" <linkflags>\"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\"" >> ~/user-config.jam
                fi
                echo " ;" >> ~/user-config.jam
            fi
            B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}")
            if [ -n "${{matrix.build_variant}}" ]
            then
                B2_ARGS+=("variant=${{matrix.build_variant}}")
            else
                B2_ARGS+=("variant=$DEFAULT_BUILD_VARIANT")
            fi
            if [ -n "${{matrix.ubsan}}" ]
            then
                export UBSAN_OPTIONS="print_stacktrace=1"
                B2_ARGS+=("cxxflags=-fsanitize=undefined -fno-sanitize-recover=undefined" "linkflags=-fsanitize=undefined -fuse-ld=gold" "define=UBSAN=1" "debug-symbols=on" "visibility=global")
            fi
            if [ -n "${{matrix.tsan}}" ]
            then
                B2_ARGS+=("cxxflags=-fsanitize=thread" "linkflags=-fsanitize=thread -fuse-ld=gold" "define=TSAN=1" "debug-symbols=on" "visibility=global")
            fi
            if [ -n "${{matrix.cxxflags}}" ]
            then
                B2_ARGS+=("cxxflags=${{matrix.cxxflags}}")
            fi
            if [ -n "${{matrix.linkflags}}" ]
            then
                B2_ARGS+=("linkflags=${{matrix.linkflags}}")
            fi
            if [ -n "${{matrix.instruction_set}}" ]
            then
                if [ "${{matrix.instruction_set}}" != "-" ]
                then
                    B2_ARGS+=("instruction-set=${{matrix.instruction_set}}")
                fi
            elif [ -n "$DEFAULT_INSTRUCTION_SET" ]
            then
                B2_ARGS+=("instruction-set=$DEFAULT_INSTRUCTION_SET")
            fi
            if [ -n "${{matrix.macosx_version_min}}" ]
            then
                export MACOSX_DEPLOYMENT_TARGET="${{matrix.macosx_version_min}}"
            fi
            if [ -n "${{matrix.cxxstd64}}" ]
            then
                echo ""
                echo "Running 64-bit tests..."
                echo "======================="
                echo ""
                ./b2 "${B2_ARGS[@]}" "address-model=64" "cxxstd=${{matrix.cxxstd64}}" "libs/$LIBRARY/test"
            fi
            if [ -n "${{matrix.cxxstd32}}" ]
            then
                echo ""
                echo "Running 32-bit tests..."
                echo "======================="
                echo ""
                ./b2 "${B2_ARGS[@]}" "address-model=32" "cxxstd=${{matrix.cxxstd32}}" "libs/$LIBRARY/test"
            fi
            EOF
            chmod +x b2-run-tests.sh

      # Note: The VMs must be created after the workspace is fully prepared, as it will be copied to the VM only once
      - name: Setup FreeBSD VM
        if: matrix.vm == 'freebsd'
        uses: vmactions/freebsd-vm@v1
        with:
          release: "${{matrix.version}}"
          usesh: true
          sync: rsync
          copyback: false
          envs: "LIBRARY DEFAULT_BUILD_VARIANT DEFAULT_INSTRUCTION_SET BUILD_JOBS GCC_TOOLCHAIN_ROOT"
          prepare: |
              pkg install -y bash
          run: |
              uname -mrs
              sysctl hw.model
              sysctl hw.ncpu
              sysctl hw.physmem
              sysctl hw.usermem
              pwd
              ls -la

      - name: Setup OpenBSD VM
        if: matrix.vm == 'openbsd'
        uses: vmactions/openbsd-vm@v1
        with:
          release: "${{matrix.version}}"
          usesh: true
          sync: rsync
          copyback: false
          envs: "LIBRARY DEFAULT_BUILD_VARIANT DEFAULT_INSTRUCTION_SET BUILD_JOBS GCC_TOOLCHAIN_ROOT"
          prepare: |
              pkg_add bash
          run: |
              uname -mrs
              sysctl hw.model
              sysctl hw.ncpu
              sysctl hw.physmem
              sysctl hw.usermem
              pwd
              ls -la

      - name: Setup NetBSD VM
        if: matrix.vm == 'netbsd'
        uses: vmactions/netbsd-vm@v1
        with:
          release: "${{matrix.version}}"
          usesh: true
          sync: rsync
          copyback: false
          envs: "LIBRARY DEFAULT_BUILD_VARIANT DEFAULT_INSTRUCTION_SET BUILD_JOBS GCC_TOOLCHAIN_ROOT"
          run: |
              uname -mrs
              /sbin/sysctl hw.model
              /sbin/sysctl hw.ncpu
              /sbin/sysctl hw.physmem64
              /sbin/sysctl hw.usermem64
              pwd
              ls -la

      - name: Setup DragonFlyBSD VM
        if: matrix.vm == 'dragonflybsd'
        uses: vmactions/dragonflybsd-vm@v1
        with:
          release: "${{matrix.version}}"
          usesh: true
          sync: rsync
          copyback: false
          envs: "LIBRARY DEFAULT_BUILD_VARIANT DEFAULT_INSTRUCTION_SET BUILD_JOBS GCC_TOOLCHAIN_ROOT"
          prepare: |
              pkg install -y bash
          run: |
              uname -mrs
              sysctl hw.model
              sysctl hw.ncpu
              sysctl hw.physmem
              sysctl hw.usermem
              pwd
              ls -la

      - name: Setup Solaris VM
        if: matrix.vm == 'solaris'
        uses: vmactions/solaris-vm@v1
        with:
          release: "${{matrix.version}}"
          usesh: true
          sync: rsync
          copyback: false
          envs: "LIBRARY DEFAULT_BUILD_VARIANT DEFAULT_INSTRUCTION_SET BUILD_JOBS GCC_TOOLCHAIN_ROOT"
          run: |
              uname -mrs
              pwd
              ls -la

      - name: Run tests (native)
        if: matrix.cmake_tests == '' && matrix.vm == ''
        run: |
            bash ./b2-run-tests.sh

      - name: Run tests (FreeBSD VM)
        if: matrix.cmake_tests == '' && matrix.vm == 'freebsd'
        shell: freebsd {0}
        run: |
            cd "$GITHUB_WORKSPACE"
            bash ./b2-run-tests.sh

      - name: Run tests (OpenBSD VM)
        if: matrix.cmake_tests == '' && matrix.vm == 'openbsd'
        shell: openbsd {0}
        run: |
            cd "$GITHUB_WORKSPACE"
            bash ./b2-run-tests.sh

      - name: Run tests (NetBSD VM)
        if: matrix.cmake_tests == '' && matrix.vm == 'netbsd'
        shell: netbsd {0}
        run: |
            cd "$GITHUB_WORKSPACE"
            bash ./b2-run-tests.sh

      - name: Run tests (DragonFlyBSD VM)
        if: matrix.cmake_tests == '' && matrix.vm == 'dragonflybsd'
        shell: dragonflybsd {0}
        run: |
            cd "$GITHUB_WORKSPACE"
            bash ./b2-run-tests.sh

      - name: Run tests (Solaris VM)
        if: matrix.cmake_tests == '' && matrix.vm == 'solaris'
        shell: solaris {0}
        run: |
            cd "$GITHUB_WORKSPACE"
            bash ./b2-run-tests.sh

      - name: Build CMake tests
        if: matrix.cmake_tests
        run: |
            if [ -n "${{matrix.macosx_version_min}}" ]
            then
                export MACOSX_DEPLOYMENT_TARGET="${{matrix.macosx_version_min}}"
            fi
            cd boost-root
            mkdir __build_static__ && cd __build_static__
            cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON ..
            cmake --build . --target tests -j $BUILD_JOBS
            cd ..
            mkdir __build_shared__ && cd __build_shared__
            cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=ON ..
            cmake --build . --target tests -j $BUILD_JOBS

      - name: Run CMake tests
        if: matrix.cmake_tests
        run: |
            cd boost-root
            cd __build_static__
            ctest --output-on-failure --no-tests=error -j $BUILD_JOBS
            cd ../__build_shared__
            ctest --output-on-failure --no-tests=error -j $BUILD_JOBS

  windows:
    defaults:
      run:
        shell: cmd

    strategy:
      fail-fast: false
      matrix:
        include:
          - toolset: msvc-14.3
            cxxstd64: "14,17,20,latest"
            cxxstd32: "14"
            cxxflags: "/arch:AVX"
            os: windows-2022
          - toolset: clang-win
            cxxstd64: "14,17,latest"
            cxxstd32: "14"
            cxxflags: "-mavx -mcx16"
            os: windows-2022
          - toolset: gcc
            cxxstd64: "11-gnu,14-gnu,17-gnu,20-gnu,23-gnu"
            os: windows-2022

          # Windows SDK 32-bit ARM libs not installed in this image
          - name: ARM
            toolset: msvc-14.3
            cxxstd64: "14,17,20,latest"
            instruction_set: "-"
            os: windows-11-arm

          - name: CMake MSVC tests
            cmake_tests: 1
            os: windows-2022
          - name: CMake MinGW-w64 tests
            cmake_tests: 1
            os: windows-2022
            cmake_generator: "MinGW Makefiles"

    timeout-minutes: 30
    runs-on: ${{matrix.os}}

    steps:
      - name: Setup Boost
        run: |
            echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
            for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
            echo LIBRARY: %LIBRARY%
            echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
            echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
            echo GITHUB_REF: %GITHUB_REF%
            if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
            set BOOST_BRANCH=develop
            for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
            echo BOOST_BRANCH: %BOOST_BRANCH%
            mkdir snapshot
            cd snapshot
            echo Downloading library snapshot: https://github.com/%GITHUB_REPOSITORY%/archive/%GITHUB_SHA%.zip
            curl -L --retry %NET_RETRY_COUNT% -o "%LIBRARY%-%GITHUB_SHA%.zip" "https://github.com/%GITHUB_REPOSITORY%/archive/%GITHUB_SHA%.zip"
            tar -xf "%LIBRARY%-%GITHUB_SHA%.zip"
            if not exist "%LIBRARY%-%GITHUB_SHA%\" (
                echo Library snapshot does not contain the library directory %LIBRARY%-%GITHUB_SHA%:
                dir
                exit /b 1
            )
            del /f "%LIBRARY%-%GITHUB_SHA%.zip"
            cd ..
            git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
            cd boost-root
            if not exist "libs\" mkdir libs
            if exist "libs\%LIBRARY%\" rmdir /s /q "libs\%LIBRARY%"
            move /Y "..\snapshot\%LIBRARY%-%GITHUB_SHA%" "libs\%LIBRARY%"
            rmdir /s /q "..\snapshot"
            git submodule update --init tools/boostdep
            python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY%
            if "${{matrix.cmake_tests}}" == "" (
                cmd /c bootstrap
                b2 -d0 headers
            )

      - name: Run tests
        if: matrix.cmake_tests == ''
        run: |
            cd boost-root
            set "B2_ARGS=-j %NUMBER_OF_PROCESSORS% toolset=${{matrix.toolset}} embed-manifest-via=linker"
            if not "${{matrix.build_variant}}" == "" ( set "B2_ARGS=%B2_ARGS% variant=${{matrix.build_variant}}" ) else ( set "B2_ARGS=%B2_ARGS% variant=%DEFAULT_BUILD_VARIANT%" )
            if not "${{matrix.instruction_set}}" == "" (
                if not "${{matrix.instruction_set}}" == "-" set "B2_ARGS=%B2_ARGS% instruction-set=${{matrix.instruction_set}}"
            ) else (
                set "B2_ARGS=%B2_ARGS% instruction-set=%DEFAULT_INSTRUCTION_SET%"
            )
            if not "${{matrix.cxxflags}}" == "" set "B2_ARGS=%B2_ARGS% ^"cxxflags=${{matrix.cxxflags}}^""
            if not "${{matrix.linkflags}}" == "" set "B2_ARGS=%B2_ARGS% ^"linkflags=${{matrix.linkflags}}^""
            if not "${{matrix.cxxstd64}}" == "" (
                echo;
                echo Running 64-bit tests...
                echo =======================
                echo;
                b2 %B2_ARGS% cxxstd=${{matrix.cxxstd64}} address-model=64 libs/%LIBRARY%/test
            )
            if not "${{matrix.cxxstd32}}" == "" (
                echo;
                echo Running 32-bit tests...
                echo =======================
                echo;
                b2 %B2_ARGS% cxxstd=${{matrix.cxxstd32}} address-model=32 libs/%LIBRARY%/test
            )

      - name: Build CMake tests
        if: matrix.cmake_tests
        run: |
            if not "${{matrix.cmake_generator}}" == "" set "CMAKE_GENERATOR=${{matrix.cmake_generator}}"
            cd boost-root
            mkdir __build_static__
            cd __build_static__
            cmake -DBOOST_INCLUDE_LIBRARIES=%LIBRARY% -DBUILD_TESTING=ON ..
            cmake --build . --config Release --target tests -j %NUMBER_OF_PROCESSORS%
            cd ..
            mkdir __build_shared__
            cd __build_shared__
            cmake -DBOOST_INCLUDE_LIBRARIES=%LIBRARY% -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=ON ..
            cmake --build . --config Release --target tests -j %NUMBER_OF_PROCESSORS%

      - name: Run CMake tests
        if: matrix.cmake_tests
        run: |
            cd boost-root
            cd __build_static__
            ctest -C Release --output-on-failure --no-tests=error -j %NUMBER_OF_PROCESSORS%
            cd ../__build_shared__
            ctest -C Release --output-on-failure --no-tests=error -j %NUMBER_OF_PROCESSORS%