Browse Source

Merge topic 'ci-pre-build-post-build'

a7be3c961f ci: build clang-tidy plugin in pre-build step
372ce5bffe ci: add pre-build and post-build steps to Linux

Acked-by: Kitware Robot <[email protected]>
Merge-request: !7989
Brad King 2 years ago
parent
commit
6f619d2de6
4 changed files with 41 additions and 1 deletions
  1. 18 0
      .gitlab/ci/post_build.sh
  2. 18 0
      .gitlab/ci/pre_build.sh
  3. 3 1
      .gitlab/ci/pre_build_fedora37_tidy.sh
  4. 2 0
      .gitlab/os-linux.yml

+ 18 - 0
.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

+ 18 - 0
.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

+ 3 - 1
.gitlab/ci/env_fedora37_tidy.sh → .gitlab/ci/pre_build_fedora37_tidy.sh

@@ -1,7 +1,9 @@
 cmake \
+  -G Ninja \
   -S Utilities/ClangTidyModule \
   -B Utilities/ClangTidyModule/build \
   -DCMAKE_BUILD_TYPE=Release \
-  -DRUN_TESTS=ON
+  -DRUN_TESTS=ON \
+  -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
 cmake --build Utilities/ClangTidyModule/build
 ctest --test-dir Utilities/ClangTidyModule/build --output-on-failure

+ 2 - 0
.gitlab/os-linux.yml

@@ -487,8 +487,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