-
-
Notifications
You must be signed in to change notification settings - Fork 244
771 lines (680 loc) · 27.2 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
name: ci
on:
push:
branches-ignore:
- 'continuous'
pull_request:
branches-ignore:
- 'continuous'
repository_dispatch:
types: [rebuild_trigger]
env:
CMAKE_VERSION: 3.29.0
NINJA_VERSION: 1.11.1
LLVM_VERSION: 18.1.0
NINJA_STATUS: "[%f/%t %o/sec] "
jobs:
checks:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
# Clang
- {
name: "Linux Clang - Format check",
os: ubuntu-20.04,
build_type: Release,
cformat_name: 'clang-format-18'
}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Install Clang
shell: bash
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18
sudo apt-get install ${{ matrix.config.cformat_name }}
- name: clang-format check
id: clang_format_check
shell: bash
run: |
${GITHUB_WORKSPACE}/scripts/github-clang-format-check.sh ${{ matrix.config.cformat_name }} ${{ github.event_name }} ${{ github.event.before }}
#------------------------------------------------------------------------------
# BUILD macOS and Windows
#------------------------------------------------------------------------------
build:
needs: checks
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
continue-on-error: false
strategy:
fail-fast: false
matrix:
config:
# AppleClang
- {
name: "Clang 18 / LLVM 18 @ macOS Release",
os: macos-14,
build_type: Release,
cxx: "clang++",
llvm_version: "18.1.0",
llvm_config: "llvm-config",
coverage: "No",
static: "No",
debug: "No",
tidy: "No",
run_tests: "Yes",
bin_name: "insights",
archive_name: "insights-macos",
upload: "Yes",
cmake_args: "-DCMAKE_OSX_ARCHITECTURES=arm64",
}
# AppleClang
- {
name: "Clang 18 / LLVM 18 @ macOS Debug",
os: macos-14,
build_type: Release,
cxx: "clang++",
llvm_version: "18.1.0",
llvm_config: "llvm-config",
coverage: "No",
static: "No",
debug: "Yes",
tidy: "No",
run_tests: "No", # done by the coverage build
bin_name: "insights",
archive_name: "insights-macos",
upload: "No",
cmake_args: "-DCMAKE_OSX_ARCHITECTURES=arm64",
}
# AppleClang
- {
name: "Clang 18 / LLVM 18 @ macOS Coverage & Debug",
os: macos-14,
build_type: Release,
cxx: "clang++",
llvm_version: "18.1.0",
llvm_config: "llvm-config",
coverage: "Yes",
static: "No",
debug: "Yes",
tidy: "No",
run_tests: "No",
bin_name: "insights",
archive_name: "insights-macos",
upload: "No",
}
# # MSVC 2019
# - {
# name: "MSVC 2022 / LLVM 18 @ Windows Release",
# os: windows-2022,
# build_type: Release,
# cxx: "cl",
# llvm_version: "18.1.0",
# llvm_config: "current/bin/llvm-config.exe",
# static: "Yes",
# debug: "No",
# tidy: "No",
# run_tests: "Yes",
# bin_name: "insights.exe",
# archive_name: "insights-windows",
# upload: "Yes",
# environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
# # cmake_args: "-A x64 -T LLVM_v142",
# }
# # MSVC 2019
# - {
# name: "MSVC 2022 / LLVM 18 @ Windows Debug",
# os: windows-2022,
# build_type: Release,
# cxx: "cl",
# llvm_version: "18.1.0",
# llvm_config: "current/bin/llvm-config.exe",
# static: "Yes",
# debug: "Yes",
# tidy: "No",
# run_tests: "No", # done by the coverage build
# bin_name: "insights.exe",
# archive_name: "insights-windows",
# upload: "No",
# environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
# }
# # MSVC 2019
# - {
# name: "MSVC 2022 / LLVM 18 @ Windows Code Coverage & Debug",
# os: windows-2022,
# build_type: Release,
# cxx: "clang-cl.exe",
# llvm_version: "18.1.0",
# llvm_config: "current/bin/llvm-config.exe",
# coverage: "Yes",
# static: "Yes",
# debug: "Yes",
# tidy: "No",
# run_tests: "No",
# bin_name: "insights.exe",
# archive_name: "insights-windows",
# upload: "No",
# environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
# }
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
path: cppinsights
- name: Download Ninja and CMake
id: cmake_and_ninja_setup
shell: bash
run: |
cmake_version=$CMAKE_VERSION
ninja_version=$NINJA_VERSION
echo "Using host CMake version: ${CMAKE_VERSION}"
if [ "$RUNNER_OS" == "Windows" ]; then
ninja_suffix="win.zip"
cmake_suffix="win64-x64.zip"
cmake_base_dir="cmake-${cmake_version}-win64-x64"
cmake_dir="${cmake_base_dir}/bin"
elif [ "$RUNNER_OS" == "Linux" ]; then
ninja_suffix="linux.zip"
cmake_suffix="Linux-x86_64.tar.gz"
cmake_base_dir="cmake-${cmake_version}-Linux-x86_64"
cmake_dir="${cmake_base_dir}/bin"
elif [ "$RUNNER_OS" == "macOS" ]; then
ninja_suffix="mac.zip"
cmake_suffix="macos-universal.tar.gz"
cmake_base_dir="cmake-${cmake_version}-macos-universal"
cmake_dir="${cmake_base_dir}/CMake.app/Contents/bin"
fi
ninja_url="https://github.com/ninja-build/ninja/releases/download/v${ninja_version}/ninja-${ninja_suffix}"
echo "ninja_url=${ninja_url}" >> $GITHUB_OUTPUT
cmake_url="https://github.com/Kitware/CMake/releases/download/v${cmake_version}/cmake-${cmake_version}-${cmake_suffix}"
echo "cmake_url=${cmake_url}" >> $GITHUB_OUTPUT
# preserve it for the next steps
echo "cmake_dir=${cmake_dir}" >> $GITHUB_OUTPUT
# preserve it for the next steps
echo "cmake_base_dir=${cmake_base_dir}" >> $GITHUB_OUTPUT
- name: Cache Ninja and CMake
id: cache-ninja-and-cmake
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/ninja*
${{ steps.cmake_and_ninja_setup.outputs.cmake_base_dir }}
key: ${{ runner.os }}-ninja-cmake-${{ hashFiles('${{ github.workspace }}/ninja.exe') }}-${{ hashFiles('${{ github.workspace }}/current') }}-${{ hashFiles('${{ steps.cmake_and_ninja_setup.outputs.cmake_base_dir }}') }}
restore-keys: |
${{ runner.os }}-ninja-cmake
- name: Download Ninja and CMake
id: cmake_and_ninja
if: steps.cache-ninja-and-cmake.outputs.cache-hit != 'true'
shell: cmake -P {0}
run: |
set(ninja_url "${{ steps.cmake_and_ninja_setup.outputs.ninja_url }}")
file(DOWNLOAD "${ninja_url}" ./ninja.zip)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ./ninja.zip)
execute_process(COMMAND ${CMAKE_COMMAND} -E remove ./ninja.zip)
set(cmake_url "${{ steps.cmake_and_ninja_setup.outputs.cmake_url }}")
file(DOWNLOAD "${cmake_url}" ./cmake.zip)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ./cmake.zip)
execute_process(COMMAND ${CMAKE_COMMAND} -E remove ./cmake.zip)
set(cmake_dir "${{ steps.cmake_and_ninja_setup.outputs.cmake_dir }}")
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/${cmake_dir}" cmake_dir)
if (NOT "${{ runner.os }}" STREQUAL "Windows")
execute_process(
COMMAND chmod +x ninja
COMMAND chmod +x ${cmake_dir}/cmake
)
endif()
- name: Cache Clang
id: cache-clang-binary
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/current
key: ${{ runner.os }}-clang-${{ matrix.config.llvm_version }}-${{ hashFiles('${{ github.workspace }}/current') }}
- name: Install Clang
if: "(startsWith(matrix.config.os, 'macos') || startsWith(matrix.config.os, 'Window')) && steps.cache-clang-binary.outputs.cache-hit != 'true'"
shell: cmake -P {0}
run: |
set(llvm_version ${{ matrix.config.llvm_version }})
set(path_separator ":")
set(archive_name "clang+llvm-${llvm_version}-arm64-apple-darwin")
if ("${{ runner.os }}" STREQUAL "Windows")
set(archive_name "clang+llvm-${llvm_version}-win64-msvc")
set(path_separator ";")
endif()
file(REMOVE_RECURSE "./current")
file(DOWNLOAD "https://github.com/andreasfertig/cppinsights-compiler-binaries/releases/download/${llvm_version}/${archive_name}.tar.xz" ./llvm.tar.xz)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ./llvm.tar.xz)
execute_process(COMMAND ${CMAKE_COMMAND} -E remove ./llvm.tar.xz)
execute_process(COMMAND ${CMAKE_COMMAND} -E rename "./${archive_name}" "./current")
- name: Set Clang path
if: "startsWith(matrix.config.os, 'macos') || startsWith(matrix.config.os, 'Window')"
shell: cmake -P {0}
run: |
set(path_separator ":")
if ("${{ runner.os }}" STREQUAL "Windows")
set(path_separator ";")
endif()
file(WRITE "$ENV{GITHUB_PATH}" "$ENV{GITHUB_WORKSPACE}/current/bin${path_separator}$ENV{PATH}")
- name: Install LLVM build tools
id: install_llvm_build_tools
if: "startsWith(matrix.config.os, 'Window') && contains(matrix.config.cmake_args, 'LLVM_v')"
shell: cmake -P {0}
run: |
file(DOWNLOAD "https://github.com/zufuliu/llvm-utils/releases/download/v19.05/LLVM_VS2017.zip" ./llvm-utils.zip)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ./llvm-utils.zip)
execute_process(COMMAND ${CMAKE_COMMAND} -E remove ./llvm-utils.zip)
execute_process(COMMAND $ENV{GITHUB_WORKSPACE}/LLVM_VS2017/install.bat)
- name: Cache grcov
id: cache-grcov-binary
if: "(startsWith(matrix.config.os, 'Window') && (matrix.config.coverage == 'Yes'))"
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/grcov.exe
key: ${{ runner.os }}-grcov-${{ matrix.config.llvm_version }}-${{ hashFiles('${{ github.workspace }}/grcov.exe') }}
- name: Install LLVM grcov
# if: "(startsWith(matrix.config.os, 'Window') && (matrix.config.coverage == 'Yes') && ((steps.cache-grcov-binary.outputs.cache-hit != 'true') || (steps.cache-clang-binary.outputs.cache-hit != 'true')))"
if: "(startsWith(matrix.config.os, 'Window') && (matrix.config.coverage == 'Yes'))"
shell: cmake -P {0}
run: |
file(DOWNLOAD "https://github.com/mozilla/grcov/releases/download/v0.5.15/grcov-win-x86_64.tar.bz2" ./grcov.tar.bz2)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ./grcov.tar.bz2)
execute_process(COMMAND ${CMAKE_COMMAND} -E remove ./grcov.tar.bz2)
- name: Setup MSVC Dev
if: "startsWith(matrix.config.os, 'Windows')"
uses: ilammy/msvc-dev-cmd@v1
- name: Configure
id: cmake_configure
shell: cmake -P {0}
run: |
set(ENV{CXX} ${{ matrix.config.cxx }})
if ("${{ runner.os }}" STREQUAL "macOS")
set(ENV{SDKROOT} "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
endif()
set(path_separator ":")
if ("${{ runner.os }}" STREQUAL "Windows")
set(path_separator ";")
endif()
file(WRITE "$ENV{GITHUB_PATH}" "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}")
set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}")
if ("x${{ matrix.config.libcxx }}" STREQUAL "xtrue")
set(cxx_flags "${cxx_flags} -stdlib=libc++ -Wno-unused-command-line-argument")
set(link_flags "${link_flags} -lc++abi")
endif()
execute_process(
COMMAND ${{ steps.cmake_and_ninja_setup.outputs.cmake_dir }}/cmake
-S cppinsights
-B build
-G "Ninja"
-D INSIGHTS_LLVM_CONFIG=${{ matrix.config.llvm_config}}
-D INSIGHTS_COVERAGE=${{ matrix.config.coverage }}
-D INSIGHTS_STATIC=${{ matrix.config.static }}
-D DEBUG=${{ matrix.config.debug }}
-D INSIGHTS_TIDY=${{ matrix.config.tidy }}
-D CMAKE_BUILD_TYPE=${{ matrix.config.build_type }}
-D "CMAKE_MAKE_PROGRAM:STRING=$ENV{GITHUB_WORKSPACE}/ninja"
# -D "CMAKE_CXX_FLAGS:STRING=${cxx_flags}"
# -D "CMAKE_EXE_LINKER_FLAGS:STRING=${link_flags}"
${{ matrix.config.cmake_args }}
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit from cmake configure status")
endif()
- name: Build
shell: cmake -P {0}
run: |
execute_process(
COMMAND ${{ steps.cmake_and_ninja_setup.outputs.cmake_dir }}/cmake --build build
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Run tests
id: run_tests
if: matrix.config.run_tests == 'Yes'
shell: cmake -P {0}
run: |
if ("${{ runner.os }}" STREQUAL "macOS")
set(ENV{CPLUS_INCLUDE_PATH} "$ENV{GITHUB_WORKSPACE}/current/include/c++/v1:/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include")
set(ENV{SDKROOT} "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
endif()
execute_process(
COMMAND ${{ steps.cmake_and_ninja_setup.outputs.cmake_dir }}/cmake --build build --target tests
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status during tests")
endif()
- name: Run coverage
if: matrix.config.coverage == 'Yes'
shell: cmake -P {0}
run: |
if ("${{ runner.os }}" STREQUAL "macOS")
set(ENV{CPLUS_INCLUDE_PATH} "$ENV{GITHUB_WORKSPACE}/current/include/c++/v1:/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include")
set(ENV{SDKROOT} "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
endif()
execute_process(
COMMAND cmake --build build --target coverage
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status during coverage")
endif()
- name: Upload code coverage info
if: matrix.config.coverage == 'Yes'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./build/filtered.info # don't use a absolute path on Windows with gitBash.
exclude: build
flags: ${{ matrix.config.archive_name }}
disable_search: true
fail_ci_if_error: true
- name: Create archive
if: matrix.config.upload == 'Yes'
shell: cmake -P {0}
working-directory: ${{ github.workspace }}/build
run: |
file(MAKE_DIRECTORY "$ENV{GITHUB_WORKSPACE}/build/archive")
execute_process(COMMAND ${CMAKE_COMMAND} -E tar cvz "$ENV{GITHUB_WORKSPACE}/build/archive/${{ matrix.config.archive_name }}.tar.gz" -- "${{ matrix.config.bin_name }}")
file(SHA256 "$ENV{GITHUB_WORKSPACE}/build/${{ matrix.config.bin_name }}" CHKSM)
file(WRITE "$ENV{GITHUB_WORKSPACE}/build/archive/${{ matrix.config.archive_name }}.sha256" ${CHKSM})
- uses: actions/upload-artifact@v3
if: matrix.config.upload == 'Yes'
with:
name: insights-artifact-${{ matrix.config.os }}
if-no-files-found: error
path: |
${{ github.workspace }}/build/archive/*
#------------------------------------------------------------------------------
# BUILD INSIDE DOCKER
#------------------------------------------------------------------------------
docker:
runs-on: ubuntu-22.04
name: ${{ matrix.config.name }} @${{ matrix.arch }}
continue-on-error: false
strategy:
fail-fast: false
matrix:
arch:
- arm64
- amd64
config:
# GCC 13 / LLVM 18
- {
name: "GCC 13 / LLVM 18 @ Ubuntu Release",
build_type: Release,
cxx: "g++-13",
llvm_version: "18.1.0",
llvm_config: "/usr/bin/llvm-config-18",
coverage: "No",
static: "Yes",
debug: "No",
tidy: "No",
run_tests: "No",
libcxx: "No",
bin_name: "insights",
archive_name: "insights-ubuntu",
upload: "Yes",
docs: "Yes",
}
# GCC 13 / LLVM 18
- {
name: "GCC 13 / LLVM 18 @ Ubuntu Code Coverage & Debug",
build_type: Release,
cxx: "g++-13",
llvm_version: "18.1.0",
llvm_config: "/usr/bin/llvm-config-18",
coverage: "Yes",
static: "No",
debug: "Yes",
tidy: "No",
run_tests: "No",
libcxx: "No",
bin_name: "insights",
archive_name: "insights-ubuntu",
}
# GCC 13 / LLVM 18
- {
name: "GCC 13 / LLVM 18 @ Ubuntu Code Coverage (libc++)",
build_type: Release,
cxx: "g++-13",
llvm_version: "18.1.0",
llvm_config: "/usr/bin/llvm-config-18",
coverage: "Yes",
static: "No",
debug: "Yes",
tidy: "No",
run_tests: "No",
libcxx: "Yes",
bin_name: "insights",
archive_name: "insights-ubuntu",
}
steps:
- uses: actions/checkout@v4
with:
path: cppinsights
- name: Create docker shell
shell: bash
run: |
cat > docker-shell << "EOF"
#! /bin/bash
cp $1 ./__cmd.sh
docker run \
--rm \
-v "/var/run/docker.sock":"/var/run/docker.sock" \
-v "/home/runner/work/_temp/_github_home":"/github/home" \
-v "/home/runner/work/_temp/_github_workflow":"/github/workflow" \
-v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" \
-v "/home/runner/work/cppinsights/cppinsights":"/github/workspace" \
--workdir /github/workspace \
--user $(id -u):$(id -g) \
--platform linux/${{ matrix.arch }} \
andreasfertig/cppinsights-builder \
/bin/bash -e ./__cmd.sh
EOF
sudo mv docker-shell /usr/bin/docker-shell
sudo chmod 0755 /usr/bin/docker-shell
- name: Set up QEMU
if: matrix.arch == 'arm64'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Configure
id: cmake_configure
shell: docker-shell {0}
run: |
mkdir build
cd build
CXX=${{ matrix.config.cxx }} cmake -G Ninja -DINSIGHTS_STATIC=${{ matrix.config.static }} -DDEBUG=${{ matrix.config.debug }} -DINSIGHTS_COVERAGE=${{ matrix.config.coverage }} -DINSIGHTS_USE_LIBCPP=${{ matrix.config.libcxx }} ../cppinsights
- name: Build
shell: docker-shell {0}
run: |
cmake --build build
- name: Simple test
if: "((matrix.config.coverage != 'Yes') && (matrix.config.run_tests != 'Yes'))"
shell: docker-shell {0}
run: |
./build/insights cppinsights/tests/SimpleCICompileTest.cpp
./build/insights --use-libc++ cppinsights/tests/SimpleCICompileTest.cpp
- name: Run tests
if: matrix.config.run_tests == 'Yes'
id: run_tests
shell: docker-shell {0}
run: |
cmake --build build --target tests
# docker-shell fails building doc with an unknown reason. Use the original container
- name: Make docs 1/2
if: "((matrix.arch == 'amd64') && (matrix.config.docs == 'Yes'))"
uses: docker://andreasfertig/cppinsights-builder:latest
with:
args: |
/bin/bash -c "cmake --build build --target doc"
- name: Make docs 2/2
if: "((matrix.arch == 'amd64') && (matrix.config.docs == 'Yes'))"
working-directory: ${{ github.workspace }}/build
shell: bash
run: |
sudo chown -R $(id -u):$(id -g) ${GITHUB_WORKSPACE}/build/
ls -l ${GITHUB_WORKSPACE}/build/
ls -l ${GITHUB_WORKSPACE}/build/html
mkdir -p ${GITHUB_WORKSPACE}/build/archive
mv ${GITHUB_WORKSPACE}/build/html ${GITHUB_WORKSPACE}/build/archive/
- name: Run coverage
if: matrix.config.coverage == 'Yes'
id: run_coverage
shell: docker-shell {0}
run: |
cmake --build build --target coverage
rm -f build/coverage.info
- name: Upload code coverage info
if: matrix.config.coverage == 'Yes'
id: run_coverage_upload
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./build/filtered.info # don't use a absolute path on Windows with gitBash.
exclude: build
flags: ${{ matrix.config.archive_name }}-${{ matrix.arch }}-libcxx-${{ matrix.config.libcxx }}
disable_search: true
fail_ci_if_error: true
- name: Create archive
if: matrix.config.upload == 'Yes'
working-directory: ${{ github.workspace }}/build
shell: bash
run: |
mkdir -p ${GITHUB_WORKSPACE}/build/archive
tar -cvzf ${GITHUB_WORKSPACE}/build/archive/${{ matrix.config.archive_name }}-${{ matrix.arch }}.tar.gz ${{ matrix.config.bin_name }}
sha256sum ${GITHUB_WORKSPACE}/build/${{ matrix.config.bin_name }} > ${GITHUB_WORKSPACE}/build/archive/${{ matrix.config.archive_name }}-${{ matrix.arch }}.sha256
- uses: actions/upload-artifact@v3
if: matrix.config.upload == 'Yes'
with:
name: insights-artifact-ubuntu-${{ matrix.arch }}
if-no-files-found: error
path: |
${{ github.workspace }}/build/archive/*
#------------------------------------------------------------------------------
# BUILD INSIDE DOCKER INSIDE LLVM-SOURCE-TREE
#------------------------------------------------------------------------------
in-source-tree:
runs-on: ubuntu-22.04
name: ${{ matrix.config.name }} LLVM source tree
container:
image: andreasfertig/cppinsights-builder
continue-on-error: false
strategy:
fail-fast: false
matrix:
arch:
- amd64
config:
# GCC 13 / LLVM 18
- {
name: "GCC 13 / LLVM 18 @ Ubuntu Release",
build_type: Release,
cxx: "g++-13",
llvm_version: "18.1.0",
llvm_config: "/usr/bin/llvm-config-18",
coverage: "No",
static: "Yes",
debug: "No",
libcxx: "No",
}
steps:
- uses: actions/checkout@v4
with:
path: cppinsights
- uses: actions/checkout@v4
name: Checkout Clang
with:
repository: llvm/llvm-project
ref: llvmorg-${{ env.LLVM_VERSION }}
path: llvm-project
fetch-tags: true
- name: Configure
id: cmake_configure
shell: bash
run: |
mkdir build
cd build
CXX=${{ matrix.config.cxx }}
cmake -G Ninja -D=CMAKE_BUILD_TYPE=Release -DLLVM_EXTERNAL_PROJECTS=cppinsights -DLLVM_EXTERNAL_CPPINSIGHTS_SOURCE_DIR=${GITHUB_WORKSPACE}/cppinsights -DINSIGHTS_STATIC=${{ matrix.config.static }} -DDEBUG=${{ matrix.config.debug }} -DINSIGHTS_COVERAGE=${{ matrix.config.coverage }} -DINSIGHTS_USE_LIBCPP=${{ matrix.config.libcxx }} ${GITHUB_WORKSPACE}/llvm-project/llvm
# For now a successful configure is enough
#------------------------------------------------------------------------------
# DEPLOY
#------------------------------------------------------------------------------
deploy:
needs: [build, docker, in-source-tree]
if: github.ref == 'refs/heads/main'
name: Final Deploy
continue-on-error: false
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
path: cppinsights
fetch-depth: 0
- name: Install node
uses: actions/setup-node@v1
- name: Install gren
id: install_gren
shell: bash
run: |
npm install github-release-notes -g
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: ~/binaries
- name: Generate release notes
env:
GREN_GITHUB_TOKEN: ${{ secrets.GREN_GITHUB_TOKEN }}
shell: bash
run: |
cd ${GITHUB_WORKSPACE}/cppinsights
gren changelog --generate --override --username=andreasfertig --repo=cppinsights -t continuous..`git tag --sort=-creatordate | grep -v continuous | head -n 1 ` -c .github/grenrc.json
sed -in '1,4d' CHANGELOG.md
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "/home/runner/binaries/insights-artifact-*/insights-*"
token: ${{ secrets.GITHUB_TOKEN }}
bodyFile: "${{ github.workspace }}/cppinsights/CHANGELOG.md"
allowUpdates: true
artifactErrorsFailBuild: true
name: continuous
prerelease: true
removeArtifacts: true
tag: continuous
generateReleaseNotes: false
- name: Upload docs to gh-pages
env:
GH_TOKEN: ${{ secrets.GREN_GITHUB_TOKEN }}
run: |
echo "Creating and changing into ${GITHUB_WORKSPACE}/gh-pages"
mkdir ${GITHUB_WORKSPACE}/gh-pages
cd ${GITHUB_WORKSPACE}/gh-pages
echo "Cloning gh-pages repo"
/usr/bin/git clone https://andreasfertig:${GH_TOKEN}@github.com/andreasfertig/andreasfertig.github.io.git .
echo "Setting up git config"
/usr/bin/git config user.name andreasfertig
/usr/bin/git config user.email [email protected]
echo "Rsyncing files to gh-pages"
/usr/bin/rsync -q -av --checksum --progress ~/binaries/insights-artifact-ubuntu-amd64/html/. ${GITHUB_WORKSPACE}/gh-pages --delete --exclude CNAME --exclude .nojekyll --exclude .ssh --exclude .git --exclude .github
/usr/bin/git status --porcelain
echo "Adding all files"
/usr/bin/git add --all .
echo "Committing"
/usr/bin/git commit -m "Deploying to main from main @ ${GITHUB_SHA}" --quiet --no-verify
echo "Pushing"
/usr/bin/git push --force
- name: Notify listeners
run: |
curl -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: token ${{ secrets.GH_TRIGGER }}" https://api.github.com/repos/andreasfertig/cppinsights-container/dispatches -d '{"event_type":"rebuild_trigger"}' &> /dev/null