7979 emsdk_ver : " 3.1.73"
8080
8181 steps :
82- - uses : actions/checkout@v4
82+ - uses : actions/checkout@v5
8383 with :
8484 fetch-depth : 0
8585
@@ -175,7 +175,6 @@ jobs:
175175 -DLLVM_EXTERNAL_CLING_SOURCE_DIR=../../cling \
176176 -DCMAKE_BUILD_TYPE=Release \
177177 -DLLVM_HOST_TRIPLE=wasm32-unknown-emscripten \
178- -DLLVM_ENABLE_ASSERTIONS=ON \
179178 -DLLVM_TARGETS_TO_BUILD="${{ matrix.llvm_targets_to_build }}" \
180179 -DLLVM_ENABLE_LIBEDIT=OFF \
181180 -DLLVM_ENABLE_PROJECTS="${{ matrix.llvm_enable_projects }}" \
@@ -194,6 +193,9 @@ jobs:
194193 -DLLVM_ENABLE_LIBPFM=OFF \
195194 -DCLANG_BUILD_TOOLS=OFF \
196195 -DLLVM_NATIVE_TOOL_DIR=$NATIVE_DIR \
196+ -DCMAKE_C_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" \
197+ -DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" \
198+ -DLLVM_ENABLE_LTO=Full \
197199 ../llvm
198200 emmake ninja clang cling lld gtest_main
199201 else
@@ -206,7 +208,6 @@ jobs:
206208 cd build
207209 emcmake cmake -DCMAKE_BUILD_TYPE=Release \
208210 -DLLVM_HOST_TRIPLE=wasm32-unknown-emscripten \
209- -DLLVM_ENABLE_ASSERTIONS=ON \
210211 -DLLVM_TARGETS_TO_BUILD="${{ matrix.llvm_targets_to_build }}" \
211212 -DLLVM_ENABLE_LIBEDIT=OFF \
212213 -DLLVM_ENABLE_PROJECTS="${{ matrix.llvm_enable_projects }}" \
@@ -225,6 +226,9 @@ jobs:
225226 -DCLANG_BUILD_TOOLS=OFF \
226227 -G Ninja \
227228 -DLLVM_NATIVE_TOOL_DIR=$NATIVE_DIR \
229+ -DCMAKE_C_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" \
230+ -DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" \
231+ -DLLVM_ENABLE_LTO=Full \
228232 ../llvm
229233 emmake ninja libclang clangInterpreter clangStaticAnalyzerCore lldWasm
230234 fi
@@ -269,6 +273,13 @@ jobs:
269273
270274 cd llvm-project
271275 # Build
276+ mkdir native_build
277+ cd native_build
278+ cmake -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD=host -DCMAKE_BUILD_TYPE=Release -G Ninja ../llvm/
279+ cmake --build . --target llvm-tblgen clang-tblgen --parallel $(nproc --all)
280+ $env:PWD_DIR= $PWD.Path
281+ $env:NATIVE_DIR="$env:PWD_DIR/bin/"
282+ cd ..
272283 mkdir build
273284 if ( "${{ matrix.cling }}" -imatch "On" )
274285 {
@@ -277,7 +288,6 @@ jobs:
277288 -DLLVM_EXTERNAL_CLING_SOURCE_DIR=../../cling `
278289 -DCMAKE_BUILD_TYPE=Release `
279290 -DLLVM_HOST_TRIPLE=wasm32-unknown-emscripten `
280- -DLLVM_ENABLE_ASSERTIONS=ON `
281291 -DLLVM_TARGETS_TO_BUILD="${{ matrix.llvm_targets_to_build }}" `
282292 -DLLVM_ENABLE_LIBEDIT=OFF `
283293 -DLLVM_ENABLE_PROJECTS="${{ matrix.llvm_enable_projects }}" `
@@ -295,30 +305,32 @@ jobs:
295305 -DLLVM_BUILD_TOOLS=OFF `
296306 -DLLVM_ENABLE_LIBPFM=OFF `
297307 -DCLANG_BUILD_TOOLS=OFF `
308+ -DCMAKE_C_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" `
309+ -DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" `
310+ -DLLVM_ENABLE_LTO=Full `
311+ -DLLVM_NATIVE_TOOL_DIR="$env:NATIVE_DIR" `
298312 ..\llvm
299313 emmake make clang cling lld gtest_main
300314 }
301315 else
302316 {
303317 cp -r ..\patches\llvm\emscripten-clang${{ matrix.clang-runtime }}*
304- cp -r ..\patches\llvm\Windows-emscripten-clang${{ matrix.clang-runtime }}*
305318 #FIXME: Apply patches without hardcoding
306319 if ( "${{ matrix.clang-runtime }}" -imatch "19" )
307320 {
308- git apply -v Windows-emscripten-clang19-1-CrossCompile.patch
309321 git apply -v emscripten-clang19-2-shift-temporary-files-to-tmp-dir.patch
310322 git apply -v emscripten-clang19-3-remove-zdefs.patch
323+ git apply -v emscripten-clang19-4-enable_exception_handling.patch
311324 }
312325 elseif ( "${{ matrix.clang-runtime }}" -imatch "20" )
313326 {
314- git apply -v Windows-emscripten-clang20-1-CrossCompile.patch
315327 git apply -v emscripten-clang20-2-shift-temporary-files-to-tmp-dir.patch
328+ git apply -v emscripten-clang20-3-enable_exception_handling.patch
316329 }
317330 cd build
318331 echo "Apply clang${{ matrix.clang-runtime }}-*.patch patches:"
319332 emcmake cmake -DCMAKE_BUILD_TYPE=Release `
320333 -DLLVM_HOST_TRIPLE=wasm32-unknown-emscripten `
321- -DLLVM_ENABLE_ASSERTIONS=ON `
322334 -DLLVM_TARGETS_TO_BUILD="${{ matrix.llvm_targets_to_build }}" `
323335 -DLLVM_ENABLE_LIBEDIT=OFF `
324336 -DLLVM_ENABLE_PROJECTS="${{ matrix.llvm_enable_projects }}" `
@@ -335,7 +347,11 @@ jobs:
335347 -DLLVM_BUILD_TOOLS=OFF `
336348 -DLLVM_ENABLE_LIBPFM=OFF `
337349 -DCLANG_BUILD_TOOLS=OFF `
350+ -DCMAKE_C_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" `
351+ -DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" `
352+ -DLLVM_ENABLE_LTO=Full `
338353 -G Ninja `
354+ -DLLVM_NATIVE_TOOL_DIR="$env:NATIVE_DIR" `
339355 ..\llvm
340356 emmake ninja libclang clangInterpreter clangStaticAnalyzerCore lldWasm
341357 }
@@ -425,7 +441,7 @@ jobs:
425441 emsdk_ver : " 3.1.73"
426442
427443 steps :
428- - uses : actions/checkout@v4
444+ - uses : actions/checkout@v5
429445 with :
430446 fetch-depth : 0
431447
@@ -519,6 +535,15 @@ jobs:
519535 fi
520536
521537 emmake make -j ${{ env.ncpus }} check-cppinterop
538+ os="${{ matrix.os }}"
539+ if [[ "${os}" != macos* ]] ; then
540+ actual_size=$(stat -c%s "./lib/libclangCppInterOp.so")
541+ max_size=$((40 * 1024 * 1024))
542+ if [[ "$actual_size" -gt "$max_size" ]]; then
543+ echo "Error: libclangCppInterOp.so is larger than 40 MB."
544+ exit 1
545+ fi
546+ fi
522547 cd ./unittests/CppInterOp/
523548 # Fresh install browsers, and run Emscripten tests in them
524549 # This is to match the Emscripten build instructions, where
@@ -564,6 +589,14 @@ jobs:
564589 emrun --browser="Google Chrome" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html
565590 echo "Running DynamicLibraryManagerTests in Google Chrome"
566591 emrun --browser="Google Chrome" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html
592+ sudo safaridriver --enable
593+ python -m pip install selenium
594+ echo "Running CppInterOpTests in Safari"
595+ emrun --no_browser --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html &
596+ python ../../../scripts/browser_tests_safari.py CppInterOpTests.html
597+ echo "Running DynamicLibraryManagerTests in Safari"
598+ emrun --no_browser --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html &
599+ python ../../../scripts/browser_tests_safari.py DynamicLibraryManagerTests.html
567600 else
568601 export ARCHITECHURE=$(uname -m)
569602 if [[ "$ARCHITECHURE" != "aarch64" ]]; then
@@ -673,7 +706,12 @@ jobs:
673706 -DSYSROOT_PATH=$SYSROOT_PATH \
674707 ../
675708 fi
676- emmake make -j ${{ env.ncpus }} check-cppinterop
709+ os="${{ matrix.os }}"
710+ if [[ "${os}" != macos* ]] ; then
711+ EMCC_CORES=1 emmake make -j 1 check-cppinterop
712+ else
713+ EMCC_CORES=2 emmake make -j 2 check-cppinterop
714+ fi
677715 cd ./unittests/CppInterOp/
678716 # Explaination of options for emrun
679717 # --browser (name of browser on path)
@@ -699,6 +737,12 @@ jobs:
699737 emrun --browser="Google Chrome" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html
700738 echo "Running DynamicLibraryManagerTests in Google Chrome"
701739 emrun --browser="Google Chrome" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html
740+ echo "Running CppInterOpTests in Safari"
741+ emrun --no_browser --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html &
742+ python ../../../scripts/browser_tests_safari.py CppInterOpTests.html
743+ echo "Running DynamicLibraryManagerTests in Safari"
744+ emrun --no_browser --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html &
745+ python ../../../scripts/browser_tests_safari.py DynamicLibraryManagerTests.html
702746 else
703747 export ARCHITECHURE=$(uname -m)
704748 if [[ "$ARCHITECHURE" != "aarch64" ]]; then
@@ -738,7 +782,6 @@ jobs:
738782 if : ${{ runner.os == 'windows' }}
739783 shell : powershell
740784 run : |
741- $ErrorActionPreference = "Stop"
742785 micromamba create -f environment-wasm.yml --platform=emscripten-wasm32
743786 .\emsdk\emsdk activate ${{matrix.emsdk_ver}}
744787 .\emsdk\emsdk_env.ps1
@@ -816,16 +859,56 @@ jobs:
816859 -DSYSROOT_PATH="$env:SYSROOT_PATH" `
817860 ..\
818861 }
819- emmake make -j ${{ env.ncpus }} check-cppinterop
820- emmake make -j ${{ env.ncpus }} install
862+ function Error-OnFailure {
863+ param (
864+ [Parameter(Mandatory)]
865+ [ScriptBlock]$Command
866+ )
867+
868+ & $Command
869+
870+ if ($LASTEXITCODE -ne 0) {
871+ exit $LASTEXITCODE
872+ }
873+ }
874+ Error-OnFailure{ emmake make -j ${{ env.ncpus }} check-cppinterop }
875+ cd .\unittests\CppInterOp\
876+ Invoke-WebRequest -Uri "https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win/1411573/chrome-win.zip" -OutFile "$PWD\chrome-win.zip" -Verbose
877+ Expand-Archive -Path "$PWD\chrome-win.zip" -DestinationPath "$PWD" -Force -Verbose
878+ Invoke-WebRequest -Uri "https://download.mozilla.org/?product=firefox-latest-ssl&os=win64&lang=en-US" -OutFile "firefox-setup.exe" -Verbose
879+ & "C:\Program Files\7-Zip\7z.exe" x "firefox-setup.exe"
880+ $env:PATH="$PWD\core;$PWD\chrome-win;$env:PATH"
881+ echo "PATH=$env:PATH"
882+ echo "PATH=$env:PATH" >> $env:GITHUB_ENV
883+ echo "Running CppInterOpTests in Firefox"
884+ Error-OnFailure { emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html }
885+ echo "Running DynamicLibraryManagerTests in Firefox"
886+ Error-OnFailure { emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html }
887+ echo "Running CppInterOpTests in Chromium"
888+ Error-OnFailure { emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html }
889+ echo "Running DynamicLibraryManagerTests in Chromium"
890+ Error-OnFailure { emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html }
891+ cd ..\..
892+ Error-OnFailure { emmake make -j ${{ env.ncpus }} install }
821893
822894 - name : Build and Test/Install CppInterOp on Windows systems (static library)
823895 if : ${{ runner.os == 'windows' }}
824896 shell : powershell
825897 run : |
826- $ErrorActionPreference = "Stop"
827898 .\emsdk\emsdk activate ${{matrix.emsdk_ver}}
828899 .\emsdk\emsdk_env.ps1
900+ function Error-OnFailure {
901+ param (
902+ [Parameter(Mandatory)]
903+ [ScriptBlock]$Command
904+ )
905+
906+ & $Command
907+
908+ if ($LASTEXITCODE -ne 0) {
909+ exit $LASTEXITCODE
910+ }
911+ }
829912 $env:PWD_DIR= $PWD.Path
830913 $env:SYSROOT_PATH="$env:EMSDK/upstream/emscripten/cache/sysroot"
831914 $env:PREFIX="%CONDA_PREFIX%/envs/CppInterOp-wasm"
@@ -898,7 +981,16 @@ jobs:
898981 -DSYSROOT_PATH="$env:SYSROOT_PATH" `
899982 ..\
900983 }
901- emmake make -j ${{ env.ncpus }} check-cppinterop
984+ Error-OnFailure { emmake make -j ${{ env.ncpus }} check-cppinterop }
985+ cd .\unittests\CppInterOp\
986+ echo "Running CppInterOpTests in Firefox"
987+ Error-OnFailure { emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html }
988+ echo "Running DynamicLibraryManagerTests in Firefox"
989+ Error-OnFailure { emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html }
990+ echo "Running CppInterOpTests in Chromium"
991+ Error-OnFailure { emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html }
992+ echo "Running DynamicLibraryManagerTests in Chromium"
993+ Error-OnFailure{ emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html }
902994
903995 - name : Build xeus-cpp
904996 if : ${{ runner.os != 'windows' }}
0 commit comments