Implement the equivalent of D4955 (#648)
[hadrian.git] / .travis.yml
index 055edd5..8416e00 100644 (file)
-sudo: false
-
+sudo: true
 matrix:
     include:
         - os: linux
-          env: CABALVER=1.22 GHCVER=7.10.3
+          env: MODE="selftest"
+          compiler: "GHC 8.2.2"
+          addons:
+              apt:
+                  packages:
+                      - ghc-8.2.2
+                      - cabal-install-2.0
+                      - zlib1g-dev
+                  sources: hvr-ghc
+
+          before_install:
+              - PATH="/opt/ghc/8.2.2/bin:$PATH"
+              - PATH="/opt/cabal/2.0/bin:$PATH"
+
+          script:
+              # Run internal Hadrian tests, after boot and configure.
+              - hadrian/build.sh -c selftest
+
+        - os: linux
+          env: MODE="--flavour=quickest"
+          compiler: "GHC 8.2.2"
           addons:
               apt:
                   packages:
-                      - ghc-7.10.3
-                      - alex-3.1.4
-                      - happy-1.19.5
-                      - cabal-install-1.22
+                      - ghc-8.2.2
+                      - cabal-install-2.0
                       - zlib1g-dev
                   sources: hvr-ghc
+
           before_install:
-              - PATH="/opt/ghc/$GHCVER/bin:$PATH"
-              - PATH="/opt/cabal/$CABALVER/bin:$PATH"
-              - PATH="$HOME/.cabal/bin:$PATH"
-              - export PATH
-              - cabal update
+              - PATH="/opt/ghc/8.2.2/bin:$PATH"
+              - PATH="/opt/cabal/2.0/bin:$PATH"
+
+          script:
+              # Build GHC, letting hadrian boot & configure the ghc source tree
+              - hadrian/build.sh -c -j $MODE --no-progress --progress-colour=never --profile=-
+
+        - os: linux
+          env: MODE="--flavour=quickest --integer-simple"
+          compiler: "GHC 8.4.1"
+          addons:
+              apt:
+                  packages:
+                      - ghc-8.4.1
+                      - cabal-install-2.2
+                      - zlib1g-dev
+                  sources: hvr-ghc
+
+          before_install:
+              - PATH="/opt/ghc/8.4.1/bin:$PATH"
+              - PATH="/opt/cabal/2.2/bin:$PATH"
+
+          script:
+              # boot, configure and build GHC
+              - hadrian/build.sh -c -j $MODE --no-progress --progress-colour=never --profile=-
+
+              # Test GHC binary
+              - _build/stage1/bin/ghc -e 1+2
 
         - os: osx
+          osx_image: xcode8
+          env: MODE="--flavour=quickest --integer-simple"
           before_install:
               - brew update
               - brew install ghc cabal-install
-              - cabal update
-              - cabal install alex happy
-              - PATH="$HOME/.cabal/bin:$PATH"
-              - export PATH
+              - brew upgrade python
 
+          script:
+              # Due to timeout limit of OS X build on Travis CI,
+              # we will ignore selftest and build only stage1
+              - hadrian/build.sh -j -c $MODE --no-progress --progress-colour=never --profile=-
 
-install:
+              # Test GHC binary
+              - _build/stage1/bin/ghc -e 1+2
 
+install:
+    # Add Cabal to PATH
+    - PATH="$HOME/.cabal/bin:$PATH"
+    - export PATH
     - env
-    - ghc --version
-    - cabal --version
-    - alex --version
-    - happy --version
 
-    - travis_retry git clone git://git.haskell.org/ghc --recurse-submodules
+    # Fetch GHC sources into ./ghc
+    - git --version
+    - git config --global url."git://github.com/ghc/packages-".insteadOf git://github.com/ghc/packages/
+    - git clone --depth 1 --recursive git://github.com/ghc/ghc
+    # --shallow-submodules is not supported on travis standard git 1.8 (linux), but it is supported
+    # on Travis Mac OS X machines. But it does not work with github mirrors because it cannot
+    # find commits.
 
-    # 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 )
+    # Install all Hadrian and GHC build dependencies
+    - cabal update
+    - cabal install alex happy
 
-    - ( cd ghc/shake-build && cabal install --only-dependencies )
+    # GHC comes with an older version of Hadrian, so we delete it
+    - rm -rf ghc/hadrian/.git
 
-    - ( cd ghc && ./boot )
-    - ( cd ghc && ./configure )
+    # Travis has already cloned Hadrian into ./ and we need to move it
+    # to ./ghc/hadrian -- one way to do it is to move the .git directory
+    # and perform a hard reset in order to regenerate Hadrian files
+    - mv .git ghc/hadrian
+    - cd ghc/hadrian && git reset --hard HEAD && cd ..
 
-script:
-    - ./ghc/shake-build/build.sh -j --no-progress
+    # We checkout a patched Cabal.
+    # See: https://github.com/snowleopard/hadrian/issues/634
+    - cd libraries/Cabal/
+    - git remote add quasicomputational https://github.com/quasicomputational/cabal.git
+    - git fetch quasicomputational && git checkout cwd-independent-check
+    - cd ../../
 
 cache:
     directories:
         - $HOME/.cabal
         - $HOME/.ghc
-
-notifications:
-    irc:
-        on_success: always # always/never/change
-        on_failure: always
-        channels:
-            - "chat.freenode.net#shaking-up-ghc"
-        template:
-            - "#%{build_number} finished in %{duration}. %{message}"
-            - "Repo: %{repository_slug}, branch: %{branch}"
-            - "%{author}: %{commit_subject}"
-            - "Build details: %{build_url}"