1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-15 20:46:37 +08:00

ci: add pre-test step

This commit is contained in:
Brad King
2025-10-03 18:33:20 -04:00
parent 8d0ecda821
commit 2548b6e24d
5 changed files with 25 additions and 0 deletions

4
.gitlab/ci/pre_test.ps1 Normal file
View File

@@ -0,0 +1,4 @@
$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().MainModule.FileName
if (Test-Path -Path ".gitlab/ci/pre_test_$env:CMAKE_CONFIGURATION.ps1" -PathType Leaf) {
. ".gitlab/ci/pre_test_$env:CMAKE_CONFIGURATION.ps1"
}

18
.gitlab/ci/pre_test.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/bash
set -e
quietly() {
readonly log="/tmp/quietly-$RANDOM.log"
if ! "$@" >"$log" 2>&1; then
ret=$?
cat "$log"
rm -f "$log"
exit $ret
fi
rm -f "$log"
}
if test -r ".gitlab/ci/pre_test_${CMAKE_CONFIGURATION}.sh"; then
source ".gitlab/ci/pre_test_${CMAKE_CONFIGURATION}.sh"
fi

View File

@@ -729,6 +729,7 @@
script:
- *before_script_linux
- .gitlab/ci/pre_test.sh
- "$LAUNCHER ctest --output-on-failure -V -S .gitlab/ci/ctest_test.cmake"
interruptible: true

View File

@@ -214,6 +214,7 @@
script:
- *before_script_macos
- .gitlab/ci/pre_test.sh
- ctest --output-on-failure -V -S .gitlab/ci/ctest_test.cmake
interruptible: true

View File

@@ -471,6 +471,7 @@
script:
- *before_script_windows
- Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1
- (& "$pwsh" -File ".gitlab/ci/pre_test.ps1")
- ctest --output-on-failure -V -S .gitlab/ci/ctest_test.cmake
interruptible: true