diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2022-12-05 20:38:38 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-12-05 22:43:31 (GMT) |
commit | 372ce5bffeb665789969b9e9467b82e73d42510f (patch) | |
tree | 7e9ac2aeaba4c070e16d70168bddcdf4eee85459 /.gitlab | |
parent | e0a35098bb2874ac7d6bca5b1a989c293ad18922 (diff) | |
download | CMake-372ce5bffeb665789969b9e9467b82e73d42510f.zip CMake-372ce5bffeb665789969b9e9467b82e73d42510f.tar.gz CMake-372ce5bffeb665789969b9e9467b82e73d42510f.tar.bz2 |
ci: add pre-build and post-build steps to Linux
The pre-build step will allow actions to be executed before the
CMake build but after Ninja and sccache have been downloaded, so
they can be used in the pre-build step. The env step is meant for
setting up environment variables anyway, rather than performing
actions.
The post-build step will allow extra artifacts to be computed after
the build is complete.
Diffstat (limited to '.gitlab')
-rwxr-xr-x | .gitlab/ci/post_build.sh | 18 | ||||
-rwxr-xr-x | .gitlab/ci/pre_build.sh | 18 | ||||
-rw-r--r-- | .gitlab/os-linux.yml | 2 |
3 files changed, 38 insertions, 0 deletions
diff --git a/.gitlab/ci/post_build.sh b/.gitlab/ci/post_build.sh new file mode 100755 index 0000000..0edd9f6 --- /dev/null +++ b/.gitlab/ci/post_build.sh @@ -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/post_build_${CMAKE_CONFIGURATION}.sh"; then + source ".gitlab/ci/post_build_${CMAKE_CONFIGURATION}.sh" +fi diff --git a/.gitlab/ci/pre_build.sh b/.gitlab/ci/pre_build.sh new file mode 100755 index 0000000..7ff6a69 --- /dev/null +++ b/.gitlab/ci/pre_build.sh @@ -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_build_${CMAKE_CONFIGURATION}.sh"; then + source ".gitlab/ci/pre_build_${CMAKE_CONFIGURATION}.sh" +fi diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index decf1b1..a05fec7 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -465,8 +465,10 @@ - .gitlab/ci/sccache.sh - sccache --start-server - sccache --show-stats + - .gitlab/ci/pre_build.sh - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_configure.cmake" - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_build.cmake" + - .gitlab/ci/post_build.sh - sccache --show-stats interruptible: true |