language: generic

install:
  - curl https://raw.githubusercontent.com/Kha/elan/master/elan-init.sh -sSf | sh -s -- --default-toolchain none -y
  - source ~/.elan/env

script:
  - leanpkg test
  - lean --recursive --export=mathlib.txt
  - leanchecker mathlib.txt

notifications:
  webhooks:
    - https://leanprover.zulipchat.com/api/v1/external/travis?stream=travis&topic=build-status&api_key=SwF1QzwUWol76dCxsYgwHbI6giN3cxGn

language: c
sudo: false
os:
    - linux

cache:
  directories:
    - $TRAVIS_BUILD_DIR/*/
    - $HOME/.elan

install:
  - |
    if [ ! -d "$HOME/.elan/toolchains/" ]; then
      curl https://raw.githubusercontent.com/Kha/elan/master/elan-init.sh -sSf | sh -s -- --default-toolchain none -y
    fi
  - source ~/.elan/env

jobs:
  include:
    - stage: Pre-build
      script:
        - git status | grep  -e "Changes not staged for commit:"; [ $? -ne 0 ] || git checkout -f HEAD
        - rm mathlib.txt || true
        - timeout 2400 leanpkg test || echo timed out

    - stage: Test
      script:
        - git status | grep  -e "Changes not staged for commit:"; [ $? -ne 0 ]
        - leanpkg test
        - lean --recursive --export=mathlib.txt
        - leanchecker mathlib.txt
        - find . -name "*.lean" -delete


notifications:
  webhooks:
    - https://leanprover.zulipchat.com/api/v1/external/travis?stream=travis&topic=build-status&api_key=SwF1QzwUWol76dCxsYgwHbI6giN3cxGn

Break build process into two parts
chore(build): Break build process into two parts
