-
Notifications
You must be signed in to change notification settings - Fork 122
983 lines (878 loc) · 34.4 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
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
name: Main
on:
push:
branches:
- master
- tape-push
- coverity_scan
pull_request:
branches:
- master
- tape-push
- coverity_scan
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: osx14-arm-clang-runtime13
os: macos-14
compiler: clang
clang-runtime: '13'
- name: osx14-arm-clang-runtime14
os: macos-14
compiler: clang
clang-runtime: '14'
- name: osx14-arm-clang-runtime15
os: macos-14
compiler: clang
clang-runtime: '15'
- name: osx14-arm-clang-runtime16
os: macos-14
compiler: clang
clang-runtime: '16'
- name: osx14-arm-clang-runtime17
os: macos-14
compiler: clang
clang-runtime: '17'
#Turn on once clang-18 available through Homebrew
#- name: osx14-arm-clang-runtime18
# os: macos-14
# compiler: clang
# clang-runtime: '18'
- name: osx13-x86-clang-runtime12
os: macos-13
compiler: clang
clang-runtime: '12'
- name: osx13-x86-clang-runtime13
os: macos-13
compiler: clang
clang-runtime: '13'
- name: osx13-x86-clang-runtime14
os: macos-13
compiler: clang
clang-runtime: '14'
- name: osx13-x86-clang-runtime15
os: macos-13
compiler: clang
clang-runtime: '15'
- name: osx13-x86-clang-runtime16
os: macos-13
compiler: clang
clang-runtime: '16'
- name: osx13-x86-clang-runtime17
os: macos-13
compiler: clang
clang-runtime: '17'
#Turn on once clang-18 available through Homebrew
#- name: osx13-x86-clang-runtime18
# os: macos-13
# compiler: clang
# clang-runtime: '18'
- name: win2022-msvc-runtime14
os: windows-2022
compiler: msvc
clang-runtime: '14'
- name: win2022-msvc-runtime15
os: windows-2022
compiler: msvc
clang-runtime: '15'
- name: win2022-msvc-runtime16
os: windows-2022
compiler: msvc
clang-runtime: '16'
- name: win2022-msvc-runtime17
os: windows-2022
compiler: msvc
clang-runtime: '17'
- name: win2022-msvc-runtime18
os: windows-2022
compiler: msvc
clang-runtime: '18'
- name: ubu22-clang15-runtime16-debug
os: ubuntu-22.04
compiler: clang-15
clang-runtime: '16'
debug_build: true
#- name: ubu20-gcc7-runtime11-analyzers
# os: ubuntu-20.04
# compiler: gcc-7
# clang-runtime: '11'
# coverage: true
# cuda: true
# #extra_cmake_options: '-DCLAD_ENABLE_ENZYME_BACKEND=On'
# #clang-format: true
- name: selfh-ubu22-gcc12-runtime18-analyzers
os: self-hosted #ubuntu-22.04
compiler: gcc-12
clang-runtime: '18'
coverage: true
cuda: true
#extra_cmake_options: '-DCLAD_ENABLE_ENZYME_BACKEND=On'
#clang-format: true
- name: ubu20-gcc7-runtime11-benchmarks
os: ubuntu-20.04
compiler: gcc-7
clang-runtime: '11'
extra_cmake_options: '-DCLAD_ENABLE_BENCHMARKS=On -DCLAD_ENABLE_ENZYME_BACKEND=On'
benchmark: true
- name: ubu20-gcc8-runtime11-coverity
os: ubuntu-20.04
compiler: gcc-8
clang-runtime: '11'
coverity: true
- name: ubu20-gcc9-runtime9
os: ubuntu-20.04
compiler: gcc-9
clang-runtime: '9'
- name: ubu20-clang8-runtime9
os: ubuntu-20.04
compiler: clang-8
clang-runtime: '9'
- name: ubu20-clang9-runtime9
os: ubuntu-20.04
compiler: clang-9
clang-runtime: '9'
- name: ubu20-gcc7-runtime10
os: ubuntu-20.04
compiler: gcc-7
clang-runtime: '10'
- name: ubu20-gcc8-runtime10
os: ubuntu-20.04
compiler: gcc-8
clang-runtime: '10'
- name: ubu20-gcc9-runtime10
os: ubuntu-20.04
compiler: gcc-9
clang-runtime: '10'
- name: ubu20-clang8-runtime10
os: ubuntu-20.04
compiler: clang-8
clang-runtime: '10'
- name: ubu20-clang9-runtime10
os: ubuntu-20.04
compiler: clang-9
clang-runtime: '10'
- name: ubu20-gcc7-runtime11
os: ubuntu-20.04
compiler: gcc-7
clang-runtime: '11'
- name: ubu20-gcc8-runtime11
os: ubuntu-20.04
compiler: gcc-8
clang-runtime: '11'
- name: ubu20-gcc9-runtime11
os: ubuntu-20.04
compiler: gcc-9
clang-runtime: '11'
- name: ubu20-clang8-runtime11
os: ubuntu-20.04
compiler: clang-8
clang-runtime: '11'
- name: ubu20-clang9-runtime11
os: ubuntu-20.04
compiler: clang-9
clang-runtime: '11'
- name: ubu20-gcc7-runtime12
os: ubuntu-20.04
compiler: gcc-7
clang-runtime: '12'
- name: ubu20-gcc8-runtime12
os: ubuntu-20.04
compiler: gcc-8
clang-runtime: '12'
- name: ubu20-gcc9-runtime12
os: ubuntu-20.04
compiler: gcc-9
clang-runtime: '12'
- name: ubu20-clang8-runtime12
os: ubuntu-20.04
compiler: clang-8
clang-runtime: '12'
- name: ubu20-clang9-runtime12
os: ubuntu-20.04
compiler: clang-9
clang-runtime: '12'
- name: ubu20-clang9-runtime10-cuda
os: ubuntu-20.04
compiler: clang-9
clang-runtime: '10'
cuda: true
- name: selfh-ubu22-clang16-runtime18-cuda
os: self-hosted #ubuntu-22.04
runs-on: cuda
compiler: clang-16
clang-runtime: '18'
cuda: true
- name: ubu20-clang9-runtime15
os: ubuntu-20.04
compiler: clang-9
clang-runtime: '15'
- name: ubu20-clang9-runtime16
os: ubuntu-20.04
compiler: clang-9
clang-runtime: '16'
- name: ubu22-gcc9-runtime11
os: ubuntu-22.04
compiler: gcc-9
clang-runtime: '11'
- name: ubu22-gcc10-runtime11
os: ubuntu-22.04
compiler: gcc-10
clang-runtime: '11'
- name: ubu22-gcc11-runtime11
os: ubuntu-22.04
compiler: gcc-11
clang-runtime: '11'
- name: ubu22-clang11-runtime11
os: ubuntu-22.04
compiler: 'clang-11'
clang-runtime: '11'
- name: ubu22-clang12-runtime11
os: ubuntu-22.04
compiler: clang-12
clang-runtime: '11'
- name: ubu22-clang13-runtime11
os: ubuntu-22.04
compiler: clang-13
clang-runtime: '11'
- name: ubu22-clang14-runtime11
os: ubuntu-22.04
compiler: clang-14
clang-runtime: '11'
- name: ubu22-clang15-runtime11
os: ubuntu-22.04
compiler: clang-15
clang-runtime: '11'
- name: ubu22-gcc9-runtime12
os: ubuntu-22.04
compiler: gcc-9
clang-runtime: '12'
- name: ubu22-gcc10-runtime12
os: ubuntu-22.04
compiler: gcc-10
clang-runtime: '12'
- name: ubu22-gcc11-runtime12
os: ubuntu-22.04
compiler: gcc-11
clang-runtime: '12'
- name: ubu22-clang11-runtime12
os: ubuntu-22.04
compiler: 'clang-11'
clang-runtime: '12'
- name: ubu22-clang12-runtime12
os: ubuntu-22.04
compiler: clang-12
clang-runtime: '12'
- name: ubu22-clang13-runtime12
os: ubuntu-22.04
compiler: clang-13
clang-runtime: '12'
- name: ubu22-clang14-runtime12
os: ubuntu-22.04
compiler: clang-14
clang-runtime: '12'
- name: ubu22-clang15-runtime12
os: ubuntu-22.04
compiler: clang-15
clang-runtime: '12'
- name: ubu22-gcc10-runtime13
os: ubuntu-22.04
compiler: gcc-10
clang-runtime: '13'
- name: ubu22-gcc11-runtime13
os: ubuntu-22.04
compiler: gcc-11
clang-runtime: '13'
- name: ubu22-gcc12-runtime13
os: ubuntu-22.04
compiler: gcc-12
clang-runtime: '13'
- name: ubu22-clang11-runtime13
os: ubuntu-22.04
compiler: clang-11
clang-runtime: '13'
- name: ubu22-clang12-runtime13
os: ubuntu-22.04
compiler: clang-12
clang-runtime: '13'
- name: ubu22-clang13-runtime13
os: ubuntu-22.04
compiler: clang-13
clang-runtime: '13'
- name: ubu22-clang14-runtime13
os: ubuntu-22.04
compiler: clang-14
clang-runtime: '13'
- name: ubu22-clang15-runtime13
os: ubuntu-22.04
compiler: clang-15
clang-runtime: '13'
- name: ubu22-gcc10-runtime14
os: ubuntu-22.04
compiler: gcc-10
clang-runtime: '14'
- name: ubu22-gcc11-runtime14
os: ubuntu-22.04
compiler: gcc-11
clang-runtime: '14'
- name: ubu22-gcc12-runtime14
os: ubuntu-22.04
compiler: gcc-12
clang-runtime: '14'
- name: ubu22-gcc12-runtime15
os: ubuntu-22.04
compiler: gcc-12
clang-runtime: '15'
- name: ubu22-gcc12-runtime16
os: ubuntu-22.04
compiler: gcc-12
clang-runtime: '16'
- name: ubu22-clang11-runtime14
os: ubuntu-22.04
compiler: clang-11
clang-runtime: '14'
- name: ubu22-clang12-runtime14
os: ubuntu-22.04
compiler: clang-12
clang-runtime: '14'
- name: ubu22-clang13-runtime14
os: ubuntu-22.04
compiler: clang-13
clang-runtime: '14'
- name: ubu22-clang14-runtime14
os: ubuntu-22.04
compiler: clang-14
clang-runtime: '14'
- name: ubu22-clang14-runtime15
os: ubuntu-22.04
compiler: clang-14
clang-runtime: '15'
- name: ubu22-clang15-runtime14
os: ubuntu-22.04
compiler: clang-15
clang-runtime: '14'
- name: ubu22-clang15-runtime15
os: ubuntu-22.04
compiler: clang-15
clang-runtime: '15'
- name: ubu22-clang15-runtime16
os: ubuntu-22.04
compiler: clang-15
clang-runtime: '16'
- name: ubuntu-clang15-runtime16-doc
os: ubuntu-latest
compiler: clang-15
clang-runtime: '16'
doc_build: true
- name: ubu22-clang16-runtime17
os: ubuntu-22.04
compiler: clang-16
clang-runtime: '17'
- name: ubu22-clang16-runtime17-shared-libs
os: ubuntu-22.04
compiler: clang-16
extra_cmake_options: '-DBUILD_SHARED_LIBS=On'
clang-runtime: '17'
- name: ubu22-clang16-runtime17-kokkos
os: ubuntu-22.04
compiler: clang-16
clang-runtime: '17'
extra_packages: 'libtrilinos-kokkos-dev ninja-build'
extra_cmake_options: '-G Ninja'
- name: ubu22-clang16-runtime18
os: ubuntu-22.04
compiler: clang-16
clang-runtime: '18'
# Оld, still supported versions
- name: ubu20-gcc9-runtime8
os: ubuntu-20.04
compiler: gcc-9
clang-runtime: '8'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Save PR Info
if: ${{ matrix.coverage == true }}
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
echo ${{ github.repository }} > ./pr/REPO
- uses: actions/upload-artifact@v4
if: ${{ matrix.coverage == true }}
with:
name: pr
path: pr/
overwrite: true
- uses: nelonoel/[email protected]
- name: Setup default Build Type on *nux (coverity)
if: ${{ (matrix.debug_build != true) && (runner.os != 'windows') }}
run: |
echo "BUILD_TYPE=Release" >> $GITHUB_ENV
echo "CLAD_CODE_COVERAGE=0" >> $GITHUB_ENV
- name: Setup default Build Type on *nux (build_debug & asserts)
if: ${{ (matrix.debug_build == true) && (runner.os != 'windows') }}
run: |
echo "BUILD_TYPE=Debug" >> $GITHUB_ENV
- name: Setup default Build Type on Windows
if: runner.os == 'windows'
run: |
$env:BUILD_TYPE="Release"
$env:CLAD_CODE_COVERAGE="0"
echo "BUILD_TYPE=Release" >> $env:GITHUB_ENV
echo "CLAD_CODE_COVERAGE=0" >> $env:GITHUB_ENV
- name: Download Coverity Build Tool - Linux
if: ${{ (matrix.coverity == true) && (runner.os == 'Linux') }}
run: |
# FIXME: Ideally the check should be in the if: block of the action
if [ "$BRANCH_NAME" == "coverity_scan" ]; then
# wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=vgvassilev/clad" -O cov-analysis-linux64.tar.gz
mkdir cov-analysis-linux64
# tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64
echo "BUILD_TYPE=Debug" >> $GITHUB_ENV
echo "$GITHUB_WORKSPACE/cov-analysis-linux64/bin" >> $GITHUB_PATH
fi
# env:
# TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
- name: Setup Ubuntu apt sources
if: runner.os == 'Linux'
run: |
if ! sudo apt install -y llvm-${{ matrix.clang-runtime }}-dev ; then
curl https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
os_codename="`cat /etc/os-release | grep UBUNTU_CODENAME | cut -d = -f 2`"
echo "deb https://apt.llvm.org/${os_codename}/ llvm-toolchain-${os_codename}-${{ matrix.clang-runtime }} main" | sudo tee -a /etc/apt/sources.list
sudo apt update
fi
sudo apt install -y llvm-${{ matrix.clang-runtime }}-dev \
llvm-${{ matrix.clang-runtime }}-tools \
clang-${{ matrix.clang-runtime }} \
libclang-${{ matrix.clang-runtime }}-dev \
${{ matrix.extra_packages }}
- name: Setup compiler on Linux
if: runner.os == 'Linux'
run: |
# https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
vers="${compiler#*-}"
os_codename="`cat /etc/os-release | grep UBUNTU_CODENAME | cut -d = -f 2`"
sudo apt update
if [[ "${{ matrix.compiler }}" == *"gcc"* ]]; then
sudo apt install -y gcc-${vers} g++-${vers}
echo "CC=gcc-${vers}" >> $GITHUB_ENV
echo "CXX=g++-${vers}" >> $GITHUB_ENV
else
if ! sudo apt install -y clang-${vers}; then
curl https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
echo "deb https://apt.llvm.org/${os_codename}/ llvm-toolchain-${os_codename}-${vers} main" | sudo tee -a /etc/apt/sources.list
sudo apt update
sudo apt install -y clang-${vers}
fi
echo "CC=clang-${vers}" >> $GITHUB_ENV
echo "CXX=clang++-${vers}" >> $GITHUB_ENV
fi
env:
compiler: ${{ matrix.compiler }}
- name: Setup compiler on macOS
if: runner.os == 'macOS'
run: |
if [[ "${{ matrix.compiler }}" == *"clang"* ]]; then
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
else
echo "Unsupported compiler - fix YAML file"
fi
- name: Setup compiler on Windows
if: runner.os == 'windows'
run: |
if ( "${{ matrix.compiler }}" -imatch "clang" )
{
$ver="${{ matrix.compiler }}".split("-")[1]
choco install llvm --version=$ver --no-progress -my
$env:PATH_TO_LLVM_BUILD="$env:ProgramFiles\LLVM"
echo "PATH_TO_LLVM_BUILD=$env:PATH_TO_LLVM_BUILD"
echo "PATH_TO_LLVM_BUILD=$env:PATH_TO_LLVM_BUILD" >> $env:GITHUB_ENV
clang --version
#
$env:CC="clang"
$env:CXX="clang++"
echo "CC=clang" >> $env:GITHUB_ENV
echo "CXX=clang++" >> $env:GITHUB_ENV
}
elseif ( "${{ matrix.compiler }}" -imatch "msvc" )
{
# MSVC is builtin in container image
}
else
{
echo "Unsupported compiler - fix YAML file"
}
- name: Setup LLVM/Clang on macOS
if: runner.os == 'macOS'
run: |
#brew update
brew install --ignore-dependencies llvm
brew install z3
# Update openssl on osx because the current one is deprecated by python.
curl -L https://bootstrap.pypa.io/get-pip.py | sudo python3
echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH
# For now Package llvm@18 is unsuported on brew, llvm <=@11 are deprecated or deleted.
# Install llvm from github releases.
if [[ '${{ matrix.clang-runtime }}' == '18' || ${{ matrix.clang-runtime }} -le 11 ]]; then
PATH_TO_LLVM_BUILD=/usr/local/opt/llvm@${{ matrix.clang-runtime }}/
pushd /usr/local/opt
w="0"
[ '${{ matrix.clang-runtime }}' == '17' ] && w="6"
sudo curl -L https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.clang-runtime }}.0.$w/clang+llvm-${{ matrix.clang-runtime }}.0.$w-x86_64-apple-darwin.tar.xz | sudo xz -d -c | sudo tar -x
sudo rm -fr /usr/local/clang*
sudo mv clang+llvm-${{ matrix.clang-runtime }}.0.$w-x86_64-apple-darwin/ llvm@${{ matrix.clang-runtime }}/
# Use llvm/llvm@10/llvm@6 Filecheck
if [[ ! -f $PATH_TO_LLVM_BUILD/bin/FileCheck ]]; then
if [[ -f /usr/local/opt/llvm/bin/FileCheck ]]; then
sudo ln -s /usr/local/opt/llvm/bin/FileCheck $PATH_TO_LLVM_BUILD/bin/FileCheck
elif [[ -f /usr/local/opt/llvm\@10/bin/FileCheck ]]; then
sudo ln -s /usr/local/opt/llvm\@10/bin/FileCheck $PATH_TO_LLVM_BUILD/bin/FileCheck
elif [[ -f /usr/local/opt/llvm\@6/bin/FileCheck ]]; then
sudo ln -s /usr/local/opt/llvm\@6/bin/FileCheck $PATH_TO_LLVM_BUILD/bin/FileCheck
fi
fi
popd
fi
if [[ '${{ matrix.clang-runtime }}' != '18' && ${{ matrix.clang-runtime }} -gt 11 ]]; then
brew install llvm@${{ matrix.clang-runtime }}
else
# Remove the c++ headers that come with the llvm package from homebrew
# allowing clang to work with system's SDK.
sudo rm -fr /usr/local/opt/llvm*/include/c++
fi
PATH_TO_LLVM_BUILD=$(brew --prefix llvm@${{ matrix.clang-runtime }})
pip3 install lit # LLVM lit is not part of the llvm releases...
# We need headers in correct place
#FIXME: ln solution fails with error message No such file or directory on osx arm,
#Copying over files as a temporary solution
sudo cp -r -n $(xcrun --show-sdk-path)/usr/include/ /usr/local/include/
#for file in $(xcrun --show-sdk-path)/usr/include/*
#do
# if [ ! -f /usr/local/include/$(basename $file) ]; then
# echo ${file}
# ln -s ${file} /usr/local/include/$(basename $file)
# fi
#done
# We need PATH_TO_LLVM_BUILD later
echo "PATH_TO_LLVM_BUILD=$PATH_TO_LLVM_BUILD" >> $GITHUB_ENV
- name: Restore Cache LLVM/Clang runtime build directory (debug_build==true)
if: ${{ (matrix.debug_build == true) && (runner.os != 'windows') }}
uses: actions/cache/restore@v4
id: cache
with:
path: |
llvm-project
key: ${{ matrix.os }}-clang-${{ matrix.clang-runtime }}.x-${{ env.BUILD_TYPE }}
- name: Build LLVM/Cling on Unix if the cache is invalid (debug_build==true)
if: ${{ (matrix.debug_build == true) && (runner.os != 'windows') && (steps.cache.outputs.cache-hit != 'true') }}
run: |
os="${{ matrix.os }}"
git clone --depth=1 -b release/${{ matrix.clang-runtime }}.x https://github.com/llvm/llvm-project.git
cd llvm-project
# Build
mkdir build
cd build
export CPU_COUNT="$(nproc --all)"
cmake \
-DLLVM_ENABLE_PROJECTS="clang" \
-DLLVM_TARGETS_TO_BUILD="host;NVPTX" \
-DCMAKE_BUILD_TYPE=`[[ -z "$BUILD_TYPE" ]] && echo RelWithDebInfo || echo $BUILD_TYPE` \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DCLANG_ENABLE_STATIC_ANALYZER=OFF \
-DCLANG_ENABLE_ARCMT=OFF \
-DCLANG_ENABLE_FORMAT=OFF \
-DCLANG_ENABLE_BOOTSTRAP=OFF \
-DLLVM_ENABLE_TERMINFO=OFF \
-DCLANG_INCLUDE_TESTS=OFF \
-DCLANG_INCLUDE_DOCS=OFF \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_INCLUDE_DOCS=OFF \
../llvm
cmake --build . --target clang FileCheck llvm-config clang-repl --parallel ${CPU_COUNT}
cd ../../
- name: Save Cache LLVM/Clang runtime build directory (debug_build==true)
uses: actions/cache/save@v4
if: ${{ (matrix.debug_build == true) && (runner.os != 'windows') && (steps.cache.outputs.cache-hit != 'true') }}
with:
path: |
llvm-project
key: ${{ steps.cache.outputs.cache-primary-key }}
- name: Set LLVM/Cling build path on Unix (debug_build==true)
if: ${{ (matrix.debug_build == true) && (runner.os != 'windows') }}
run: |
export PATH_TO_LLVM_BUILD="$PWD/llvm-project/build"
echo "PATH_TO_LLVM_BUILD=$PATH_TO_LLVM_BUILD"
echo "PATH_TO_LLVM_BUILD=$PATH_TO_LLVM_BUILD" >> $GITHUB_ENV
pip3 install lit # LLVM lit is not part of the llvm releases...
vers="${compiler#*-}"
if [[ ! -f "$PATH_TO_LLVM_BUILD/bin/FileCheck" ]]; then
ln -s /usr/bin/FileCheck-$vers $PATH_TO_LLVM_BUILD/bin/FileCheck
fi
env:
compiler: ${{ matrix.compiler }}
- name: Setup LLVM/Clang on Linux
if: ${{ (runner.os == 'Linux') && (matrix.debug_build != true) }}
run: |
UNIX_DISTRO=$(lsb_release -rs)
PATH_TO_LLVM_BUILD=/usr/lib/llvm-${{ matrix.clang-runtime }}/
# llvm-8-tools is broken as it depends on python2.7 we use FileCheck from llvm-7-tools
if [[ '${{ matrix.clang-runtime }}' == '8' ]]; then
if [[ ! -f $PATH_TO_LLVM_BUILD/bin/FileCheck ]]; then
sudo apt install -y llvm-9-dev llvm-9-tools
sudo ln -s /usr/lib/llvm-9/bin/FileCheck $PATH_TO_LLVM_BUILD/bin/FileCheck
fi
fi
# Add -H to silence 'The directory '/home/..../pip/http' or its parent
# directory is not owned by the current user and the cache has been disabled.
pip3 install lit # LLVM lit is not part of the llvm releases...
# We need PATH_TO_LLVM_BUILD later
echo "PATH_TO_LLVM_BUILD=$PATH_TO_LLVM_BUILD" >> $GITHUB_ENV
- name: Setup LLVM/Clang on Windows
if: ${{ runner.os == 'windows' }}
run: |
C:\Miniconda\condabin\conda.bat install -y -c conda-forge "clangdev=${{ matrix.clang-runtime }}"
$env:PATH_TO_LLVM_BUILD="$env:CONDA\Library"
pip3 install lit # LLVM lit is not part of the llvm releases...
echo "Runtime LLVM/Clang: $env:PATH_TO_LLVM_BUILD"
echo "PATH_TO_LLVM_BUILD=$env:PATH_TO_LLVM_BUILD"
echo "PATH_TO_LLVM_BUILD=$env:PATH_TO_LLVM_BUILD" >> $env:GITHUB_ENV
- name: Setup CUDA 8 on Linux
if: ${{ matrix.cuda == true && !matrix.os == 'self-hosted'}}
run: |
wget --no-verbose https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_375.26_linux-run
wget --no-verbose https://developer.nvidia.com/compute/cuda/8.0/Prod2/patches/2/cuda_8.0.61.2_linux-run
sh ./cuda_8.0.61_375.26_linux-run --tar mxvf
sudo cp InstallUtils.pm /usr/lib/x86_64-linux-gnu/perl-base
export $PERL5LIB
sudo sh cuda_8.0.61_375.26_linux-run --override --no-opengl-lib --silent --toolkit --kernel-source-path=/lib/modules/4.15.0-1113-azure/build
sudo sh cuda_8.0.61.2_linux-run --silent --accept-eula
export PATH=/usr/local/cuda-8.0/bin:${PATH}
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda-8.0/lib64
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo "PATH=$PATH" >> $GITHUB_ENV
- name: Setup code coverage
if: ${{ (matrix.coverage == true) }}
run: |
sudo apt install -y lcov
# Workaround ubuntu lcov-1.15-1 package bug
if sudo apt list lcov --installed | grep "1.15-1" ; then
wget https://launchpad.net/ubuntu/+source/lcov/1.15-2/+build/23784466/+files/lcov_1.15-2_all.deb
sudo apt install -y ./lcov_1.15-2_all.deb
fi
echo "CLAD_CODE_COVERAGE=1" >> $GITHUB_ENV
echo "BUILD_TYPE=Debug" >> $GITHUB_ENV
- name: Display config *nix
if: ${{ runner.os != 'windows' }}
run: |
cmake --version
$CC --version
$CXX --version
xz --version
tar --version
echo "Use Clang/LLVM in $PATH_TO_LLVM_BUILD"
echo "Building clad in `[[ -z "$BUILD_TYPE" ]] && echo RelWithDebInfo || echo $BUILD_TYPE`"
python3 --version
- name: Display config Windows
if: ${{ runner.os == 'windows' }}
run: |
cmake --version
echo "CC=$env:CC"
if ( "$env:CC" -ne "" )
{
Start-Process -Wait -FilePath "$env:CC" -Verb RunAs -ArgumentList '--version'
}
echo "CXX=$env:CXX"
if ( "$env:CXX" -ne "" )
{
Start-Process -Wait -FilePath "$env:CXX" -Verb RunAs -ArgumentList '--version'
}
xz --version
tar --version
echo "Use Clang/LLVM in $env:PATH_TO_LLVM_BUILD"
echo "Building clad in $env:BUILD_TYPE"
python3 --version
- name: Build Clad on *nix
if: ${{ runner.os != 'windows' }}
run: |
rm -rf obj && mkdir obj && cd obj
cmake -DClang_DIR=${{ env.PATH_TO_LLVM_BUILD }} \
-DLLVM_DIR=${{ env.PATH_TO_LLVM_BUILD }} \
-DCMAKE_BUILD_TYPE=$([[ -z "$BUILD_TYPE" ]] && echo RelWithDebInfo || echo $BUILD_TYPE) \
-DCLAD_CODE_COVERAGE=${{ env.CLAD_CODE_COVERAGE }} \
-DLLVM_EXTERNAL_LIT="`which lit`" \
-DLLVM_ENABLE_WERROR=On \
$GITHUB_WORKSPACE \
${{ matrix.extra_cmake_options }}
cmake --build . -- -j4
- name: Build Clad on Windows
if: ${{ matrix.coverity == false && runner.os == 'windows' }}
run: |
mkdir obj
cd obj
if ( "$env:BUILD_TYPE" -eq "" )
{
$env:BUILD_TYPE="RelWithDebInfo"
}
if ( "$env:CLAD_CODE_COVERAGE" -eq "" )
{
$env:CLAD_CODE_COVERAGE="0"
}
((Get-Content -path C:/Miniconda/Library/lib/cmake/llvm/LLVMConfig.cmake -Raw) -replace 'LLVM_ENABLE_DIA_SDK ON','LLVM_ENABLE_DIA_SDK OFF') | Set-Content -Path C:/Miniconda/Library/lib/cmake/llvm/LLVMConfig.cmake
$lit = @(which lit)
cmake -DClang_DIR="$env:PATH_TO_LLVM_BUILD" -DLLVM_DIR="$env:PATH_TO_LLVM_BUILD" -DCMAKE_BUILD_TYPE="$env:BUILD_TYPE" -DCLAD_CODE_COVERAGE="$env:CLAD_CODE_COVERAGE" -DCLAD_BUILD_STATIC_ONLY="ON" -DLLVM_EXTERNAL_LIT="$lit" "$env:GITHUB_WORKSPACE" ${{ matrix.extra_cmake_options }}
cmake --build . --config Release
- name: Build Clad for Coverity Scan
if: ${{ matrix.coverity == true }}
run: |
# FIXME: Ideally the check should be in the if: block of the action
if [ "$BRANCH_NAME" == "coverity_scan" ]; then
if [[ "${{ matrix.compiler }}" == "gcc-8" ]]; then
rm -rf obj && mkdir obj && cd obj
cmake -DClang_DIR="$PATH_TO_LLVM_BUILD" \
-DLLVM_DIR="$PATH_TO_LLVM_BUILD" \
-DCMAKE_BUILD_TYPE=$([[ -z "$BUILD_TYPE" ]] && echo RelWithDebInfo || echo $BUILD_TYPE) \
$GITHUB_WORKSPACE
cov-build --dir cov-out cmake --build . -- -j4
else
echo "Coverity Scan can only be triggered for GCC 6. Fix Github Actions YAML"
exit 1
fi
else
echo "This action only runs on branch coverity_scan"
fi
- name: Test Clad on *nix
if: ${{ matrix.coverity == false && runner.os != 'windows' }}
run: |
cd obj
cmake --build . --target check-clad -- -j4
- name: Test Clad on Windows
if: ${{ matrix.coverity == false && runner.os == 'windows' }}
run: |
cd obj
#cmake --build . --target check-clad
- name: Benchmark Clad
if: ${{ matrix.benchmark }}
run: |
cd obj
cmake --build . --target benchmark-clad -j4
cd ..
# Get the performance for previous version. If it were a PR the master
# or the previous hash
hash=$([[ -z "${{ github.event.pull_request }}" ]] && echo ${{ github.event.before }} || echo ${{ github.event.pull_request.base.sha }})
echo "Running git checkout '$hash'"
git checkout $hash
cd obj
cmake --build . --target clean -- -j4
cmake --build . --target benchmark-clad -j4
# Compare:
pip3 install -r ./googlebenchmark-prefix/src/googlebenchmark/tools/requirements.txt
COMPARER="$(pwd)/googlebenchmark-prefix/src/googlebenchmark/tools/compare.py"
cd benchmark
for baseline in *-$hash.json
do
common=${baseline%$hash.json}
pr_change=$(find . ! -name "*$hash.json" -name "$common*.json")
echo "Running 'python3 ${COMPARER} benchmarks '${baseline}' '${pr_change}''"
python3 ${COMPARER} benchmarks ${baseline} ${pr_change}
done
cd ..
- name: Test build sphinx & doxygen documentation
if: ${{ (matrix.doc_build == true) }}
run: |
sudo apt-get install -y doxygen graphviz
pip install --upgrade pip
pip install -r requirements.txt
mkdir -p obj && cd obj
cmake \
-DClang_DIR="$PATH_TO_LLVM_BUILD" \
-DLLVM_DIR="$PATH_TO_LLVM_BUILD" \
-DCLAD_INCLUDE_DOCS=ON \
-DCLAD_ENABLE_DOXYGEN=ON \
-DCLAD_ENABLE_SPHINX=ON \
-DCMAKE_INSTALL_PREFIX=../inst \
-DCMAKE_BUILD_TYPE=Debug \
-DLLVM_EXTERNAL_LIT="`which lit`" \
..
cmake --build . --target sphinx-clad doxygen-clad -- -j4
- name: Failed job config
if: ${{ failure() && runner.os != 'windows' }}
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: |
echo "$GITHUB_CONTEXT"
export
if [[ "runner.os" == "Linux" ]]; then
apt-mark showhold
dpkg-query -L libclang-${{ matrix.clang-runtime }}-dev
dpkg-query -L clang-${{ matrix.clang-runtime }}
dpkg-query -L llvm-${{ matrix.clang-runtime }}-dev
find /usr/lib/llvm-${{ matrix.clang-runtime }}/
fi
if [[ "runner.os" == "macOS" ]]; then
brew search llvm
find /usr/local/opt/llvm@*/
fi
pip show lit
cat obj/CMakeCache.txt
cat obj/CMakeFiles/*.log
- name: Setup tmate session
if: ${{ runner.debug }}
uses: mxschmitt/action-tmate@v3
# When debugging increase to a suitable value!
timeout-minutes: 30
- name: Prepare code coverage report
if: ${{ success() && (matrix.coverage == true) }}
run: |
# Create lcov report
# capture coverage info
vers="${CC#*-}"
lcov --directory . --capture --output-file coverage.info --gcov-tool /usr/bin/gcov-${vers} --ignore-errors gcov
# filter out system and extra files.
# To also not include test code in coverage add them with full path to the patterns: '*/tests/*'
lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' \
"$GITHUB_WORKSPACE"'/test/*' "$GITHUB_WORKSPACE"'/unittests/*' \
--output-file coverage.info
# output coverage data for debugging (optional)
lcov --list coverage.info
- name: Upload to codecov.io
if: ${{ success() && (matrix.coverage == true) }}
uses: codecov/codecov-action@v4
with:
file: ./coverage.info
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload report to coverity_scan
if: ${{ success() && (matrix.coverity == true) }}
run: |
# FIXME: Ideally the check should be in the if: block of the action
if [ "$BRANCH_NAME" == "coverity_scan" ]; then
# Upload to coverity
tar czvf clad.tgz cov-out
# curl \
# --form project=vgvassilev/clad \
# --form token=$TOKEN \
# --form [email protected] \
# --form [email protected] \
# --form version=trunk \
# --form description=""Clad build submitted via Travis CI"" \
# https://scan.coverity.com/builds?project=vgvassilev/clad
else
echo "This action only runs on branch coverity_scan"
fi
# env:
# TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}