# https://docs.haskellstack.org/en/stable/travis_ci/

dist: bionic
language: generic
cache:
  directories:
  - $HOME/.local/bin
  - $HOME/.stack
  - $TRAVIS_BUILD_DIR/.stack-work

addons:
  apt:
    update: true
    packages:
      - libgmp-dev
      - llvm-9-tools
      - llvm-9-dev
      - python3-numpy
      - python3-pip
      - haskell-stack
jobs:
  include:
    - stage: Upgrade Stack
      script:
        - export DIR=~/.local/bin
        - if [ ! -d "$DIR" ]; then mkdir -p ~/.local/bin; fi
        - export PATH=$HOME/.local/bin:$PATH
        - stack upgrade
        - hash -r
        - stack setup
    - stage: Install Python dependencies
      script:
        - pip install --upgrade jax jaxlib
    - stage: Build dependencies
      script:
        - export PATH=$HOME/.local/bin:/usr/lib/llvm-9/bin:$PATH
        - stack build --only-dependencies
    - stage: Build
      script:
        - export PATH=$HOME/.local/bin:/usr/lib/llvm-9/bin:$PATH
        - make
    - stage: Test
      script:
        - export PATH=$HOME/.local/bin:/usr/lib/llvm-9/bin:$PATH
        - make tests

# https://docs.haskellstack.org/en/stable/travis_ci/

dist: bionic
language: generic
cache:
  directories:
  - $HOME/.local/bin
  - $HOME/.stack
  - $TRAVIS_BUILD_DIR/.stack-work

addons:
  apt:
    update: true
    packages:
      - libgmp-dev
      - llvm-9-tools
      - llvm-9-dev
      - python3-numpy
      - python3-pip
      - haskell-stack
jobs:
  include:
    - stage: Install and build dependencies
      script:
        - export DIR=~/.local/bin
        - export PATH=$HOME/.local/bin:/usr/lib/llvm-9/bin:$PATH
        - if [ ! -d "$DIR" ]; then mkdir -p ~/.local/bin; fi
        - stack upgrade
        - hash -r
        - stack setup
        - pip install --upgrade jax jaxlib
        - stack build --only-dependencies
    - stage: Build and test
      script:
        - export PATH=$HOME/.local/bin:/usr/lib/llvm-9/bin:$PATH
        - make tests

Use fewer build stages to speed up CI
Use fewer build stages to speed up CI
