<commit_before>sudo: required

services:
    - docker

matrix:
    fast_finish: true
    include:
        - env: DOCK=1 PY=2 RUN=unit
          python: 2.7
          os: linux
          dist: trusty

        - env: DOCK=1 PY=3 RUN=unit COVERALLS=1
          python: 3.5
          os: linux
          dist: trusty

        - env: DOCK=1 PY=3 RUN=style
          python: 3.5
          os: linux
          dist: trusty

        - language: generic
          env: RUN=unit PY=2 HOMEBREW_NO_AUTO_UPDATE=1
          os: osx

        - language: generic
          env: RUN=unit PY=3 HOMEBREW_NO_AUTO_UPDATE=1
          os: osx


before_install:
    - echo PATH=$PATH;

    # uninstall old GNUpg, install new one and add Brew
    # 'Cellar' folder to the path (contains binaries)
    - if [ "$TRAVIS_OS_NAME" == "osx" ]; then
          brew uninstall gnupg;
          brew install gnupg2;
          sudo ln -sv /usr/local/Cellar/gnupg /usr/local/Cellar/gpg || true;
          sudo ln -sv /usr/local/Cellar/gnupg /usr/local/Cellar/gpg2 || true;
          export PATH=$PATH:/usr/local/Cellar;
      fi;

    # https://github.com/travis-ci/travis-ci/issues/6307
    - if [ "$TRAVIS_OS_NAME" == "osx" ]; then
          curl -sSL https://rvm.io/mpapis.asc | gpg --import -;
          rvm get head;
      fi;

    # use real branch name instead of detached HEAD unless PR
    - if [ "$TRAVIS_PULL_REQUEST_BRANCH" == "" ]; then
          git checkout $TRAVIS_BRANCH;
      fi;

install:
    # build docker images
    - if [ "${TRAVIS_OS_NAME}" == "linux" ] && [ -v DOCK ]; then
          if [ "$PY" == "2" ]; then
              docker build
                  --tag plyer:py2
                  --file Dockerfile.bionic.py2
                  "$(pwd)";
          elif [ "$PY" == "3" ]; then
              docker build
                  --tag plyer:py3
                  --file Dockerfile.bionic.py3
                  "$(pwd)";

              docker build
                  --tag plyer:style
                  --file Dockerfile.bionic.style
                  "$(pwd)";
          fi;
      fi;

    # get Py3 because it's not present in any OSX image on Travis
    - if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
          pyftp=https://www.python.org/ftp/python/3.5.4/;
          py3pkg=python-3.5.4rc1-macosx10.6.pkg;

          if [ "${PY}" == "3" ]; then
              curl -O -L $pyftp$py3pkg;
              sudo installer -package $py3pkg -target /;
          fi;
      fi;

    # manual get-pip.py on OSX because TLS1.2+ required
    # pyfound.blogspot.com/2017/01/time-to-upgrade-your-python-tls-v12.html
    # and install to virtualenv
    - if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
          curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py;
          if [ "${PY}" == "3" ]; then
              sudo python3 get-pip.py;
          else
              sudo python get-pip.py;
          fi;

          if [ "${PY}" == "3" ]; then
              pip3 install --user virtualenv;
              python3 -m virtualenv env;
          else
              pip install --user virtualenv;
              python -m virtualenv env;
          fi;

          source env/bin/activate;
          pip install --upgrade --requirement devrequirements.txt;
          pip install https://github.com/kivy/pyobjus/zipball/master;
      fi;


script:
    # run containers from images
    - if [ "${TRAVIS_OS_NAME}" == "linux" ] && [ -v DOCK ]; then
          if [ "$PY" == "2" ] && [ "$RUN" == "unit" ]; then
              docker run
                  --interactive
                  --tty
                  plyer:py2;

          elif [ "$PY" == "3" ] && [ "$RUN" == "unit" ]; then
              if [ "${COVERALLS}" == "1" ]; then
                  docker run
                      --interactive
                      --tty
                      --env COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN
                      --env COVERALLS_SERVICE_NAME=travis-ci
                      --env TRAVIS_JOB_ID=$TRAVIS_JOB_ID
                      --env TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST
                      --env PLYER_DEPLOY=${PLYER_DEPLOY:-"0"}
                      --env TWINE_REPOSITORY=$TWINE_REPOSITORY
                      --env TWINE_REPOSITORY_URL=$TWINE_REPOSITORY_URL
                      --env TWINE_USERNAME=$TWINE_USERNAME
                      --env TWINE_PASSWORD=$TW<PASSWORD>_PASSWORD
                      plyer:py3;

              else
                  docker run
                      --interactive
                      --tty
                      plyer:py3;
              fi;

          elif [ "$PY" == "3" ] && [ "$RUN" == "style" ]; then
              docker run
                  --interactive
                  --tty
                  plyer:style;
          fi;
        fi;

    # test_facade.py fails to reload modules when run
    # on Travis OSX images in Py3 yet works properly
    # on Windows, Linux and OSX devices
    - if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
          pip install --editable .;
          nosetests
              --stop
              --nocapture
              ./plyer/tests;
      fi;
<commit_msg>Add new Docker images to Travis matrix<commit_after>sudo: required

services:
    - docker

