From 372ce5bffeb665789969b9e9467b82e73d42510f Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 5 Dec 2022 15:38:38 -0500 Subject: 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. --- .gitlab/ci/post_build.sh | 18 ++++++++++++++++++ .gitlab/ci/pre_build.sh | 18 ++++++++++++++++++ .gitlab/os-linux.yml | 2 ++ 3 files changed, 38 insertions(+) create mode 100755 .gitlab/ci/post_build.sh create mode 100755 .gitlab/ci/pre_build.sh 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 -- cgit v0.12 From a7be3c961fd3f192fedda6244e744997be35ef7a Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 5 Dec 2022 15:38:58 -0500 Subject: ci: build clang-tidy plugin in pre-build step And use sccache and Ninja. --- .gitlab/ci/env_fedora37_tidy.sh | 7 ------- .gitlab/ci/pre_build_fedora37_tidy.sh | 9 +++++++++ 2 files changed, 9 insertions(+), 7 deletions(-) delete mode 100644 .gitlab/ci/env_fedora37_tidy.sh create mode 100644 .gitlab/ci/pre_build_fedora37_tidy.sh diff --git a/.gitlab/ci/env_fedora37_tidy.sh b/.gitlab/ci/env_fedora37_tidy.sh deleted file mode 100644 index f9f08a3..0000000 --- a/.gitlab/ci/env_fedora37_tidy.sh +++ /dev/null @@ -1,7 +0,0 @@ -cmake \ - -S Utilities/ClangTidyModule \ - -B Utilities/ClangTidyModule/build \ - -DCMAKE_BUILD_TYPE=Release \ - -DRUN_TESTS=ON -cmake --build Utilities/ClangTidyModule/build -ctest --test-dir Utilities/ClangTidyModule/build --output-on-failure diff --git a/.gitlab/ci/pre_build_fedora37_tidy.sh b/.gitlab/ci/pre_build_fedora37_tidy.sh new file mode 100644 index 0000000..7580ef1 --- /dev/null +++ b/.gitlab/ci/pre_build_fedora37_tidy.sh @@ -0,0 +1,9 @@ +cmake \ + -G Ninja \ + -S Utilities/ClangTidyModule \ + -B Utilities/ClangTidyModule/build \ + -DCMAKE_BUILD_TYPE=Release \ + -DRUN_TESTS=ON \ + -DCMAKE_CXX_COMPILER_LAUNCHER=sccache +cmake --build Utilities/ClangTidyModule/build +ctest --test-dir Utilities/ClangTidyModule/build --output-on-failure -- cgit v0.12