Skip to content

Commit e3c6373

Browse files
authored
Detect Windows Emscripten test failures (#677)
1 parent c3ed9dc commit e3c6373

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
@@ -744,7 +744,6 @@ jobs:
744744
if: ${{ runner.os == 'windows' }}
745745
shell: powershell
746746
run: |
747-
$ErrorActionPreference = "Stop"
748747
micromamba create -f environment-wasm.yml --platform=emscripten-wasm32
749748
.\emsdk\emsdk activate ${{matrix.emsdk_ver}}
750749
.\emsdk\emsdk_env.ps1
@@ -822,7 +821,19 @@ jobs:
822821
-DSYSROOT_PATH="$env:SYSROOT_PATH" `
823822
..\
824823
}
825-
emmake make -j ${{ env.ncpus }} check-cppinterop
824+
function Error-OnFailure {
825+
param (
826+
[Parameter(Mandatory)]
827+
[ScriptBlock]$Command
828+
)
829+
830+
& $Command
831+
832+
if ($LASTEXITCODE -ne 0) {
833+
exit $LASTEXITCODE
834+
}
835+
}
836+
Error-OnFailure{ emmake make -j ${{ env.ncpus }} check-cppinterop }
826837
cd .\unittests\CppInterOp\
827838
Invoke-WebRequest -Uri "https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win/1411573/chrome-win.zip" -OutFile "$PWD\chrome-win.zip" -Verbose
828839
Expand-Archive -Path "$PWD\chrome-win.zip" -DestinationPath "$PWD" -Force -Verbose
@@ -832,23 +843,34 @@ jobs:
832843
echo "PATH=$env:PATH"
833844
echo "PATH=$env:PATH" >> $env:GITHUB_ENV
834845
echo "Running CppInterOpTests in Firefox"
835-
emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html
846+
Error-OnFailure { emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html }
836847
echo "Running DynamicLibraryManagerTests in Firefox"
837-
emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html
848+
Error-OnFailure { emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html }
838849
echo "Running CppInterOpTests in Chromium"
839-
emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html
850+
Error-OnFailure { emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html }
840851
echo "Running DynamicLibraryManagerTests in Chromium"
841-
emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html
852+
Error-OnFailure { emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html }
842853
cd ..\..
843-
emmake make -j ${{ env.ncpus }} install
854+
Error-OnFailure { emmake make -j ${{ env.ncpus }} install }
844855
845856
- name: Build and Test/Install CppInterOp on Windows systems (static library)
846857
if: ${{ runner.os == 'windows' }}
847858
shell: powershell
848859
run: |
849-
$ErrorActionPreference = "Stop"
850860
.\emsdk\emsdk activate ${{matrix.emsdk_ver}}
851861
.\emsdk\emsdk_env.ps1
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+
}
852874
$env:PWD_DIR= $PWD.Path
853875
$env:SYSROOT_PATH="$env:EMSDK/upstream/emscripten/cache/sysroot"
854876
$env:PREFIX="%CONDA_PREFIX%/envs/CppInterOp-wasm"
@@ -921,16 +943,16 @@ jobs:
921943
-DSYSROOT_PATH="$env:SYSROOT_PATH" `
922944
..\
923945
}
924-
emmake make -j ${{ env.ncpus }} check-cppinterop
946+
Error-OnFailure { emmake make -j ${{ env.ncpus }} check-cppinterop }
925947
cd .\unittests\CppInterOp\
926948
echo "Running CppInterOpTests in Firefox"
927-
emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html
949+
Error-OnFailure { emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html }
928950
echo "Running DynamicLibraryManagerTests in Firefox"
929-
emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html
951+
Error-OnFailure { emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html }
930952
echo "Running CppInterOpTests in Chromium"
931-
emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html
953+
Error-OnFailure { emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html }
932954
echo "Running DynamicLibraryManagerTests in Chromium"
933-
emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html
955+
Error-OnFailure{ emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html }
934956
935957
- name: Build xeus-cpp
936958
if: ${{ runner.os != 'windows' }}

0 commit comments

Comments
 (0)