on master help sign in
Merge branch 'travis-build-matrix' of https://github.com/diogob/project-m36 into diogob-travis-build-matrix
d395a36AgentM
.travis.yml+40−41
@@ -1,5 +1,5 @@
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
2−language: c
2+language: nix
3sudo: false
3sudo: false
4
4
5git:
5git:
@@ -7,52 +7,51 @@ 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:
16+ fast_finish: true
23 include:
17 include:
24− #- compiler: "ghc-7.8.4"
18+ - env: GHCVER=7.10.3 CACHE_NAME=7.10.3
25− # env: TEST=--disable-tests BENCH=--disable-benchmarks
19+ compiler: ": #stack 7.10.3"
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"
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]}}
20+ addons: {apt: {packages: [ghc-7.10.3], 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
21
42−install:
22+ - env: GHCVER=8.0.2 CACHE_NAME=8.0.2
43− - cabal --version
23+ compiler: ": #stack 8.0.2"
44− - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
24+ addons: {apt: {packages: [ghc-8.0.2], sources: [hvr-ghc]}}
45− - travis_retry cabal update -v
46− - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
47
25
48− - cabal new-build -w ${HC} --enable-tests --dep -j2 all
26+ - env: GHCVER=8.2.1 CACHE_NAME=8.2.1 BUILD_BINARY=1
27+ compiler: ": #stack 8.2.1"
28+ addons: {apt: {packages: [ghc-8.2.1], sources: [hvr-ghc]}}
29+
30+ - env: GHCVER=8.2.1 CACHE_NAME=8.2.1-osx BUILD_BINARY=1
31+ os: osx
32+ compiler: ": #stack 8.2.1"
33+ addons: {apt: {packages: [ghc-8.2.1], sources: [hvr-ghc]}}
34+
35+install:
36+ - unset CC
37+ - export PATH=$HOME/.local/bin:/opt/ghc/$GHCVER/bin:$PATH
38+ - ./.travis/install-ghr.sh
39+ - ./.travis/install-stack.sh
49
40
50# Here starts the actual work to be performed for the package under test;
41# 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.
42# any command which exits with a non-zero exit code causes the build to fail.
52script:
43script:
53− - cabal sdist
44+ - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
54− - cabal new-build -w ${HC} -j1
45+ - GHC_OPTIONS=""
55− - cabal new-test -w ${HC}
46+ - |
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
47+ set -ex
57− - cabal new-haddock
48+ # Run tests
49+ stack --no-terminal test --ghc-options="$GHC_OPTIONS"
50+ set +ex
51+
52+after_success:
53+ - |
54+ # Build and ship binary
55+ ./.travis/attach-binary.sh
56+
58# EOF
57# 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+29
@@ -0,0 +1,29 @@
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
28+
29+travis_retry stack --no-terminal setup;
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+
test/Relation/StaticOptimizer.hs+8−9
@@ -124,15 +124,14 @@ testPushDownRestrictionPredicate :: Test
124testPushDownRestrictionPredicate = TestCase $ do
124testPushDownRestrictionPredicate = TestCase $ do
125 -- (s union relation{tuple{city "Boston", s# "S6", sname "Stevens", status 50}}) where status = 30 == (s where status=30) union (relation{tuple{city "Boston", s# "S6", sname "Stevens", status 50}} where status=30)
125 -- (s union relation{tuple{city "Boston", s# "S6", sname "Stevens", status 50}}) where status = 30 == (s where status=30) union (relation{tuple{city "Boston", s# "S6", sname "Stevens", status 50}} where status=30)
126 let rvs = RelationVariable "s" ()
126 let rvs = RelationVariable "s" ()
127− stevens <- case mkRelationFromList (attributes suppliersRel) [
127+ relationsOrError = do
128− [TextAtom "S6", TextAtom "Stevens", IntegerAtom 50, TextAtom "Boston"]] of
128+ stevens <- mkRelationFromList (attributes suppliersRel) [[TextAtom "S6", TextAtom "Stevens", IntegerAtom 50, TextAtom "Boston"]]
129− Left err -> assertFailure $ "stevens relation: " ++ show err
130− Right rel -> pure rel
131− let expr1 = Restrict status30 (Union rvs (ExistingRelation stevens))
129+ let expr1 = Restrict status30 (Union rvs (ExistingRelation stevens))
132− status30 = AttributeEqualityPredicate "status" (NakedAtomExpr (IntAtom 30))
130+ status30 = AttributeEqualityPredicate "status" (NakedAtomExpr (IntAtom 30))
133
131
134− expectedExpr1 = Union (Restrict status30 rvs) (Restrict status30 (ExistingRelation stevens))
132+ expectedExpr1 = Union (Restrict status30 rvs) (Restrict status30 (ExistingRelation stevens))
135− assertEqual "union restriction pushdown" expectedExpr1 (applyStaticRestrictionPushdown expr1)
133+ pure $ (expectedExpr1, (applyStaticRestrictionPushdown expr1))
134+ either (assertFailure . (++) "stevens relation: " . show) (uncurry $ assertEqual "union restriction pushdown") relationsOrError
136
135
137 -- s{sname,city} where city="London" == (s where city="London"){sname,city}
136 -- s{sname,city} where city="London" == (s where city="London"){sname,city}
138 let expr2 = Restrict whereLondon (Project projAttrs2 rvs)
137 let expr2 = Restrict whereLondon (Project projAttrs2 rvs)
@@ -144,4 +143,4 @@ testPushDownRestrictionPredicate = TestCase $ do
144 -- (s where city="London"){sname} != s{sname} where city="London" (no "city" attribute at projection time)
143 -- (s where city="London"){sname} != s{sname} where city="London" (no "city" attribute at projection time)
145 let expr3 = Project projAttrs3 (Restrict whereLondon rvs)
144 let expr3 = Project projAttrs3 (Restrict whereLondon rvs)
146 projAttrs3 = AttributeNames (S.singleton "sname")
145 projAttrs3 = AttributeNames (S.singleton "sname")
147− assertEqual "projection restriction no-pushdown" expr3 (applyStaticRestrictionPushdown expr3)
146+ assertEqual "projection restriction no-pushdown" expr3 (applyStaticRestrictionPushdown expr3)