<commit_before>language: haskell
ghc:
  - 7.4
  - 7.6
  - 7.8

sudo: false

addons:
  apt:
    packages:
    - zlib1g-dev

cache:
  apt: true
  directories:
  - ~/.cabal
  - ~/.ghc
  - ~/.ghc-mod
  - ~/.stack

install:
  - export HOME=/tmp
  - cabal update
  - echo $PATH
  - which cabal
  - cabal install -j --only-dependencies --enable-tests
  - if [ -n "$(ghc --version | awk '{ print $8 }' | sed -n '/^7.4/p')" ]; then cabal install Cabal --constraint "Cabal == 1.16.*"; fi


before_script:
  - rm -f ~/.ghc-mod cabal-helper-*-Cabal-*

script:
  - touch ChangeLog # Create ChangeLog if we're not on the release branch
  - cabal check

  - cabal sdist
  - export SRC_TGZ="$PWD/dist/$(cabal info . | awk '{print $2 ".tar.gz";exit}')"
  - rm -rf /tmp/cabal-helper* && cd /tmp
  - tar -xf $SRC_TGZ && cd cabal-helper*/

  - if [ -n "$(ghc --version | awk '{ print $8 }' | sed -n '/^7.8/p')" ]; then export WERROR="--ghc-option=-Werror"; fi
  - cabal configure --enable-tests $WERROR
  - cabal build
  - ./dist/build/cabal-helper-wrapper/cabal-helper-wrapper . dist "compiler-version" "entrypoints" "source-dirs" "ghc-options" "ghc-src-options" "ghc-pkg-options" "ghc-lang-options"
  - ./dist/build/spec/spec
<commit_msg>Also build with Cabal HEAD on travis<commit_after>language: haskell
ghc:
  - 7.4
  - 7.6
  - 7.8

sudo: false

addons:
  apt:
    packages:
    - zlib1g-dev

cache:
  apt: true
  directories:
  - ~/.cabal
  - ~/.ghc
  - ~/.ghc-mod
  - ~/.stack

install:
  - export HOME=/tmp
  - cabal update
  - echo $PATH
  - which cabal
  - cabal install -j --only-dependencies --enable-tests
  - git clone --depth=1 https://github.com/haskell/cabal.git /tmp/cabal
  - if [ -n "$(ghc --version | awk '{ print $8 }' | sed -n '/^7.4/p')" ]; then cabal install Cabal --constraint "Cabal == 1.16.*"; fi


before_script:
  - rm -f ~/.ghc-mod cabal-helper-*-Cabal-*

script:
  - touch ChangeLog # Create ChangeLog if we're not on the release branch
  - cabal check

  - cabal sdist
  - export SRC_TGZ="$PWD/dist/$(cabal info . | awk '{print $2 ".tar.gz";exit}')"
  - rm -rf /tmp/cabal-helper* && cd /tmp
  - tar -xf $SRC_TGZ && cd cabal-helper*/

  - if [ -n "$(ghc --version | awk '{ print $8 }' | sed -n '/^7.8/p')" ]; then export WERROR="--ghc-option=-Werror"; fi
  - cabal configure --enable-tests $WERROR
  - cabal build
  - ./dist/build/cabal-helper-wrapper/cabal-helper-wrapper . dist "compiler-version" "entrypoints" "source-dirs" "ghc-options" "ghc-src-options" "ghc-pkg-options" "ghc-lang-options"
  - ./dist/build/spec/spec
  # At least try to compile with Cabal HEAD
  - ghc -i -i/tmp/cabal/Cabal -i. ~/dev/hs/cabal-helper/CabalHelper/Main.hs -odir /tmp/cabal/Cabal -DCABAL_MAJOR=100 -DCABAL_MINOR=100

{'fraction_non_alphanumeric': 0.18201915991156964, 'fraction_numerical': 0.015106853352984525, 'mean_word_length': 2.480769230769231, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2034832', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1103, 'n_words': 268}