<commit_before>language: php
sudo: true
dist: xenial

cache:
  pip: true
  directories:
    - ${TRAVIS_BUILD_DIR}/site/vendor
    - ${HOME}/.composer/cache
    - ${HOME}/.cache/pip

# We use build stages (https://docs.travis-ci.com/user/build-stages/) to allow us to
# create a matrix of firstly building and testing various PHP targets in several ways
# (lint, unit test, e2e test) and then test out various C++ compilers to ensure our
# best compatibility.
jobs:
  fast_finish: true

  include:
    # Test if the name of the PR starts with [WIP] and fail at this stage if it does
    - if: type = pull_request
      stage: pr test for wip
      language: python
      python: 3.6
      install:
        - pip3 install requests
      script:
        - echo "Checking title for ${TRAVIS_REPO_SLUG}/pulls/${TRAVIS_PULL_REQUEST}"
        - python3 ${TRAVIS_BUILD_DIR}/.setup/travis/check_wip.py ${TRAVIS_REPO_SLUG} ${TRAVIS_PULL_REQUEST}

    # Warm up the pip and composer caches to use it for the rest of the build stages
    - &00-cache
      stage: 00 warm up cache
      php: 7.0
      before_install: source ${TRAVIS_BUILD_DIR}/.setup/travis/before_install.sh
      install:
        - pushd site
        - travis_retry composer install --prefer-dist --no-interaction
        - popd
        - pip3 install -U pip
        - pip3 install python-pam
        - pip3 install PyYAML
        - pip3 install psycopg2-binary
        - pip3 install sqlalchemy
        - pip3 install pylint_runner
        - pip3 install python-dateutil
        - pip3 install selenium
        - pip3 install pause
        - pip3 install tzlocal
        - pip3 install paramiko
        - pip3 install psutil
      script: skip
    - <<: *00-cache
      php: 7.1
      if: branch = master OR type = pull_request
    - <<: *00-cache
      php: 7.2
      if: branch = master OR type = pull_request

    - &00-python-cache
      language: python
      python: 3.5
      install:
        - pip3 install flake8 flake8-bugbear flake8-docstrings sqlalchemy psycopg2-binary
      script: skip
    - <<: *00-python-cache
      python: 3.6
      if: branch = master OR type = pull_request

    # Lint the codebase to ensure that the code is compliant to our system
    - &01-php-lint
      stage: 01 lint
      php: 7.0
      script:
        - find -L . -path ./site/vendor -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
    - <<: *01-php-lint
      php: 7.1
      if: branch = master OR type = pull_request
    - <<: *01-php-lint
      php: 7.2
      if: branch = master OR type = pull_request
    
    - &01-python-lint
      language: python
      python: 3.5
      install:
        - pip3 install flake8 flake8-bugbear flake8-docstrings
      script:
        - flake8
    - <<: *01-python-lint
      python: 3.6
      if: branch = master OR type = pull_request

    - &02-php-unit
      stage: 02 unit test
      php: 7.0
      script:
        - pushd site
        - vendor/bin/phpunit --version
        - vendor/bin/phpunit --configuration tests/phpunit.xml
        - popd
      after_success:
        - pushd site
        - travis_retry php vendor/bin/php-coveralls -v -c tests/coveralls.yml
        - popd
    - <<: *02-php-unit
      php: 7.1
      if: branch = master OR type = pull_request
    - <<: *02-php-unit
      php: 7.2
      if: branch = master OR type = pull_request

    - &02-python-unit
      language: python
      python: 3.4
      install:
        - pip3 install -U pip
        - pip3 install tzlocal
        - pip3 install sqlalchemy
      script:
        - pushd python_submitty_utils
        - python3 setup.py test
        - popd

        - pushd migration
        - python3 -m unittest discover
        - popd
    - <<: *02-python-unit
      python: 3.5
      if: branch = master OR type = pull_request
    - <<: *02-python-unit
      python: 3.6
      if: branch = master OR type = pull_request

    - &03-e2e
      stage: 03 e2e test
      php: 7.0
      env: AUTH_METHOD=1
      services:
        - xvfb
        - docker
      addons:
        chrome: stable
        postgresql: "9.5"
        apt:
          sources:
            - sourceline: "deb http://archive.ubuntu.com/ubuntu trusty multiverse"
            - sourceline: "deb http://archive.ubuntu.com/ubuntu trusty-updates multiverse"
          packages:
            - apache2
            - libapache2-mod-fastcgi
            - build-essential
            - automake
            - cmake
            - clang
            - g++-multilib
            - libseccomp2
            - seccomp
            - libseccomp-dev
            - valgrind
            - pkg-config
            - flex
            - bison
            - poppler-utils
            - libpcre3
            - libpcre3-dev
            - unzip
            - google-chrome-stable
            - libpam-passwdqc
            - libboost-all-dev
      before_install: source ${TRAVIS_BUILD_DIR}/.setup/travis/before_install.sh
      install:
        - PHP_VERSION=${TRAVIS_PHP_VERSION:0:3}
        - sudo add-apt-repository -y ppa:ondrej/php; sudo apt-get -qq update;
        - sudo apt-get -y install libapache2-mod-php${PHP_VERSION} php${PHP_VERSION}-pgsql php${PHP_VERSION}-curl; a2enmod php${PHP_VERSION};
        - pip3 install -U pip
        - pip3 install python-pam
        - pip3 install PyYAML
        - pip3 install psycopg2-binary
        - pip3 install sqlalchemy
        - pip3 install pylint_runner
        - pip3 install python-dateutil
        - pip3 install selenium
        - pip3 install pause
        - pip3 install paramiko
        - pip3 install psutil
        - wget https://chromedriver.storage.googleapis.com/2.46/chromedriver_linux64.zip
        - unzip chromedriver_linux64.zip
        - sudo chmod u+x chromedriver
        - sudo mv chromedriver /usr/bin/
        - pushd ${TRAVIS_BUILD_DIR}/python_submitty_utils
        - pip3 install .
        - popd
      before_script:
        # Need to make this a full repo so that we can get the tag information
        # when we're installing
        - git fetch --unshallow
        - git fetch
        # Doing this helps chromedriver from hanging for some mysterious reason
        # https://github.com/SeleniumHQ/docker-selenium/issues/87
        - export DBUS_SESSION_BUS_ADDRESS=/dev/null
        - psql -U postgres -c "CREATE ROLE submitty_dbuser WITH SUPERUSER CREATEDB CREATEROLE LOGIN PASSWORD '<PASSWORD>'"<commit_msg>[Bugfix] Automatically determine appropriate chromedriver version for Travis (#3589)<commit_after>language: php
sudo: true
dist: xenial

cache:
  pip: true
  directories:
    - ${TRAVIS_BUILD_DIR}/site/vendor
    - ${HOME}/.composer/cache
    - ${HOME}/.cache/pip

# We use build stages (https://docs.travis-ci.com/user/build-stages/) to allow us to
# create a matrix of firstly building and testing various PHP targets in several ways
# (lint, unit test, e2e test) and then test out various C++ compilers to ensure our
# best compatibility.
jobs:
  fast_finish: true

  include:
    # Test if the name of the PR starts with [WIP] and fail at this stage if it does
    - if: type = pull_request
      stage: pr test for wip
      language: python
      python: 3.6
      install:
        - pip3 install requests
      script:
        - echo "Checking title for ${TRAVIS_REPO_SLUG}/pulls/${TRAVIS_PULL_REQUEST}"
        - python3 ${TRAVIS_BUILD_DIR}/.setup/travis/check_wip.py ${TRAVIS_REPO_SLUG} ${TRAVIS_PULL_REQUEST}

    # Warm up the pip and composer caches to use it for the rest of the build stages
    - &00-cache
      stage: 00 warm up cache
      php: 7.0
      before_install: source ${TRAVIS_BUILD_DIR}/.setup/travis/before_install.sh
      install:
        - pushd site
        - travis_retry composer install --prefer-dist --no-interaction
        - popd
        - pip3 install -U pip
        - pip3 install python-pam
        - pip3 install PyYAML
        - pip3 install psycopg2-binary
        - pip3 install sqlalchemy
        - pip3 install pylint_runner
        - pip3 install python-dateutil
        - pip3 install selenium
        - pip3 install pause
        - pip3 install tzlocal
        - pip3 install paramiko
        - pip3 install psutil
      script: skip
    - <<: *00-cache
      php: 7.1
      if: branch = master OR type = pull_request
    - <<: *00-cache
      php: 7.2
      if: branch = master OR type = pull_request

    - &00-python-cache
      language: python
      python: 3.5
      install:
        - pip3 install flake8 flake8-bugbear flake8-docstrings sqlalchemy psycopg2-binary
      script: skip
    - <<: *00-python-cache
      python: 3.6
      if: branch = master OR type = pull_request

    # Lint the codebase to ensure that the code is compliant to our system
    - &01-php-lint
      stage: 01 lint
      php: 7.0
      script:
        - find -L . -path ./site/vendor -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
    - <<: *01-php-lint
      php: 7.1
      if: branch = master OR type = pull_request
    - <<: *01-php-lint
      php: 7.2
      if: branch = master OR type = pull_request
    
    - &01-python-lint
      language: python
      python: 3.5
      install:
        - pip3 install flake8 flake8-bugbear flake8-docstrings
      script:
        - flake8
    - <<: *01-python-lint
      python: 3.6
      if: branch = master OR type = pull_request

    - &02-php-unit
      stage: 02 unit test
      php: 7.0
      script:
        - pushd site
        - vendor/bin/phpunit --version
        - vendor/bin/phpunit --configuration tests/phpunit.xml
        - popd
      after_success:
        - pushd site
        - travis_retry php vendor/bin/php-coveralls -v -c tests/coveralls.yml
        - popd
    - <<: *02-php-unit
      php: 7.1
      if: branch = master OR type = pull_request
    - <<: *02-php-unit
      php: 7.2
      if: branch = master OR type = pull_request

    - &02-python-unit
      language: python
      python: 3.4
      install:
        - pip3 install -U pip
        - pip3 install tzlocal
        - pip3 install sqlalchemy
      script:
        - pushd python_submitty_utils
        - python3 setup.py test
        - popd

        - pushd migration
        - python3 -m unittest discover
        - popd
    - <<: *02-python-unit
      python: 3.5
      if: branch = master OR type = pull_request
    - <<: *02-python-unit
      python: 3.6
      if: branch = master OR type = pull_request

    - &03-e2e
      stage: 03 e2e test
      php: 7.0
      env: AUTH_METHOD=1
      services:
        - xvfb
        - docker
      addons:
        chrome: stable
        postgresql: "9.5"
        apt:
          sources:
            - sourceline: "deb http://archive.ubuntu.com/ubuntu trusty multiverse"
            - sourceline: "deb http://archive.ubuntu.com/ubuntu trusty-updates multiverse"
          packages:
            - apache2
            - libapache2-mod-fastcgi
            - build-essential
            - automake
            - cmake
            - clang
            - g++-multilib
            - libseccomp2
            - seccomp
            - libseccomp-dev
            - valgrind
            - pkg-config
            - flex
            - bison
            - poppler-utils
            - libpcre3
            - libpcre3-dev
            - unzip
            - google-chrome-stable
            - libpam-passwdqc
            - libboost-all-dev
      before_install: source ${TRAVIS_BUILD_DIR}/.setup/travis/before_install.sh
      install:
        - PHP_VERSION=${TRAVIS_PHP_VERSION:0:3}
        - sudo add-apt-repository -y ppa:ondrej/php; sudo apt-get -qq update;
        - sudo apt-get -y install libapache2-mod-php${PHP_VERSION} php${PHP_VERSION}-pgsql php${PHP_VERSION}-curl; a2enmod php${PHP_VERSION};
        - pip3 install -U pip
        - pip3 install python-pam
        - pip3 install PyYAML
        - pip3 install psycopg2-binary
        - pip3 install sqlalchemy
        - pip3 install pylint_runner
        - pip3 install python-dateutil
        - pip3 install selenium
        - pip3 install pause
        - pip3 install paramiko
        - pip3 install psutil
        - CHROME_VERSION=$(google-chrome --version | egrep -o -e '[0-9]+\.[0-9]+\.[0-9]+')
        - CHROME_DRIVER_VERSION=$(curl -L https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION})
        - wget https://chromedriver.storage.googleapis.com/${CHROME_DRIVER_VERSION}/chromedriver_linux64.zip
        - unzip chromedriver_linux64.zip
        - sudo chmod u+x chromedriver
        - sudo mv chromedriver /usr/bin/
        - pushd ${TRAVIS_BUILD_DIR}/python_submitty_utils
        - pip3 install .
        - popd
      before_script:
        # Need to make this a full repo so that we can get the tag information
        # when we're installing
        - git fetch --unshallow
        - git fetch
        # Doing this helps chromedriver from hanging for some mysterious reason
        # https://github.com/SeleniumHQ/docker-selenium/issues/87
        - export DBUS_SESSION_BUS_ADDRESS=/dev/null
        - psql -U postgres -c "CREATE ROLE submitty_dbuser WITH SUPERUSER CREATEDB CREATEROLE LOGIN PASSWORD '<PASSWORD>'"
{'fraction_non_alphanumeric': 0.0897592197500762, 'fraction_numerical': 0.023239865894544347, 'mean_word_length': 1.746390458254865, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 5, 'https://': 7, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '2579986', 'n_tokens_mistral': 4342, 'n_tokens_neox': 4080, 'n_words': 1142}