language: python

python: "3.6"

env:
  global:
    - UCI_HTTPS_URL="https://archive.ics.uci.edu/ml/machine-learning-databases"
    - UCI_FTP_URL="ftp://ftp.ics.uci.edu/pub/machine-learning-databases"

branches:
  only:
    - master

install:
  - pip install numpy==1.15
  - pip install -r requirements.txt
  - pip install flake8
  - if ! wget ${UCI_HTTPS_URL}/adult/adult.data -P aif360/data/raw/adult/ ; then wget ${UCI_FTP_URL}/adult/adult.data -P aif360/data/raw/adult/ ; fi
  - if ! wget ${UCI_HTTPS_URL}/adult/adult.test -P aif360/data/raw/adult/ ; then wget ${UCI_FTP_URL}/adult/adult.test -P aif360/data/raw/adult/; fi
  - if ! wget ${UCI_HTTPS_URL}/adult/adult.names -P aif360/data/raw/adult/ ; then wget ${UCI_FTP_URL}/adult/adult.names -P aif360/data/raw/adult/; fi
  - if ! wget ${UCI_HTTPS_URL}/statlog/german/german.data -P aif360/data/raw/german/ ; then wget ${UCI_FTP_URL}/statlog/german/german.data -P aif360/data/raw/german/; fi
  - if ! wget ${UCI_HTTPS_URL}/statlog/german/german.doc -P aif360/data/raw/german/ ; then wget ${UCI_FTP_URL}/statlog/german/german.doc -P aif360/data/raw/german/; fi
  - wget https://raw.githubusercontent.com/propublica/compas-analysis/master/compas-scores-two-years.csv -P aif360/data/raw/compas/

before_script:
  # exit-zero treats all errors as warnings.  The GitHub editor is 127 chars wide
  - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

script:
  # stop the build if there are Python syntax errors or undefined names
  - flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
  - travis_wait pytest tests
