summaryrefslogtreecommitdiff
path: root/.gitlab
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-08-06 20:26:41 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-09-25 21:10:56 -0400
commitdd6640316865d84075b00013b8b97076705e5c44 (patch)
tree3c6f3c2eeebc3a2103f28f42a915eebaf6128913 /.gitlab
parent5b72718953c289b6827e877e14d9f0f3f5c64267 (diff)
downloadhaskell-dd6640316865d84075b00013b8b97076705e5c44.tar.gz
ci.sh: Factor out common utilities
Diffstat (limited to '.gitlab')
-rwxr-xr-x.gitlab/ci.sh52
-rw-r--r--.gitlab/common.sh50
2 files changed, 55 insertions, 47 deletions
diff --git a/.gitlab/ci.sh b/.gitlab/ci.sh
index 2abe3f4bdb..c28755ecb8 100755
--- a/.gitlab/ci.sh
+++ b/.gitlab/ci.sh
@@ -10,54 +10,12 @@ hackage_index_state="2020-09-14T19:30:43Z"
MIN_HAPPY_VERSION="1.20"
MIN_ALEX_VERSION="3.2"
-# Colors
-BLACK="0;30"
-GRAY="1;30"
-RED="0;31"
-LT_RED="1;31"
-BROWN="0;33"
-LT_BROWN="1;33"
-GREEN="0;32"
-LT_GREEN="1;32"
-BLUE="0;34"
-LT_BLUE="1;34"
-PURPLE="0;35"
-LT_PURPLE="1;35"
-CYAN="0;36"
-LT_CYAN="1;36"
-WHITE="1;37"
-LT_GRAY="0;37"
-
-# GitLab Pipelines log section delimiters
-# https://gitlab.com/gitlab-org/gitlab-foss/issues/14664
-start_section() {
- name="$1"
- echo -e "section_start:$(date +%s):$name\015\033[0K"
-}
-
-end_section() {
- name="$1"
- echo -e "section_end:$(date +%s):$name\015\033[0K"
-}
-
-echo_color() {
- local color="$1"
- local msg="$2"
- echo -e "\033[${color}m${msg}\033[0m"
-}
-
-error() { echo_color "${RED}" "$1"; }
-warn() { echo_color "${LT_BROWN}" "$1"; }
-info() { echo_color "${LT_BLUE}" "$1"; }
-
-fail() { error "error: $1"; exit 1; }
-
-function run() {
- info "Running $*..."
- "$@" || ( error "$* failed"; return 1; )
-}
-
TOP="$(pwd)"
+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
function setup_locale() {
# Musl doesn't provide locale support at all...
diff --git a/.gitlab/common.sh b/.gitlab/common.sh
new file mode 100644
index 0000000000..befb1493eb
--- /dev/null
+++ b/.gitlab/common.sh
@@ -0,0 +1,50 @@
+# Common bash utilities
+# ----------------------
+
+# Colors
+BLACK="0;30"
+GRAY="1;30"
+RED="0;31"
+LT_RED="1;31"
+BROWN="0;33"
+LT_BROWN="1;33"
+GREEN="0;32"
+LT_GREEN="1;32"
+BLUE="0;34"
+LT_BLUE="1;34"
+PURPLE="0;35"
+LT_PURPLE="1;35"
+CYAN="0;36"
+LT_CYAN="1;36"
+WHITE="1;37"
+LT_GRAY="0;37"
+
+# GitLab Pipelines log section delimiters
+# https://gitlab.com/gitlab-org/gitlab-foss/issues/14664
+start_section() {
+ name="$1"
+ echo -e "section_start:$(date +%s):$name\015\033[0K"
+}
+
+end_section() {
+ name="$1"
+ echo -e "section_end:$(date +%s):$name\015\033[0K"
+}
+
+echo_color() {
+ local color="$1"
+ local msg="$2"
+ echo -e "\033[${color}m${msg}\033[0m"
+}
+
+error() { echo_color "${RED}" "$1"; }
+warn() { echo_color "${LT_BROWN}" "$1"; }
+info() { echo_color "${LT_BLUE}" "$1"; }
+
+fail() { error "error: $1"; exit 1; }
+
+function run() {
+ info "Running $*..."
+ "$@" || ( error "$* failed"; return 1; )
+}
+