add stack.yaml and use it in travis file

This commit is contained in:
Sönke Hahn 2015-07-14 01:07:19 +08:00
parent 2cf2d08cd3
commit 85b2377208
6 changed files with 35 additions and 50 deletions

1
.gitignore vendored
View file

@ -22,3 +22,4 @@ cabal.config
*.aux *.aux
*.hp *.hp
Setup Setup
.stack-work

View file

@ -1,30 +1,26 @@
language: haskell sudo: false
env: env:
- CABALVER=1.18 GHCVER=7.8.4 # - GHCVER=7.8.4 STACK_YAML=stack.yaml
- CABALVER=1.22 GHCVER=7.10.1 - GHCVER=7.10.1 STACK_YAML=stack.yaml
before_install:
- travis_retry sudo add-apt-repository -y ppa:hvr/ghc
- travis_retry sudo apt-get update
- travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
- travis_retry cabal update
install: install:
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" # ghc
- cabal --version - export PATH=/opt/ghc/$GHCVER/bin:$PATH
# stack
- mkdir -p ~/.local/bin
- export PATH=~/.local/bin:$PATH
- travis_retry curl -L https://github.com/commercialhaskell/stack/releases/download/v0.1.2.0/stack-0.1.2.0-x86_64-linux.gz | gunzip > ~/.local/bin/stack
- chmod a+x ~/.local/bin/stack
script: script:
- ./scripts/test-all.sh - stack build
- stack test
notifications: addons:
irc: apt:
channels: sources:
- "irc.freenode.org#servant" - hvr-ghc
template: packages:
- "%{repository}#%{build_number} - %{commit} on %{branch} by %{author}: %{message}" - ghc-7.8.4
- "Build details: %{build_url} - Change view: %{compare_url}" - ghc-7.10.1
skip_join: true
on_success: change
on_failure: always

View file

@ -80,7 +80,7 @@ test-suite spec
, lens , lens
, servant-js , servant-js
, servant , servant
, hspec >= 2.0 , hspec >= 2.1.8
, hspec-expectations , hspec-expectations
, language-ecmascript >= 0.16 , language-ecmascript >= 0.16
default-language: Haskell2010 default-language: Haskell2010

View file

@ -9,23 +9,10 @@ import Test.DocTest
main :: IO () main :: IO ()
main = do main = do
files <- find always (extension ==? ".hs") "src" files <- find always (extension ==? ".hs") "src"
cabalMacrosFile <- getCabalMacrosFile
doctest $ [ "-isrc" doctest $ [ "-isrc"
, "-optP-include"
, "-optP" ++ cabalMacrosFile
, "-XOverloadedStrings" , "-XOverloadedStrings"
, "-XFlexibleInstances" , "-XFlexibleInstances"
, "-XMultiParamTypeClasses" , "-XMultiParamTypeClasses"
, "-XDataKinds" , "-XDataKinds"
, "-XTypeOperators" , "-XTypeOperators"
] ++ files ] ++ files
getCabalMacrosFile :: IO FilePath
getCabalMacrosFile = do
contents <- getDirectoryContents "dist"
let rest = "build" </> "autogen" </> "cabal_macros.h"
return $ case filter ("dist-sandbox-" `isPrefixOf`) contents of
[x] -> "dist" </> x </> rest
[] -> "dist" </> rest
xs -> error $ "ran doctests with multiple dist/dist-sandbox-xxxxx's: \n"
++ show xs ++ "\nTry cabal clean"

View file

@ -9,21 +9,8 @@ import Test.DocTest
main :: IO () main :: IO ()
main = do main = do
files <- find always (extension ==? ".hs") "src" files <- find always (extension ==? ".hs") "src"
cabalMacrosFile <- getCabalMacrosFile
doctest $ [ "-isrc" doctest $ [ "-isrc"
, "-optP-include"
, "-optP" ++ cabalMacrosFile
, "-XOverloadedStrings" , "-XOverloadedStrings"
, "-XFlexibleInstances" , "-XFlexibleInstances"
, "-XMultiParamTypeClasses" , "-XMultiParamTypeClasses"
] ++ files ] ++ files
getCabalMacrosFile :: IO FilePath
getCabalMacrosFile = do
contents <- getDirectoryContents "dist"
let rest = "build" </> "autogen" </> "cabal_macros.h"
return $ case filter ("dist-sandbox-" `isPrefixOf`) contents of
[x] -> "dist" </> x </> rest
[] -> "dist" </> rest
xs -> error $ "ran doctests with multiple dist/dist-sandbox-xxxxx's: \n"
++ show xs ++ "\nTry cabal clean"

14
stack.yaml Normal file
View file

@ -0,0 +1,14 @@
flags:
servant-js:
example: false
packages:
- servant-client/
- servant-server/
- servant-examples/
- servant-js/
- servant-docs/
- servant/
- servant-lucid/
- servant-blaze/
extra-deps: []
resolver: nightly-2015-07-24