language: python
python:
  - "3.4"
  - "3.5"
  - "3.6"
  - "3.7"
  - "3.8"
  - "3.9-dev"
  - "pypy3"

install:
  # Archey package installation (and dependencies).
  - pip3 install .

  # Pylint, Stickytape and PyInstaller external dependencies (see below).
  - pip3 install pylint stickytape pyinstaller

script:
  # Simple execution.
  - time "${VIRTUAL_ENV}/bin/archey"
  - time python3 -m archey

  # Tests suite.
  - python3 setup.py -q test
  - python3 -m unittest

  # Lint all the things !
  - pylint archey/

  # Build a standalone script from sources (Stickytape).
  - >
      stickytape \
        --copy-shebang \
        --add-python-path . \
        --output-file dist/archey \
        archey/__main__.py
  - chmod +x dist/archey
  - time ./dist/archey

  # Build a standalone script from sources (PyInstaller).
  # (currently) disabled for Python 3.8 and PyPy.
  # See <pyinstaller/pyinstaller#4311> & <https://stackoverflow.com/a/22245203>.
  - >
      if ! [[ "$TRAVIS_PYTHON_VERSION" =~ ^(3\.8|pypy3)$ ]]; then
        pyinstaller \
          --distpath dist \
          --specpath dist \
          --name archey \
          --onefile archey/__main__.py \
          --log-level WARN
        time ./dist/archey
      fi