@@ -3,7 +3,9 @@
# Check whether the build created anything not in our .gitignore
#
-. ${0%/*}/lib.sh
+set -ex
+
+. ${0%/*}/lib-tput.sh
check_unignored_build_artifacts ()
{
@@ -3,7 +3,7 @@
# Install dependencies required to build and test Git on Linux and macOS
#
-. ${0%/*}/lib.sh
+set -ex
UBUNTU_COMMON_PKGS="make libssl-dev libcurl4-openssl-dev libexpat-dev
tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl
new file mode 100644
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+if test "$GITHUB_ACTIONS" = "true"
+then
+ CI_TYPE=github-actions
+else
+ echo "Could not identify CI type" >&2
+ exit 1
+fi
new file mode 100644
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# GitHub Action doesn't set TERM, which is required by tput
+TERM=${TERM:-dumb}
+export TERM
@@ -1,13 +1,9 @@
#!/bin/sh
-
-# Library of functions shared by all CI scripts
-
-# Set 'exit on error' for all CI scripts to let the caller know that
-# something went wrong.
-# Set tracing executed commands, primarily setting environment variables
-# and installing dependencies.
set -ex
+# Helper libraries
+. ${0%/*}/lib-ci-type.sh
+
# Starting assertions
if test -z "$jobname"
then
@@ -47,18 +43,14 @@ setenv () {
fi
}
-# GitHub Action doesn't set TERM, which is required by tput
-setenv TERM ${TERM:-dumb}
-
# How many jobs to run in parallel?
NPROC=10
# Clear MAKEFLAGS that may come from the outside world.
MAKEFLAGS=--jobs=$NPROC
-if test "$GITHUB_ACTIONS" = "true"
-then
- CI_TYPE=github-actions
+case "$CI_TYPE" in
+github-actions)
CC="${CC:-gcc}"
setenv --test GIT_PROVE_OPTS "--timer --jobs $NPROC"
@@ -66,11 +58,12 @@ then
test Windows != "$RUNNER_OS" ||
GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS"
setenv --test GIT_TEST_OPTS "$GIT_TEST_OPTS"
-else
- echo "Could not identify CI type" >&2
- env >&2
+ ;;
+*)
+ echo "Unhandled CI type: $CI_TYPE" >&2
exit 1
-fi
+ ;;
+esac
setenv --build DEVELOPER 1
setenv --test DEFAULT_TEST_TARGET prove
@@ -3,10 +3,10 @@
# Print output of failing tests
#
-. ${0%/*}/lib.sh
+set -e
-# Tracing executed commands would produce too much noise in the loop below.
-set +x
+. ${0%/*}/lib-ci-type.sh
+. ${0%/*}/lib-tput.sh
cd t/
@@ -3,7 +3,7 @@
# Select a portion of the tests for testing Git in parallel
#
-. ${0%/*}/lib.sh
+set -ex
tests=$(echo $(cd t && ./helper/test-tool path-utils slice-tests "$1" "$2" \
t[0-9]*.sh))
@@ -3,7 +3,7 @@
# Perform sanity checks on "make doc" output and built documentation
#
-. ${0%/*}/lib.sh
+set -ex
generator=$1
Change the scripts in ci/ to stop using ci/lib.sh as a library, now that the only thing it did for them was to "set -ex" and possibly set TERM=dumb. Let's create a ci/lib-tput.sh for those that need to use "tput" instead, and have these scripts invoke "set -ex" themselves. This makes their invocation a lot less verbose, since they'll be relying on an earlier step in the CI job to have set the variables in $GITHUB_ENV, and won't be spewing their own trace output to set those variables again. Let's also create a ci/lib-ci-type.sh, and have ci/lib.sh and ci/print-test-failures.sh share the logic to discover the CI type. We could have set the CI_TYPE in the environment with "setenv", but let's avoid that verbosity for this purely internal variable. The "ci/lib.sh" is now no longer a "Library of functions shared by all CI scripts", so let's remove that commentary, and the misleading comment about "set -ex" being for "installing dependencies", we're now no longer using it in "ci/install-dependencies.sh" (but it does its own "set -ex"). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- ci/check-unignored-build-artifacts.sh | 4 +++- ci/install-dependencies.sh | 2 +- ci/lib-ci-type.sh | 9 +++++++++ ci/lib-tput.sh | 5 +++++ ci/lib.sh | 27 ++++++++++----------------- ci/print-test-failures.sh | 6 +++--- ci/select-test-slice.sh | 2 +- ci/test-documentation.sh | 2 +- 8 files changed, 33 insertions(+), 24 deletions(-) create mode 100644 ci/lib-ci-type.sh create mode 100644 ci/lib-tput.sh