summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-01-03 12:09:37 -0500
committerBen Gamari <ben@smart-cactus.org>2021-02-22 21:38:28 -0500
commitfa1b39e558f04eec5616dbc16b2e9118e1d53716 (patch)
tree83dd98ff3f051d4e4c0f8d380d3575329eb0f8c0
parent34aa3fb041058679d52edb804f612490734fefa0 (diff)
downloadhaskell-fa1b39e558f04eec5616dbc16b2e9118e1d53716.tar.gz
gitlab-ci: Run ci.sh through shellcheck
It is now shellcheck-clean.
-rwxr-xr-x.gitlab/ci.sh32
-rw-r--r--.gitlab/common.sh4
2 files changed, 21 insertions, 15 deletions
diff --git a/.gitlab/ci.sh b/.gitlab/ci.sh
index dd29f15830..9aff04514c 100755
--- a/.gitlab/ci.sh
+++ b/.gitlab/ci.sh
@@ -17,7 +17,8 @@ if [ ! -d "$TOP/.gitlab" ]; then
echo "This script expects to be run from the root of a ghc checkout"
fi
-source $TOP/.gitlab/common.sh
+# shellcheck source=.gitlab/common.sh
+source "$TOP/.gitlab/common.sh"
function usage() {
cat <<EOF
@@ -386,7 +387,7 @@ function configure() {
run ./configure \
--enable-tarballs-autodownload \
$target_args \
- $CONFIGURE_ARGS \
+ "${CONFIGURE_ARGS[@]}" \
GHC="$GHC" \
HAPPY="$HAPPY" \
ALEX="$ALEX" \
@@ -407,7 +408,7 @@ function build_make() {
echo "include mk/flavours/${BUILD_FLAVOUR}.mk" > mk/build.mk
echo 'GhcLibHcOpts+=-haddock' >> mk/build.mk
- run "$MAKE" -j"$cores" $MAKE_ARGS
+ run "$MAKE" -j"$cores" "${MAKE_ARGS[@]}"
run "$MAKE" -j"$cores" binary-dist-prep TAR_COMP_OPTS=-1
ls -lh "$BIN_DIST_PREP_TAR_COMP"
}
@@ -430,7 +431,8 @@ function push_perf_notes() {
# Figure out which commit should be used by the testsuite driver as a
# performance baseline. See Note [The CI Story].
function determine_metric_baseline() {
- export PERF_BASELINE_COMMIT="$(git merge-base $CI_MERGE_REQUEST_TARGET_BRANCH_NAME HEAD)"
+ export PERF_BASELINE_COMMIT
+ PERF_BASELINE_COMMIT="$(git merge-base "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" HEAD)"
info "Using $PERF_BASELINE_COMMIT for performance metric baseline..."
}
@@ -462,7 +464,7 @@ function build_hadrian() {
run_hadrian binary-dist
- mv _build/bindist/ghc*.tar.xz $BIN_DIST_NAME.tar.xz
+ mv _build/bindist/ghc*.tar.xz "$BIN_DIST_NAME.tar.xz"
}
function test_hadrian() {
@@ -495,7 +497,7 @@ function cabal_test() {
-ddump-to-file -dumpdir "$OUT/dumps" -ddump-timings \
+RTS --machine-readable "-t$OUT/rts.log" -RTS \
-package mtl -ilibraries/Cabal/Cabal libraries/Cabal/Cabal/Setup.hs \
- $@
+ "$@"
rm -Rf tmp
end_section "Cabal test: $OUT"
}
@@ -522,23 +524,23 @@ function run_hadrian() {
fail "BUILD_FLAVOUR not set"
fi
if [ -z "$BIGNUM_BACKEND" ]; then BIGNUM_BACKEND="gmp"; fi
- if [ -n "$VERBOSE" ]; then HADRIAN_ARGS="$HADRIAN_ARGS -V"; fi
+ if [ -n "$VERBOSE" ]; then HADRIAN_ARGS=( "${HADRIAN[@]}" "-V" ); fi
run hadrian/build-cabal \
--flavour="$BUILD_FLAVOUR" \
-j"$cores" \
--broken-test="$BROKEN_TESTS" \
--bignum=$BIGNUM_BACKEND \
- $HADRIAN_ARGS \
- $@
+ "${HADRIAN_ARGS[@]}" \
+ "$@"
}
# A convenience function to allow debugging in the CI environment.
function shell() {
- local cmd=$@
- if [ -z "$cmd" ]; then
- cmd="bash -i"
+ local cmd=( "$@" )
+ if [ -z "${cmd[*]}" ]; then
+ cmd=( "bash" "-i" )
fi
- run $cmd
+ run "${cmd[@]}"
}
setup_locale
@@ -599,9 +601,9 @@ case $1 in
test_hadrian || res=$?
push_perf_notes
exit $res ;;
- run_hadrian) shift; run_hadrian $@ ;;
+ run_hadrian) shift; run_hadrian "$@" ;;
perf_test) run_perf_test ;;
clean) clean ;;
- shell) shell $@ ;;
+ shell) shell "$@" ;;
*) fail "unknown mode $1" ;;
esac
diff --git a/.gitlab/common.sh b/.gitlab/common.sh
index befb1493eb..6c487b9911 100644
--- a/.gitlab/common.sh
+++ b/.gitlab/common.sh
@@ -1,6 +1,10 @@
+#!/usr/bin/env bash
+
# Common bash utilities
# ----------------------
+# shellcheck disable=SC2034
+
# Colors
BLACK="0;30"
GRAY="1;30"