3.14 pre-flight checks: bump dependencies (#10244)
[cabal.git] / .gitlab / common.sh
blobb6bce698c919f74cf421f3fe13369f7702242c52
1 # Common bash utilities
2 # ----------------------
4 # Colors
5 BLACK="0;30"
6 GRAY="1;30"
7 RED="0;31"
8 LT_RED="1;31"
9 BROWN="0;33"
10 LT_BROWN="1;33"
11 GREEN="0;32"
12 LT_GREEN="1;32"
13 BLUE="0;34"
14 LT_BLUE="1;34"
15 PURPLE="0;35"
16 LT_PURPLE="1;35"
17 CYAN="0;36"
18 LT_CYAN="1;36"
19 WHITE="1;37"
20 LT_GRAY="0;37"
22 # GitLab Pipelines log section delimiters
23 # https://gitlab.com/gitlab-org/gitlab-foss/issues/14664
24 start_section() {
25 name="$1"
26 echo -e "section_start:$(date +%s):$name\015\033[0K"
29 end_section() {
30 name="$1"
31 echo -e "section_end:$(date +%s):$name\015\033[0K"
34 echo_color() {
35 local color="$1"
36 local msg="$2"
37 echo -e "\033[${color}m${msg}\033[0m"
40 error() { echo_color "${RED}" "$1"; }
41 warn() { echo_color "${LT_BROWN}" "$1"; }
42 info() { echo_color "${LT_BLUE}" "$1"; }
44 fail() { error "error: $1"; exit 1; }
46 function run() {
47 info "Running $*..."
48 "$@" || ( error "$* failed"; return 1; )