sudo: false # Use the container-based infrastructure. addons: apt: packages: - libgmp-dev # Stack's GHC depends on this. cache: directories: - $HOME/.stack # Global stack's cache. - $HOME/.foldercache # Per exercise `.stack-work` cache. env: - RESOLVER="lts-7.9" CURRENT="YES" # Equal to each stack.yaml. - RESOLVER="nightly" # Latest nightly snapshot. matrix: allow_failures: # The snapshot `nightly` is just an alias to - env: RESOLVER="nightly" # the newest version released. We don't want fast_finish: true # Travis to fail on new incompatible releases. before_install: - mkdir -p ${HOME}/bin # Create folder for stack. - export PATH="${HOME}/bin:$PATH" # For stack - export PATH="${TRAVIS_BUILD_DIR}/bin:$PATH" # For {,fetch-}configlet. install: - travis_retry fetch-configlet - travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 -o pack.tgz - tar xzf pack.tgz --wildcards --strip-components=1 -C ${HOME}/bin '*/stack' - stack --resolver ${RESOLVER} --install-ghc install hlint script: - | set -e configlet . # Check basic track configuration. hlint ${TRAVIS_BUILD_DIR} # Run `hlint` on the entire repository. # Explicit set exercises' resolver only if it's not the current one. if [ "${CURRENT}" != "YES" ]; then SET_RESOLVER="--resolver ${RESOLVER}" fi test_exercise () { stack test ${SET_RESOLVER} `# Select the correct resolver. `\ --install-ghc `# Download GHC if not in cache.`\ --no-terminal `# Terminal detection is broken.`\ --pedantic `# Enable -Wall and -Werror. ` } for exercise in ${TRAVIS_BUILD_DIR}/exercises/* ; do exercisename=$(basename "$exercise") pushd ${exercise} if ! stat -t examples/*/ > /dev/null 2>&1; then echo "No examples for ${exercise}!" exit 1 else for example in examples/*/ ; do examplename=$(basename "$example") buildfolder="${TRAVIS_BUILD_DIR}/build/${exercisename}/${examplename}" mkdir -p "${buildfolder}" cp -rL stack.yaml test ${example}/* "${buildfolder}" pushd $buildfolder examplecache="${HOME}/.foldercache/${exercisename}/${examplename}/.stack-work" mkdir -p "$examplecache" ln -f -s "$examplecache" echo "testing ${example}" test_exercise popd done fi popd done