language: python

python:
  - "2.7"
  - "3.5"

services:
  - docker

before_install:
  - sudo apt-get install -y realpath
  - python --version
  - pip install -U pip pytest pyinstaller pep257 twine codacy-coverage
  # Make the Jpylyzer test files available by cloning the repo as a sibling directory
  - git clone https://github.com/openpreserve/jpylyzer-test-files.git ../jpylyzer-test-files

install:
  - pip install .[testing]

before_script:
  # Pylint everything with the following tests disabled for now:
  # Disabled in the .pylintrc config file
  #  - C0103: Invalid name ( e.g. camel case)
  # Disabled in the command below
  #  - R0201: Method could be a function
  #  - R0902: Too many instance attributes
  #  - R0904: Too many public methods
  #  - R0912: Too many branches
  #  - R0913: Too many arguments
  #  - R0914: Too many local variables
  #  - R0915: Too many statements
  #  - R1702: Too many nested blocks
  #  - R1703: Simplifiable if statement
  #  - W0511: Warning note in comments
  #  - W0702: No Exception type specified
  #  - W0703: Catching too general an Exception type
  #  - C0200: Consider using enumerate instead of iterating with range
  #  - C0302: Too many lines in module
  - if [[ $TRAVIS_PYTHON_VERSION != '2.7' ]]; then pylint --disable R0201,R0902,R0904,R0912,R0913,R0914,R0915,R1702,R1703 --disable W0511,W0702,W0703 --disable C0200,C0302  setup.py ./tests/ ./jpylyzer/; fi

script:
  - pre-commit run --all-files --verbose
  - pytest --cov=jpylyzer
  - pep257 jpylyzer setup.py
  - ./setup.py sdist
  - twine check dist/*
  - ./docker-package.sh debian:stretch
  - ./docker-package-win.sh

after_success:
  - ls -alh ./dist
  - coverage xml
  - python-codacy-coverage -r coverage.xml
  - ./pyi-build/dist/jpylyzer --version
