on master help sign in
Add travis build matrix config.
1784479Diogo Biazus
.travis.yml+36−40
@@ -1,4 +1,4 @@
1−# For more information, see https://github.com/hvr/multi-ghc-travis
1+# For more information, see https://github.com/ChrisPenner/haskell-stack-travis-ci
2language: c
2language: c
3sudo: false
3sudo: false
4
4
@@ -7,52 +7,48 @@ git:
7
7
8cache:
8cache:
9 directories:
9 directories:
10− - $HOME/.cabal/packages
10+ - $HOME/.ghc
11− - $HOME/.cabal/store
11+ - $HOME/.cabal
12−
12+ - $HOME/.stack
13−before_cache:
13+ - .stack-work
14− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
15− # remove files that are regenerated by 'cabal update'
16− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*
17− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json
18− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache
19− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
20− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
21
14
22matrix:
15matrix:
23 include:
16 include:
24− #- compiler: "ghc-7.8.4"
17+ - env: CACHE_NAME=7.10.3 STACK_YAML=stack.ghc7.10.yaml
25− # env: TEST=--disable-tests BENCH=--disable-benchmarks
26− # addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.8.4], sources: [hvr-ghc]}}
27− - compiler: "ghc-7.10.3"
28− # env: TEST=--disable-tests BENCH=--disable-benchmarks
29− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.10.3], sources: [hvr-ghc]}}
30− - compiler: "ghc-8.0.2"
18+ compiler: ": #stack 7.10.3"
31− # env: TEST=--disable-tests BENCH=--disable-benchmarks
32− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.2], sources: [hvr-ghc]}}
33− #- compiler: "ghc-8.2.1"
34− # env: TEST=--disable-tests BENCH=--disable-benchmarks
35− # addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.1], sources: [hvr-ghc]}}
36−
37−before_install:
38− - HC=${CC}
39− - unset CC
40− - PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$PATH
41
19
42−install:
20+ - env: CACHE_NAME=8.0.2 STACK_YAML=stack.yaml
43− - cabal --version
21+ compiler: ": #stack 8.0.2"
44− - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
45− - travis_retry cabal update -v
46− - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
47
22
48− - cabal new-build -w ${HC} --enable-tests --dep -j2 all
23+ - env: CACHE_NAME=osx-7.10.3 STACK_YAML=stack.ghc7.10.yaml
24+ os: osx
25+ compiler: ": #stack 7.10.3"
26+
27+ - env: CACHE_NAME=osx-8.0.2 STACK_YAML=stack.yaml
28+ os: osx
29+ compiler: ": #stack 8.0.2"
30+
31+install:
32+ - unset CC
33+ - export PATH=$HOME/.local/bin:$PATH
34+ - ./.travis/install-ghr.sh
35+ - ./.travis/install-stack.sh
36+ - travis_wait travis_retry stack setup
37+ - travis_retry stack build --only-dependencies
49
38
50# Here starts the actual work to be performed for the package under test;
39# Here starts the actual work to be performed for the package under test;
51# any command which exits with a non-zero exit code causes the build to fail.
40# any command which exits with a non-zero exit code causes the build to fail.
52script:
41script:
53− - cabal sdist
42+ - GHC_OPTIONS=""
54− - cabal new-build -w ${HC} -j1
43+ - |
55− - cabal new-test -w ${HC}
44+ set -ex
56− - curl -sL https://raw.github.com/ndmitchell/hlint/master/misc/travis.sh | sh -s lint src test examples --cpp-define VERSION_project_m36=HLINT
45+ # Run tests
57− - cabal new-haddock
46+ stack --no-terminal test --ghc-options="$GHC_OPTIONS"
47+ set +ex
48+
49+after_success:
50+ - |
51+ # Build and ship binary
52+ ./.travis/attach-binary.sh
53+
58# EOF
54# EOF
.travis/attach-binary.shnew file+25
@@ -0,0 +1,25 @@
1+#!/bin/sh
2+set -o errexit -o verbose
3+
4+if test ! "$BUILD_BINARY" || test ! "$TRAVIS_TAG"
5+then
6+ echo 'This is not a release build.'
7+elif test ! "$GITHUB_TOKEN"
8+then
9+ echo 'The GITHUB_TOKEN environment variable is not set!'
10+ exit 1
11+else
12+ echo "Building binary for $TRAVIS_OS_NAME to $TRAVIS_TAG..."
13+ stack build --ghc-options -O2 --pedantic
14+ echo "Attaching binary for $TRAVIS_OS_NAME to $TRAVIS_TAG..."
15+ OWNER="$(echo "$TRAVIS_REPO_SLUG" | cut -f1 -d/)"
16+ REPO="$(echo "$TRAVIS_REPO_SLUG" | cut -f2 -d/)"
17+ BIN="$(stack path --local-install-root)/bin/$REPO"
18+ BUNDLE_NAME="$REPO-$TRAVIS_TAG-$TRAVIS_OS_NAME.tar.gz"
19+ cp "$BIN" "./$REPO"
20+ chmod +x "./$REPO"
21+ tar -czf "$BUNDLE_NAME" "$REPO"
22+ echo "SHA256:"
23+ shasum -a 256 "$BUNDLE_NAME"
24+ ghr -t "$GITHUB_TOKEN" -u "$OWNER" -r "$REPO" --replace "$(git describe --tags)" "$BUNDLE_NAME"
25+fi
.travis/install-ghr.shnew file+21
@@ -0,0 +1,21 @@
1+#!/bin/sh
2+set -o errexit -o verbose
3+
4+if test ! "$BUILD_BINARY" || test ! "$TRAVIS_TAG"
5+then
6+ echo 'This is not a release build.'
7+else
8+ if [ "$TRAVIS_OS_NAME" = "linux" ]
9+ then
10+ ARCH="linux"
11+ else
12+ ARCH="darwin"
13+ fi
14+ echo "Installing ghr"
15+ URL="https://github.com/tcnksm/ghr/releases/download/v0.5.4/ghr_v0.5.4_${ARCH}_386.zip"
16+ curl -L ${URL} > ghr.zip
17+ mkdir -p "$HOME/bin"
18+ export PATH="$HOME/bin:$PATH"
19+ unzip ghr.zip -d "$HOME/bin"
20+ rm ghr.zip
21+fi
.travis/install-stack.shnew file+27
@@ -0,0 +1,27 @@
1+#!/bin/sh
2+
3+# Adapted from https://github.com/commercialhaskell/stack
4+
5+set -eux
6+
7+travis_retry() {
8+ cmd=$*
9+ $cmd || (sleep 2 && $cmd) || (sleep 10 && $cmd)
10+}
11+
12+fetch_stack_osx() {
13+ curl -skL https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin;
14+}
15+
16+fetch_stack_linux() {
17+ curl -sL https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack';
18+}
19+
20+# We need stack to generate cabal files with precise bounds, even for cabal
21+# builds.
22+mkdir -p ~/.local/bin;
23+if [ "$(uname)" = "Darwin" ]; then
24+ travis_retry fetch_stack_osx
25+else
26+ travis_retry fetch_stack_linux
27+fi
src/lib/ProjectM36/ScriptSession.hs+4−2
@@ -46,7 +46,9 @@ initScriptSession ghcPkgPaths = do
46
46
47 sandboxPkgPaths <- liftIO $ concat <$> mapM glob [
47 sandboxPkgPaths <- liftIO $ concat <$> mapM glob [
48 "./dist-newstyle/packagedb/ghc-" ++ ghcVersion,
48 "./dist-newstyle/packagedb/ghc-" ++ ghcVersion,
49− ".cabal-sandbox/*ghc-" ++ ghcVersion ++ "-packages.conf.d",
49+ ".cabal-sandbox/*ghc-" ++ ghcVersion ++ "-packages.conf.d",
50+ ".stack-work/install/*/*/" ++ ghcVersion ++ "/pkgdb",
51+ homeDir </> ".stack/snapshots/*/*/" ++ ghcVersion ++ "/pkgdb",
50 homeDir </> ".cabal/store/ghc-" ++ ghcVersion ++ "/package.db"
52 homeDir </> ".cabal/store/ghc-" ++ ghcVersion ++ "/package.db"
51 ]
53 ]
52
54
@@ -171,4 +173,4 @@ typeCheckScript expectedType inp = do
171 pure Nothing
173 pure Nothing
172 else
174 else
173 pure (Just (TypeCheckCompilationError (showType dflags expectedType) (showType dflags funcType)))
175 pure (Just (TypeCheckCompilationError (showType dflags expectedType) (showType dflags funcType)))
174−
176+