language: python
python: 3.7

# To turn off cached cython files and compiler cache
# set NOCACHE-true
# To delete caches go to https://travis-ci.org/OWNER/REPOSITORY/caches or run
# travis cache --delete inside the project directory from the travis command line client
# The cache directories will be deleted if anything in ci/ changes in a commit
cache:
  ccache: true
  directories:
    - $HOME/.cache # cython cache
    - $HOME/.ccache # compiler cache

env:
  global:
    # Variable for test workers
    - PYTEST_WORKERS="auto"
    # create a github personal access token
    # cd pandas-dev/pandas
    # travis encrypt 'PANDAS_GH_TOKEN=personal_access_token' -r pandas-dev/pandas
    - secure: "EkWLZhbrp/mXJOx38CHjs7BnjXafsqHtwxPQrqWy457VDFWhIY1DMnIR/lOWG+a20Qv52sCsFtiZEmMfUjf0pLGXOqurdxbYBGJ7/ikFLk9yV2rDwiArUlVM9bWFnFxHvdz9zewBH55WurrY4ShZWyV+x2dWjjceWG5VpWeI6sA="

git:
  # for cloning
  depth: false

matrix:
  fast_finish: true

  include:
    # In allowed failures
    - dist: bionic
      python: 3.9-dev
      env:
        - JOB="3.9-dev" PATTERN="(not slow and not network and not clipboard)"
    - env:
        - JOB="3.8" ENV_FILE="ci/deps/travis-38.yaml" PATTERN="(not slow and not network and not clipboard)"

    - env:
        - JOB="3.7" ENV_FILE="ci/deps/travis-37.yaml" PATTERN="(not slow and not network and not clipboard)"

    - arch: arm64
      env:
        - JOB="3.7, arm64" PYTEST_WORKERS=8 ENV_FILE="ci/deps/travis-37-arm64.yaml" PATTERN="(not slow and not network and not clipboard)"

    - env:
        - JOB="3.6, locale" ENV_FILE="ci/deps/travis-36-locale.yaml" PATTERN="((not slow and not network and not clipboard) or (single and db))" LOCALE_OVERRIDE="zh_CN.UTF-8" SQL="1"
      services:
        - mysql
        - postgresql

    - env:
        # Enabling Deprecations when running tests
        # PANDAS_TESTING_MODE="deprecate" causes DeprecationWarning messages to be displayed in the logs
        # See pandas/_testing.py for more details.
        - JOB="3.6, coverage" ENV_FILE="ci/deps/travis-36-cov.yaml" PATTERN="((not slow and not network and not clipboard) or (single and db))" PANDAS_TESTING_MODE="deprecate" COVERAGE=true SQL="1"
      services:
        - mysql
        - postgresql

    - env:
        - JOB="3.6, slow" ENV_FILE="ci/deps/travis-36-slow.yaml" PATTERN="slow" SQL="1"
      services:
        - mysql
        - postgresql
  allow_failures:
    - arch: arm64
      env:
        - JOB="3.7, arm64" PYTEST_WORKERS=8 ENV_FILE="ci/deps/travis-37-arm64.yaml" PATTERN="(not slow and not network and not clipboard)"
    - dist: bionic
      python: 3.9-dev
      env:
        - JOB="3.9-dev" PATTERN="(not slow and not network)"

before_install:
  - echo "before_install"
  # Use blocking IO on travis.  Ref:  https://github.com/travis-ci/travis-ci/issues/8920#issuecomment-352661024
  - python -c 'import os,sys,fcntl; flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags&~os.O_NONBLOCK);'
  - source ci/travis_process_gbq_encryption.sh
  - export PATH="$HOME/miniconda3/bin:$PATH"
  - df -h
  - pwd
  - uname -a
  - git --version
  - ./ci/check_git_tags.sh
  # Because travis runs on Google Cloud and has a /etc/boto.cfg,
  # it breaks moto import, see:
  # https://github.com/spulec/moto/issues/1771
  # https://github.com/boto/boto/issues/3741
  # This overrides travis and tells it to look nowhere.
  - export BOTO_CONFIG=/dev/null

install:
  - echo "install start"
  - ci/prep_cython_cache.sh
  - ci/setup_env.sh
  - ci/submit_cython_cache.sh
  - echo "install done"

script:
  - echo "script start"
  - echo "$JOB"
  - if [ "$JOB" != "3.9-dev" ]; then source activate pandas-dev; fi
  - ci/run_tests.sh

after_script:
  - echo "after_script start"
  - source activate pandas-dev && pushd /tmp && python -c "import pandas; pandas.show_versions();" && popd
  - ci/print_skipped.py
  - echo "after_script done"