about summary refs log tree commit diff homepage
path: root/scripts/build/build-travis-containers.sh
blob: fe80e29f560cbb35cc1f6d69cbe0975f52390939 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
# Build all the docker containers utilized, that would be
# also build by TravisCI.
#
# Every line starting with " - LLVM_VERSION=" is a single setup

set -e
#set -x
DIR="$(cd "$(dirname "$0")" && pwd)"

trim() {
    local var="$*"
    # remove leading whitespace characters
    var="${var#"${var%%[![:space:]]*}"}"
    # remove trailing whitespace characters
    var="${var%"${var##*[![:space:]]}"}"   
    echo -n "$var"
}

# Build dependencies only
isGlobal=0
isEnv=0
commons=()
experiments=()
while read -r line
do
    [[ "${line}" == "env:"* ]] && isEnv=1 && continue
    [[ "${line}" == "#stop"* ]] && isEnv=0 && break
 
    
    [[ "${isEnv}" -eq 0 ]] && continue
    
    line="$(trim "${line}")"

    # Ignore empty lines
    [[ -z "${line}" ]] && continue
    [[ "${line}" == "#"* ]] && continue 
    
    [[ "${line}" == "global:"* ]] && isGlobal=1 && continue
    [[ "${line}" == "matrix:"* ]] && isGlobal=0 && continue

    
    
    if [[ "${isGlobal}" -eq 1 ]]; then
      tmp="${line#*-}"
      IFS=: read -r key value <<< "${tmp}"
      key=$(trim "${key}")
      [[ "${key}" == "secure" ]] && continue
      [[ -z "${key}" ]] && continue
      commons+=("${key}=$(trim "${value}")")
      continue
    fi

    experiment=$(echo "$line"| grep "\- " | xargs -L 1 | cut -d "-" -f 2)
    if [[ "x$experiment" == "x" ]]; then
      continue
    fi
    experiments+=("${experiment}")
done < "${DIR}/../../.travis.yml"

for experiment in "${experiments[@]}"; do
  [[ -z "${experiment}" ]] && continue
  /bin/bash -c "${commons[*]} ${experiment} ${DIR}/build.sh klee --docker --push-docker-deps --debug --create-final-image"
done