Skip to content

Commit f228a59

Browse files
committed
Detect Windows Emscripten test failures
1 parent 10e0d5d commit f228a59

File tree

1 file changed

+35
-13
lines changed

1 file changed

+35
-13
lines changed

.github/workflows/emscripten.yml

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,6 @@ jobs:
738738
if: ${{ runner.os == 'windows' }}
739739
shell: powershell
740740
run: |
741-
$ErrorActionPreference = "Stop"
742741
micromamba create -f environment-wasm.yml --platform=emscripten-wasm32
743742
.\emsdk\emsdk activate ${{matrix.emsdk_ver}}
744743
.\emsdk\emsdk_env.ps1
@@ -816,7 +815,19 @@ jobs:
816815
-DSYSROOT_PATH="$env:SYSROOT_PATH" `
817816
..\
818817
}
819-
emmake make -j ${{ env.ncpus }} check-cppinterop
818+
function Error-OnFailure {
819+
param (
820+
[Parameter(Mandatory)]
821+
[ScriptBlock]$Command
822+
)
823+
824+
& $Command
825+
826+
if ($LASTEXITCODE -ne 0) {
827+
exit $LASTEXITCODE
828+
}
829+
}
830+
Error-OnFailure{ emmake make -j ${{ env.ncpus }} check-cppinterop }
820831
cd .\unittests\CppInterOp\
821832
Invoke-WebRequest -Uri "https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win/1411573/chrome-win.zip" -OutFile "$PWD\chrome-win.zip" -Verbose
822833
Expand-Archive -Path "$PWD\chrome-win.zip" -DestinationPath "$PWD" -Force -Verbose
@@ -826,23 +837,34 @@ jobs:
826837
echo "PATH=$env:PATH"
827838
echo "PATH=$env:PATH" >> $env:GITHUB_ENV
828839
echo "Running CppInterOpTests in Firefox"
829-
emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html
840+
Error-OnFailure { emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html }
830841
echo "Running DynamicLibraryManagerTests in Firefox"
831-
emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html
842+
Error-OnFailure { emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html }
832843
echo "Running CppInterOpTests in Chromium"
833-
emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html
844+
Error-OnFailure { emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html }
834845
echo "Running DynamicLibraryManagerTests in Chromium"
835-
emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html
846+
Error-OnFailure { emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html }
836847
cd ..\..
837-
emmake make -j ${{ env.ncpus }} install
848+
Error-OnFailure { emmake make -j ${{ env.ncpus }} install }
838849
839850
- name: Build and Test/Install CppInterOp on Windows systems (static library)
840851
if: ${{ runner.os == 'windows' }}
841852
shell: powershell
842853
run: |
843-
$ErrorActionPreference = "Stop"
844854
.\emsdk\emsdk activate ${{matrix.emsdk_ver}}
845855
.\emsdk\emsdk_env.ps1
856+
function Error-OnFailure {
857+
param (
858+
[Parameter(Mandatory)]
859+
[ScriptBlock]$Command
860+
)
861+
862+
& $Command
863+
864+
if ($LASTEXITCODE -ne 0) {
865+
exit $LASTEXITCODE
866+
}
867+
}
846868
$env:PWD_DIR= $PWD.Path
847869
$env:SYSROOT_PATH="$env:EMSDK/upstream/emscripten/cache/sysroot"
848870
$env:PREFIX="%CONDA_PREFIX%/envs/CppInterOp-wasm"
@@ -915,16 +937,16 @@ jobs:
915937
-DSYSROOT_PATH="$env:SYSROOT_PATH" `
916938
..\
917939
}
918-
emmake make -j ${{ env.ncpus }} check-cppinterop
940+
Error-OnFailure { emmake make -j ${{ env.ncpus }} check-cppinterop }
919941
cd .\unittests\CppInterOp\
920942
echo "Running CppInterOpTests in Firefox"
921-
emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html
943+
Error-OnFailure { emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html }
922944
echo "Running DynamicLibraryManagerTests in Firefox"
923-
emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html
945+
Error-OnFailure { emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html }
924946
echo "Running CppInterOpTests in Chromium"
925-
emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html
947+
Error-OnFailure { emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html }
926948
echo "Running DynamicLibraryManagerTests in Chromium"
927-
emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html
949+
Error-OnFailure{ emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html }
928950
929951
- name: Build xeus-cpp
930952
if: ${{ runner.os != 'windows' }}

0 commit comments

Comments
 (0)