30
30
uses : actions/checkout@v4
31
31
32
32
- name : Generate Test Matrix
33
- uses :
alandefreitas/cpp-actions/[email protected] .10
33
+ uses :
alandefreitas/cpp-actions/[email protected] .11
34
34
id : cpp-matrix
35
35
with :
36
36
compilers : |
42
42
latest-factors : |
43
43
msvc Optimized-Debug
44
44
gcc UBSan Coverage
45
- clang UBSan ASan
45
+ clang UBSan ASan MSan
46
46
apple-clang UBSan ASan
47
47
factors : ' '
48
48
runs-on : |
@@ -66,21 +66,29 @@ jobs:
66
66
clang: git build-essential pkg-config python3 curl openjdk-11-jdk pkg-config libncurses-dev libxml2-utils libxml2-dev g++-14=14.2.0-4ubuntu2~24.04
67
67
msvc: ''
68
68
extra-values : |
69
- llvm-hash: a1b6e7ff393533a5c4f3bdfd4efe5da106e2de2b
70
- llvm-build-preset-prefix: {{#if optimized-debug}}debwithopt{{else}}{{{lowercase build-type}}}{{/if}}
69
+ use-libcxx: {{#if (and (ieq compiler 'clang') (or (eq major 19) (eq major 20) (eq major 21))) }}true{{else}}false{{/if}}
70
+ libcxx-runtimes: libcxx{{#if (ne compiler 'msvc')}};libcxxabi{{/if}}
71
+ llvm-runtimes: {{#if (ine use-libcxx 'true') }}{{{ libcxx-runtimes }}}{{/if}}
72
+ llvm-path: {{#if (ieq compiler 'msvc') }}D:/a{{else if (ieq compiler 'apple-clang')}}/Users/runner/work{{else}}/__w{{/if}}/llvm
73
+ llvm-hash: 3f797a8342c3dbe4a260b26f948d8776ff490431
74
+ llvm-build-preset-prefix: {{#if optimized-debug}}optimizeddebug{{else}}{{{lowercase build-type}}}{{/if}}
71
75
llvm-build-preset-os: {{#if (ieq os 'windows') }}win{{else}}unix{{/if}}
72
76
llvm-sanitizer: {{#if (eq compiler 'gcc')}}{{else if ubsan}}-UBSan{{else if asan}}-ASan{{else if msan}}-MSan{{/if}}
73
77
llvm-build-preset: {{{ llvm-build-preset-prefix }}}-{{{ llvm-build-preset-os }}}
74
78
llvm-compiler-version: {{#if (or (contains version '*') (contains version '^'))}}{{else}}-{{{ version }}}{{/if}}
75
79
llvm-archive-basename: llvm-{{{ lowercase os }}}-{{{ compiler }}}{{{ llvm-compiler-version }}}-{{{ llvm-build-preset-prefix }}}{{{ llvm-sanitizer }}}-{{{ substr llvm-hash 0 7 }}}
76
- llvm-root: ../third-party/llvm-project/install
77
80
llvm-archive-extension: {{#if (ieq os 'windows') }}7z{{else}}tar.bz2{{/if}}
78
81
llvm-archive-filename: {{{ llvm-archive-basename }}}.{{{ llvm-archive-extension }}}
79
82
llvm-sanitizer-config: {{#if (and (ne compiler 'clang') (ne compiler 'apple-clang'))}}{{else if ubsan}}Undefined{{else if asan}}Address{{else if msan}}MemoryWithOrigins{{/if}}
80
- mrdocs-flags: {{#if (and (eq compiler 'gcc') (not asan)) }}-static{{/if}}{{#if (and (eq compiler 'clang') msan) }}-fsanitize-memory-track-origins{{/if}}
81
- mrdocs-ccflags: {{{ ccflags }}} {{{ mrdocs-flags }}}
82
- mrdocs-cxxflags: {{{ cxxflags }}} {{{ mrdocs-flags }}}
83
- mrdocs-linkflags: {{#if asan }}-fsanitize=address{{/if}}
83
+ common-flags-base: {{#if (ieq compiler 'clang')}}-gz=zstd {{/if}}
84
+ common-flags: {{{ common-flags-base }}}{{#if msan }}-fsanitize-memory-track-origins {{/if}}
85
+ common-cxxflags-base: {{#if (ieq use-libcxx 'true') }}-nostdinc++ -nostdlib++ -isystem{{{ llvm-path }}}/include/c++/v1{{/if}}
86
+ common-ccflags: {{{ ccflags }}} {{{ common-flags }}}
87
+ common-cxxflags: {{{ cxxflags }}} {{{ common-flags }}} {{{ common-cxxflags-base }}}
88
+ common-ldflags: {{{ ldflags }}} {{#if (ieq use-libcxx 'true') }}-L{{{ llvm-path }}}/lib -lc++abi -lc++ -Wl,-rpath,{{{ llvm-path }}}/lib {{/if}}{{#if ubsan }}-fsanitize=undefined {{/if}}{{#if asan }}-fsanitize=address {{/if}}{{#if msan }}-fsanitize=memory {{/if}}
89
+ mrdocs-flags: {{#if (and (eq compiler 'gcc') (not asan)) }}-static{{/if}}
90
+ mrdocs-ccflags: {{{ common-ccflags }}} {{{ mrdocs-flags }}}
91
+ mrdocs-cxxflags: {{{ common-cxxflags }}} {{{ mrdocs-flags }}}
84
92
mrdocs-package-generators: {{#if (ieq os 'windows') }}7Z ZIP WIX{{else}}TGZ TXZ{{/if}}
85
93
mrdocs-release-package-artifact: release-packages-{{{ lowercase os }}}
86
94
output-file : matrix.json
@@ -135,7 +143,7 @@ jobs:
135
143
# We need git to ensure actions/checkout@v4 will use git and
136
144
# for the next steps that need to clone repositories
137
145
- name : Install Git
138
- uses :
alandefreitas/cpp-actions/[email protected] .10
146
+ uses :
alandefreitas/cpp-actions/[email protected] .11
139
147
if : matrix.container != ''
140
148
env :
141
149
DEBIAN_FRONTEND : ' noninteractive'
@@ -164,7 +172,7 @@ jobs:
164
172
uses : seanmiddleditch/gha-setup-ninja@v5
165
173
166
174
- name : Setup C++
167
- uses :
alandefreitas/cpp-actions/[email protected] .10
175
+ uses :
alandefreitas/cpp-actions/[email protected] .11
168
176
id : setup-cpp
169
177
with :
170
178
compiler : ${{ matrix.compiler }}
@@ -189,7 +197,7 @@ jobs:
189
197
${{ steps.setup-cpp.outputs.cxx }} --print-target-triple
190
198
191
199
- name : Install System Packages
192
- uses :
alandefreitas/cpp-actions/[email protected] .10
200
+ uses :
alandefreitas/cpp-actions/[email protected] .11
193
201
if : matrix.compiler != 'msvc'
194
202
id : package-install
195
203
env :
@@ -198,18 +206,15 @@ jobs:
198
206
with :
199
207
apt-get : ${{ matrix.install }}
200
208
201
- - name : Resolve LLVM Root
202
- id : resolve-llvm-root
209
+ - name : Install LLVM packages
210
+ if : matrix.compiler == 'clang'
211
+ env :
212
+ DEBIAN_FRONTEND : ' noninteractive'
213
+ TZ : ' Etc/UTC'
203
214
run : |
204
- set -x
205
- cd ..
206
- llvm_root=$(pwd)/third-party/llvm-project/install
207
- if [[ ${{ runner.os }} == 'Windows' ]]; then
208
- llvm_root=$(echo "$llvm_root" | sed 's/\\/\//g')
209
- llvm_root=$(echo $llvm_root | sed 's|^/d/|D:/|')
210
- echo "$llvm_root"
211
- fi
212
- echo -E "llvm-root=$llvm_root" >> $GITHUB_OUTPUT
215
+ echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-21 main" >> /etc/apt/sources.list
216
+ apt-get update
217
+ apt-get install -y libclang-18-dev libclang-19-dev libclang-20-dev libclang-21-dev
213
218
214
219
- name : Resolve Third-Party Directory
215
220
id : resolve-third-party-dir
@@ -228,7 +233,7 @@ jobs:
228
233
id : llvm-cache
229
234
uses : actions/cache@v4
230
235
with :
231
- path : ${{ steps.resolve- llvm-root.outputs.llvm-root }}
236
+ path : ${{ matrix. llvm-path }}
232
237
key : ${{ matrix.llvm-archive-basename }}
233
238
234
239
- name : Download LLVM Binaries
@@ -242,7 +247,7 @@ jobs:
242
247
found="true"
243
248
echo "found=$found" >> $GITHUB_OUTPUT
244
249
curl -L -o ${{ matrix.llvm-archive-filename }} "$url"
245
- install_prefix=$(pwd)/../third-party/ llvm-project/install
250
+ install_prefix=${{ matrix. llvm-path }}
246
251
mkdir -p $install_prefix
247
252
if [[ ${{ matrix.llvm-archive-extension }} == '7z' ]]; then
248
253
7z x ${{ matrix.llvm-archive-filename }} -o$install_prefix
@@ -261,9 +266,50 @@ jobs:
261
266
echo "found=$found" >> $GITHUB_OUTPUT
262
267
fi
263
268
269
+ # Installs libc++ separately, using the LLVM standalone runtimes build.
270
+ # The libc++ built here will be built using the host compiler, so this is
271
+ # limited by what libc++ at the current LLVM revision supports.
272
+ # This will be only built for configurations where 'use-libcxx' is true,
273
+ # and in which case libc++ will **not** be built again later using the
274
+ # bootstrapping runtimes build.
275
+ - name : Install libc++
276
+ id : install_libcxx
277
+ uses :
alandefreitas/cpp-actions/[email protected]
278
+ if : matrix.use-libcxx == 'true' && steps.llvm-cache.outputs.cache-hit != 'true' && steps.llvm-download.outputs.found != 'true'
279
+ with :
280
+ cmake-version : ' >=3.26'
281
+ source-dir : ../third-party/llvm-project/runtimes
282
+ git-repository : https://github.com/llvm/llvm-project.git
283
+ git-tag : ${{ matrix.llvm-hash }}
284
+ download-dir : ../third-party/llvm-project
285
+ build-dir : ${sourceDir}/build
286
+ build-type : ${{ matrix.build-type }}
287
+ extra-args : |
288
+ -D LLVM_USE_SANITIZER=${{ matrix.llvm-sanitizer-config }}
289
+ -D LLVM_OPTIMIZED_TABLEGEN=ON
290
+ -D LLVM_ENABLE_LIBCXX=OFF
291
+ -D LLVM_ENABLE_PROJECT=""
292
+ -D LLVM_ENABLE_RUNTIMES="${{ matrix.libcxx-runtimes }}"
293
+ -D LIBCXXABI_USE_LLVM_UNWINDER=OFF
294
+ -D CMAKE_C_FLAGS="${{ matrix.common-flags-base }}"
295
+ -D CMAKE_CXX_FLAGS="${{ matrix.common-flags-base }}"
296
+
297
+ cc : ${{ steps.setup-cpp.outputs.cc }}
298
+ cxx : ${{ steps.setup-cpp.outputs.cxx }}
299
+ generator : Ninja
300
+ install : true
301
+ install-prefix : ${{ matrix.llvm-path }}
302
+ run-tests : false
303
+ trace-commands : true
304
+
305
+ - name : Remove libcxx build-dir
306
+ if : steps.install_libcxx.outcome == 'success'
307
+ run : |
308
+ rm -r ../third-party/llvm-project/runtimes/build
309
+
264
310
- name : Install LLVM
265
311
id : install_llvm
266
- uses :
alandefreitas/cpp-actions/[email protected] .10
312
+ uses :
alandefreitas/cpp-actions/[email protected] .11
267
313
if : steps.llvm-cache.outputs.cache-hit != 'true' && steps.llvm-download.outputs.found != 'true'
268
314
with :
269
315
cmake-version : ' >=3.26'
@@ -274,29 +320,37 @@ jobs:
274
320
patches : |
275
321
./third-party/llvm/CMakePresets.json
276
322
./third-party/llvm/CMakeUserPresets.json
277
- build-dir : ${sourceDir}/llvm/ build
323
+ build-dir : ${sourceDir}/build
278
324
preset : ${{ matrix.llvm-build-preset }}
279
325
build-type : ${{ matrix.build-type }}
280
- # The LLVM_USE_SANITIZER option doesn't support GCC.
281
326
extra-args : |
282
- -DLLVM_USE_SANITIZER=${{ matrix.llvm-sanitizer-config }}
327
+ -D LLVM_ENABLE_ASSERTIONS=ON
328
+ -D LLVM_USE_SANITIZER="${{ matrix.llvm-sanitizer-config }}"
329
+ -D LLVM_OPTIMIZED_TABLEGEN=ON
330
+ -D LLVM_COMPILER_CHECKED=ON
331
+ -D LLVM_BUILD_TOOLS=OFF
332
+ -D CLANG_BUILD_TOOLS=OFF
333
+ -D LLVM_ENABLE_RUNTIMES="${{ matrix.llvm-runtimes }}"
334
+ -D LIBCXXABI_USE_LLVM_UNWINDER=OFF
335
+ -D CMAKE_C_FLAGS="${{ matrix.common-flags-base }}"
336
+ -D CMAKE_CXX_FLAGS="${{ matrix.common-flags-base }} ${{ matrix.common-cxxflags-base }}"
337
+ -D CMAKE_SHARED_LINKER_FLAGS="${{ matrix.common-ldflags }}"
338
+ -D CMAKE_EXE_LINKER_FLAGS="${{ matrix.common-ldflags }}"
283
339
cc : ${{ steps.setup-cpp.outputs.cc }}
284
340
cxx : ${{ steps.setup-cpp.outputs.cxx }}
285
- ccflags : -gz=zstd
286
- cxxflags : -gz=zstd
287
341
generator : Ninja
288
342
install : true
289
- install-prefix : ${sourceDir}/../install
343
+ install-prefix : ${{ matrix.llvm-path }}
290
344
run-tests : false
291
345
trace-commands : true
292
346
293
347
- name : Remove LLVM build-dir
294
348
if : steps.install_llvm.outcome == 'success'
295
349
run : |
296
- rm -r ../third-party/llvm-project/llvm/llvm/build
350
+ rm -r ../third-party/llvm-project
297
351
298
352
- name : Install Duktape
299
- uses :
alandefreitas/cpp-actions/[email protected] .10
353
+ uses :
alandefreitas/cpp-actions/[email protected] .11
300
354
with :
301
355
source-dir : ../third-party/duktape
302
356
url : https://github.com/svaarala/duktape/releases/download/v2.7.0/duktape-2.7.0.tar.xz
@@ -306,8 +360,8 @@ jobs:
306
360
build-dir : ${sourceDir}/build
307
361
cc : ${{ steps.setup-cpp.outputs.cc }}
308
362
cxx : ${{ steps.setup-cpp.outputs.cxx }}
309
- ccflags : ${{ matrix.ccflags }}
310
- cxxflags : ${{ matrix.cxxflags }}
363
+ ccflags : ${{ matrix.common- ccflags }}
364
+ cxxflags : ${{ matrix.common- cxxflags }}
311
365
build-type : ${{ matrix.build-type }}
312
366
shared : false
313
367
install : true
@@ -316,7 +370,7 @@ jobs:
316
370
trace-commands : true
317
371
318
372
- name : Install Libxml2
319
- uses :
alandefreitas/cpp-actions/[email protected] .10
373
+ uses :
alandefreitas/cpp-actions/[email protected] .11
320
374
if : matrix.compiler == 'msvc'
321
375
with :
322
376
source-dir : ../third-party/libxml2
@@ -325,11 +379,12 @@ jobs:
325
379
build-dir : ${sourceDir}/build
326
380
cc : ${{ steps.setup-cpp.outputs.cc }}
327
381
cxx : ${{ steps.setup-cpp.outputs.cxx }}
328
- ccflags : ${{ matrix.ccflags }}
329
- cxxflags : ${{ matrix.cxxflags }}
382
+ ccflags : ${{ matrix.common- ccflags }}
383
+ cxxflags : ${{ matrix.common- cxxflags }}
330
384
build-type : Release
331
385
shared : false
332
386
extra-args : |
387
+ -D CMAKE_SHARED_LINKER_FLAGS="${{ matrix.common-ldflags }}"
333
388
-D LIBXML2_WITH_PROGRAMS=ON
334
389
-D LIBXML2_WITH_FTP=OFF
335
390
-D LIBXML2_WITH_HTTP=OFF
@@ -374,7 +429,7 @@ jobs:
374
429
node-version : ' 20'
375
430
376
431
- name : CMake Workflow
377
- uses :
alandefreitas/cpp-actions/[email protected] .10
432
+ uses :
alandefreitas/cpp-actions/[email protected] .11
378
433
with :
379
434
cmake-version : ' >=3.26'
380
435
cxxstd : ${{ matrix.cxxstd }}
@@ -388,11 +443,10 @@ jobs:
388
443
install-prefix : .local
389
444
extra-args : |
390
445
-D MRDOCS_BUILD_DOCS=OFF
391
- -D CMAKE_EXE_LINKER_FLAGS=${{ matrix.mrdocs-linkflags }}
392
- -D LLVM_ROOT=${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/llvm-project/install
393
- -D Clang_ROOT=${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/llvm-project/install
394
- -D duktape_ROOT=${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install
395
- -D Duktape_ROOT=${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install
446
+ -D CMAKE_EXE_LINKER_FLAGS="${{ matrix.common-ldflags }}"
447
+ -D LLVM_ROOT="${{ matrix.llvm-path }}"
448
+ -D duktape_ROOT="${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install"
449
+ -D Duktape_ROOT="${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install"
396
450
${{ runner.os == 'Windows' && '-D libxml2_ROOT=../third-party/libxml2/install' || '' }}
397
451
${{ runner.os == 'Windows' && '-D LibXml2_ROOT=../third-party/libxml2/install' || '' }}
398
452
export-compile-commands : true
@@ -423,7 +477,7 @@ jobs:
423
477
retention-days : 1
424
478
425
479
- name : FlameGraph
426
- uses :
alandefreitas/cpp-actions/[email protected] .10
480
+ uses :
alandefreitas/cpp-actions/[email protected] .11
427
481
if : matrix.time-trace
428
482
with :
429
483
build-dir : build
@@ -493,7 +547,7 @@ jobs:
493
547
494
548
steps :
495
549
- name : Install packages
496
- uses :
alandefreitas/cpp-actions/[email protected] .10
550
+ uses :
alandefreitas/cpp-actions/[email protected] .11
497
551
id : package-install
498
552
with :
499
553
apt-get : build-essential asciidoctor cmake bzip2 git
@@ -555,7 +609,7 @@ jobs:
555
609
$MRDOCS_ROOT/bin/mrdocs --version
556
610
557
611
- name : Clone Boost.URL
558
- uses :
alandefreitas/cpp-actions/[email protected] .10
612
+ uses :
alandefreitas/cpp-actions/[email protected] .11
559
613
id : boost-url-clone
560
614
with :
561
615
branch : develop
@@ -822,7 +876,7 @@ jobs:
822
876
scp -o StrictHostKeyChecking=no -r $(pwd)/demos/* [email protected] :$demo_dir/
823
877
824
878
- name : Create changelog
825
- uses :
alandefreitas/cpp-actions/[email protected] .10
879
+ uses :
alandefreitas/cpp-actions/[email protected] .11
826
880
with :
827
881
output-path : CHANGELOG.md
828
882
thank-non-regular : ${{ startsWith(github.ref, 'refs/tags/') }}
@@ -864,7 +918,7 @@ jobs:
864
918
865
919
steps :
866
920
- name : Install packages
867
- uses :
alandefreitas/cpp-actions/[email protected] .10
921
+ uses :
alandefreitas/cpp-actions/[email protected] .11
868
922
id : package-install
869
923
with :
870
924
apt-get : ${{ matrix.install }}
@@ -882,25 +936,12 @@ jobs:
882
936
fi
883
937
echo "exists=$exists" >> $GITHUB_OUTPUT
884
938
885
- - name : Resolve LLVM Root
886
- id : resolve-llvm-root
887
- run : |
888
- set -x
889
- cd ..
890
- llvm_root=$(pwd)/third-party/llvm-project/install
891
- if [[ ${{ runner.os }} == 'Windows' ]]; then
892
- llvm_root=$(echo "$llvm_root" | sed 's/\\/\//g')
893
- llvm_root=$(echo $llvm_root | sed 's|^/d/|D:/|')
894
- echo "$llvm_root"
895
- fi
896
- echo -E "llvm-root=$llvm_root" >> $GITHUB_OUTPUT
897
-
898
939
- name : LLVM Binaries
899
940
id : llvm-cache
900
941
if : steps.website-releases.outputs.exists != 'true'
901
942
uses : actions/cache@v4
902
943
with :
903
- path : ${{ steps.resolve- llvm-root.outputs.llvm-root }}
944
+ path : ${{ matrix. llvm-path }}
904
945
key : ${{ matrix.llvm-archive-basename }}
905
946
906
947
- name : Compress LLVM
@@ -910,20 +951,16 @@ jobs:
910
951
run : |
911
952
# LLVM is be installed with the default compiler
912
953
set -x
913
-
914
- # Compress the LLVM installation
915
- cd ../third-party/llvm-project
916
-
954
+
917
955
# Use 7z on windows
918
956
if [[ ${{ runner.os }} == 'Windows' ]]; then
919
- 7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on ${{ matrix.llvm-archive-filename }} install
957
+ 7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on " ${{ matrix.llvm-archive-filename }}" "${{ matrix.llvm-path }}"
920
958
else
921
- tar -cjf ${{ matrix.llvm-archive-filename }} -C install .
959
+ tar -cjf " ${{ matrix.llvm-archive-filename }}" -C "${{ matrix.llvm-path }}/.." llvm
922
960
fi
923
961
924
962
- name : Website LLVM Releases
925
963
if : steps.llvm-cache.outputs.cache-hit == 'true' && github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/'))
926
- working-directory : ../third-party/llvm-project
927
964
run : |
928
965
set -x
929
966
0 commit comments