Rework Travis CI script
authorDavid Luposchainsky <dluposchainsky@gmail.com>
Tue, 5 Jan 2016 08:50:08 +0000 (09:50 +0100)
committerDavid Luposchainsky <dluposchainsky@gmail.com>
Tue, 5 Jan 2016 11:19:49 +0000 (12:19 +0100)
- Move all .travis/*.sh functionality directly into .travis.yml
- Install Alex/Happy from PPA instead of compiling them by hand
- Skip Shake progress indicators, as they're rather useless
  on clean-slate Travis builds, and clutter up the log
- Don't use a Cabal sandbox for building so Travis can share
  $HOME/.cabal
- boot/configure only after the Shake build system is in place,
  otherwise some required *.in files are not converted, and
  Shake fails

.travis.yml
.travis/install-cabal-happy-alex.sh [deleted file]
.travis/install-ghc-shake.sh [deleted file]
.travis/install-ghc.sh [deleted file]
.travis/print-env.sh [deleted file]
.travis/run-ghc-shake.sh [deleted file]
build.cabal.sh
build.sh

index 5e169fa..9079fa9 100644 (file)
@@ -1,9 +1,23 @@
 sudo: false
 
 matrix:
-  include:
-    - env: CABALVER=1.22 GHCVER=7.10.3
-      addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3,zlib1g-dev,terminfo-dev],  sources: [hvr-ghc]}}
+    include:
+        - env:
+            CABALVER=1.22
+            GHCVER=7.10.3
+
+          addons: {
+              apt: {
+                  packages: [
+                      ghc-7.10.3,
+                      alex-3.1.4,
+                      happy-1.19.5,
+                      cabal-install-1.22,
+                      zlib1g-dev
+                  ],
+                  sources: [hvr-ghc]
+              }
+          }
 
 before_install:
 
@@ -12,21 +26,33 @@ before_install:
     - PATH="/opt/cabal/$CABALVER/bin:$PATH"
     - export PATH
 
-    - .travis/print-env.sh
+    - env
+    - ghc --version
+    - cabal --version
+    - alex --version
+    - happy --version
+    - cabal update
 
 install:
-    - .travis/install-cabal-happy-alex.sh
-    - .travis/install-ghc.sh
-    - .travis/install-ghc-shake.sh
+
+    - travis_retry git clone git://git.haskell.org/ghc --recurse-submodules
+
+    # Travis clones the project into ".", but we need it as a child directory
+    # of "ghc/". For this reason, we - rather hackily - move the GHC-Shake
+    # ".git"  directory into the appropriate location, and perform a hard reset
+    # in order to regenerate the GHC-Shake files.
+    - mkdir ghc/shake-build
+    - mv .git ghc/shake-build
+    - ( cd ghc/shake-build && git reset --hard HEAD )
+
+    - ( cd ghc/shake-build && cabal install --only-dependencies )
+
+    - ( cd ghc && ./boot )
+    - ( cd ghc && ./configure )
 
 script:
-    - .travis/run-ghc-shake.sh
+    - ./ghc/shake-build/build.sh -j --no-progress
 
 cache:
     directories:
         - $HOME/.cabal
-        # - ghc/shake-build/.cabal-sandbox
-        # - ghc/shake-build/cabal.sandbox.config
-
-# before_cache:
-#     - rm -rf ghc/shake-build
diff --git a/.travis/install-cabal-happy-alex.sh b/.travis/install-cabal-happy-alex.sh
deleted file mode 100755 (executable)
index 93df460..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/env bash
-
-set -euo pipefail
-
-COLOR="\e[32m" # Green
-RESET="\e[m"
-
-echo -e "${COLOR}GHC version:${RESET}"
-ghc --version
-
-echo -e "${COLOR}Cabal version:${RESET}"
-cabal --version
-
-echo -e "${COLOR}Update Cabal${RESET}"
-cabal update
-
-echo -e "${COLOR}Install Alex+Happy${RESET}"
-cabal install alex happy
diff --git a/.travis/install-ghc-shake.sh b/.travis/install-ghc-shake.sh
deleted file mode 100755 (executable)
index c2b8774..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/env bash
-
-set -euo pipefail
-
-COLOR="\e[31m" # Red, because this file is serious business
-RESET="\e[m"
-
-echo -e "${COLOR}Brutally hacking GHC-Shake to its proper location${RESET}"
-SHAKEDIR="ghc/shake-build"
-mkdir -p "$SHAKEDIR"
-mv .git "$SHAKEDIR/"
-( cd "$SHAKEDIR" && git reset --hard HEAD )
-
-echo -e "${COLOR}Installing deps into sandbox${RESET}"
-( cd "$SHAKEDIR" && cabal sandbox init )
-( cd "$SHAKEDIR" && cabal install --only-dependencies . )
-
-echo -e "${COLOR}GHC boot/configure${RESET}"
-( cd ghc && ./boot && ./configure)
diff --git a/.travis/install-ghc.sh b/.travis/install-ghc.sh
deleted file mode 100755 (executable)
index fc34ea4..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env bash
-
-set -euo pipefail
-
-COLOR="\e[34m" # Blue
-RESET="\e[m"
-
-echo -e "${COLOR}Clone GHC source${RESET}"
-git clone git://git.haskell.org/ghc
-
-echo -e "${COLOR}Initialize GHC submodules${RESET}"
-( cd ghc && git submodule update --init )
diff --git a/.travis/print-env.sh b/.travis/print-env.sh
deleted file mode 100755 (executable)
index c09c11f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env bash
-
-set -euo pipefail
-
-COLOR="\e[32m" # Green
-RESET="\e[m"
-
-echo -e "${COLOR}Environment:${RESET}"
-env
diff --git a/.travis/run-ghc-shake.sh b/.travis/run-ghc-shake.sh
deleted file mode 100755 (executable)
index 7b867b7..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env bash
-
-set -euo pipefail
-
-COLOR="\e[32m" # Green
-RESET="\e[m"
-
-echo -e "${COLOR}Running Shake build system${RESET}"
-( cd ghc && ./shake-build/build.cabal.sh )
index 65da82b..cf165b8 100755 (executable)
@@ -6,9 +6,10 @@ absoltueRoot="$(dirname "$(readlink -f "$0")")"
 cd "$absoltueRoot"
 
 # Initialize sandbox if necessary
-if ! $(cabal sandbox hc-pkg list 2>&1 > /dev/null); then
+if ! ( cabal sandbox hc-pkg list 2>&1 > /dev/null ); then
     cabal sandbox init
     cabal install                   \
+        --dependencies-only         \
         --disable-library-profiling \
         --disable-shared
 fi
index f09c30c..82cbb93 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -2,7 +2,7 @@
 
 set -euo pipefail
 
-root="$(dirname "$0")"
+root="$(dirname "$(readlink -f "$0")")"
 
 mkdir -p "$root/.shake"