sudo: false

# Choose a lightweight base image; we provide our own tools.
language: c

cache:
  directories:
    - $HOME/.ghc
    - $HOME/.cabal
    - $HOME/.stack

addons:
  apt:
    packages:
      - libgmp-dev

before_install:
  - mkdir -p ~/.local/bin
  - export PATH=$HOME/.local/bin:$PATH
  - curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'


install:
  - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
  - travis_wait stack --no-terminal -j1 --install-ghc build --only-dependencies
  
script:
  - travis_wait stack --no-terminal -j1 build

notifications:
  email: true

before_deploy:
  - mkdir bundle
  - cp `stack path --dist-dir`/build/trypurescript/trypurescript bundle/
  - cp LICENSE bundle/
  - tar czf trypurescript.tar.gz -C bundle/ .

deploy:
  provider: releases
  api_key: $RELEASE_KEY
  file: trypurescript.tar.gz
  skip_cleanup: true
  on:
    tags: true

sudo: false

# Choose a lightweight base image; we provide our own tools.
language: c

cache:
  directories:
    - $HOME/.ghc
    - $HOME/.cabal
    - $HOME/.stack

addons:
  apt:
    packages:
      - libgmp-dev

before_install:
  - mkdir -p ~/.local/bin
  - export PATH=$HOME/.local/bin:$PATH
  - curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'

script:
  # Set a timeout of 35 minutes. We could use travis_wait here, but travis_wait
  # doesn't produce any output until the command finishes, and also doesn't
  # always show all of the command's output.
  - timeout 35m stack --no-terminal -j1 --install-ghc build

notifications:
  email: true

before_deploy:
  - mkdir bundle
  - cp `stack path --dist-dir`/build/trypurescript/trypurescript bundle/
  - cp LICENSE bundle/
  - tar czf trypurescript.tar.gz -C bundle/ .

deploy:
  provider: releases
  api_key: $RELEASE_KEY
  file: trypurescript.tar.gz
  skip_cleanup: true
  on:
    tags: true

Move whole CI script into 'script' stage
Move whole CI script into 'script' stage

I think this should allow caches to be saved.