matrix:
    fast_finish: true
    include:
        - env: DOCK=1 IMAGE=bionic PY=2 RUN=unit
          python: 2.7
          os: linux
          dist: trusty

        - env: DOCK=1 IMAGE=bionic PY=3 RUN=unit COVERALLS=1
          python: 3.5
          os: linux
          dist: trusty

        - env: DOCK=1 IMAGE=bionic PY=3 RUN=style
          python: 3.5
          os: linux
          dist: trusty

        - env: DOCK=1 IMAGE=fedora28 PY=2 RUN=unit
          python: 2.7
          os: linux
          dist: trusty

        - env: DOCK=1 IMAGE=fedora28 PY=3 RUN=unit
          python: 3.5
          os: linux
          dist: trusty

        - env: DOCK=1 IMAGE=archlinux PY=2 RUN=unit
          python: 2.7
          os: linux
          dist: trusty

        - env: DOCK=1 IMAGE=archlinux PY=3 RUN=unit
          python: 3.5
          os: linux
          dist: trusty

        - language: generic
          env: RUN=unit PY=2 HOMEBREW_NO_AUTO_UPDATE=1
          os: osx

        - language: generic
          env: RUN=unit PY=3 HOMEBREW_NO_AUTO_UPDATE=1
          os: osx


before_install:
    - echo PATH=$PATH;

    # uninstall old GNUpg, install new one and add Brew
    # 'Cellar' folder to the path (contains binaries)
    - if [ "$TRAVIS_OS_NAME" == "osx" ]; then
          brew uninstall gnupg;
          brew install gnupg2;
          sudo ln -sv /usr/local/Cellar/gnupg /usr/local/Cellar/gpg || true;
          sudo ln -sv /usr/local/Cellar/gnupg /usr/local/Cellar/gpg2 || true;
          export PATH=$PATH:/usr/local/Cellar;
      fi;

    # https://github.com/travis-ci/travis-ci/issues/6307
    - if [ "$TRAVIS_OS_NAME" == "osx" ]; then
          curl -sSL https://rvm.io/mpapis.asc | gpg --import -;
          rvm get head;
      fi;

    # use real branch name instead of detached HEAD unless PR
    - if [ "$TRAVIS_PULL_REQUEST_BRANCH" == "" ]; then
          git checkout $TRAVIS_BRANCH;
      fi;

install:
    # build docker images
    - if [ "${TRAVIS_OS_NAME}" == "linux" ] && [ -v DOCK ]; then
          if [ "$PY" == "2" ]; then
              docker build
                  --tag plyer:py2
                  --file Dockerfile.$IMAGE.py2
                  "$(pwd)";
          elif [ "$PY" == "3" ]; then
              docker build
                  --tag plyer:py3
                  --file Dockerfile.$IMAGE.py3
                  "$(pwd)";

              if [ "$RUN" == "style" ]; then
                  docker build
                      --tag plyer:style
                      --file Dockerfile.$IMAGE.style
                      "$(pwd)";
              fi;
          fi;
      fi;

    # get Py3 because it's not present in any OSX image on Travis
    - if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
          pyftp=https://www.python.org/ftp/python/3.5.4/;
          py3pkg=python-3.5.4rc1-macosx10.6.pkg;

          if [ "${PY}" == "3" ]; then
              curl -O -L $pyftp$py3pkg;
              sudo installer -package $py3pkg -target /;
          fi;
      fi;

    # manual get-pip.py on OSX because TLS1.2+ required
    # pyfound.blogspot.com/2017/01/time-to-upgrade-your-python-tls-v12.html
    # and install to virtualenv
    - if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
          curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py;
          if [ "${PY}" == "3" ]; then
              sudo python3 get-pip.py;
          else
              sudo python get-pip.py;
          fi;

          if [ "${PY}" == "3" ]; then
              pip3 install --user virtualenv;
              python3 -m virtualenv env;
          else
              pip install --user virtualenv;
              python -m virtualenv env;
          fi;

          source env/bin/activate;
          pip install --upgrade --requirement devrequirements.txt;
          pip install https://github.com/kivy/pyobjus/zipball/master;
      fi;


script:
    # run containers from images
    - if [ "${TRAVIS_OS_NAME}" == "linux" ] && [ -v DOCK ]; then
          if [ "$PY" == "2" ] && [ "$RUN" == "unit" ]; then
              docker run
                  --interactive
                  --tty
                  plyer:py2;

          elif [ "$PY" == "3" ] && [ "$RUN" == "unit" ]; then
              if [ "${COVERALLS}" == "1" ]; then
                  docker run
                      --interactive
                      --tty
                      --env COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN
                      --env COVERALLS_SERVICE_NAME=travis-ci
                      --env TRAVIS_JOB_ID=$TRAVIS_JOB_ID
                      --env TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST
                      --env PLYER_DEPLOY=${PLYER_DEPLOY:-"0"}
                      --env TWINE_REPOSITORY=$TWINE_REPOSITORY
                      --env TWINE_REPOSITORY_URL=$TWINE_REPOSITORY_URL
                      --env TWINE_USERNAME=$TWINE_USERNAME
                      --env TWINE_PASSWORD=$TWINE_PASSWORD
                      plyer:py3;

              else
                  docker run
                      --interactive
                      --tty
                      plyer:py3;
              fi;

          elif [ "$PY" == "3" ] && [ "$RUN" == "style" ]; then
              docker run
                  --interactive
                  --tty
                  plyer:style;
          fi;
        fi;

    # test_facade.py fails to reload modules when run
    # on Travis OSX images in Py3 yet works properly
    # on Windows, Linux and OSX devices
    - if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
          pip install --editable .;
          nosetests
              --stop
              --nocapture
              ./plyer/tests;
      fi;

{'fraction_non_alphanumeric': 0.1162082333394868, 'fraction_numerical': 0.014399113900683035, 'mean_word_length': 1.2868298860278597, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 10, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2162684', 'n_tokens_mistral': 3618, 'n_tokens_neox': 3332, 'n_words': 814}