<commit_before>sudo: false
language: php
php:
  - 5.4
  - 5.5
  - 5.6
  - 7
  - hhvm

env:
  global:
    - CORE_BRANCH=master
    - APP_NAME=gallery
    - GH_REF: github.com/owncloud/gallery.git
    - secure: "<KEY>
  matrix:
    - DB=sqlite

branches:
  only:
    - master
    - /^stable\d+(\.\d+)?$/

cache:
  directories:
      - ../core/apps/$APP_NAME/vendor
      - $HOME/.composer/cache

before_install:
  # Setup Selenium
  - export DISPLAY=:99.0
  - sh -e /etc/init.d/xvfb start
  - sleep 3
  - wget https://selenium-release.storage.googleapis.com/2.47/selenium-server-standalone-2.47.0.jar
  - java -jar selenium-server-standalone-2.47.0.jar -port 4444 >/dev/null 2>&1 & # WARNING - Takes a long time to start up. Keep here

  # Ghostdriver does not work on Travis - Download the latest PhantomJS
  #- mkdir travis-phantomjs
  #- wget https://s3.amazonaws.com/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -O $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2
  #- tar -xvf $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -C $PWD/travis-phantomjs
  #- export PATH=$PWD/travis-phantomjs:$PATH
  #- phantomjs --webdriver=4444 --ignore-ssl-errors=true --webdriver-loglevel=DEBUG &

  # Getting dependencies
  # Graphviz. Disabled on Travis because it requires sudo and will be replaced by proper diagrams
  #- sudo apt-get -qq update > /dev/null
  #- sudo apt-get -qq install graphviz > /dev/null
  #- phpenv rehash > /dev/null

  # Composer
  - composer self-update
  - composer install -o --prefer-source

  # Installing ownCloud
  - wget https://raw.githubusercontent.com/owncloud/administration/master/travis-ci/before_install.sh
  - bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB
  - cd ../core
  - php occ app:enable $APP_NAME

before_script:
  # Make sure Webdriver is running
  - curl http://localhost:4444/wd/hub/status
  #- phantomjs --version

  # Install the Imagick PHP extension
  - sh -c "if [ '$TRAVIS_PHP_VERSION' != 'hhvm' ]; then printf "\n" | pecl install imagick; fi;"

script:
  # Test lint
  - cd apps/$APP_NAME
  - php vendor/bin/parallel-lint --exclude vendor . vendor/composer vendor/symfony/yaml vendor/autoload.php

  # Acceptance tests, using Firefox, without code coverage
  - sh -c "if [ '$TRAVIS_PHP_VERSION' != 'hhvm' ] && [ '$TRAVIS_PHP_VERSION' != '7' ]; then php vendor/bin/codecept run acceptance --env firefox; fi;"
  # Unit, integration and api tests, without code coverage
  - sh -c "if [ '$TRAVIS_PHP_VERSION' != 'hhvm' ] && [ '$TRAVIS_PHP_VERSION' != '7' ] && [ '$TRAVIS_PHP_VERSION' != '5.6' ]; then php vendor/bin/codecept run unit,integration,api; fi;"

  # PHP 5.6 ONLY: Unit, integration and api tests with code coverage
  - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.6' ]; then php vendor/bin/codecept run unit,integration,api --coverage --coverage-xml --coverage-html; fi;"
  # Send coverage report to Scrutinizer
  - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.6' ]; then wget https://scrutinizer-ci.com/ocular.phar; fi"
  - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.6' ]; then php ocular.phar code-coverage:upload --format=php-clover tests/_output/coverage.xml; fi"

  # Generate API documentation
  - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.6' ]; then php vendor/bin/phpdoc run; fi"
  # Generate Wiki documentation
  - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.6' ]; then git submodule update --init; fi"
  # Send documentation to Github Pages
  - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.6' ]; then cd build/documentation; bash ./docpublisher.sh; fi"

matrix:
  include:
    - php: 5.4
      env: DB=mysql<commit_msg>Fix Travis caching config<commit_after>sudo: false
language: php
php:
  - 5.4
  - 5.5
  - 5.6
  - 7
  - hhvm

env:
  global:
    - CORE_BRANCH=master
    - APP_NAME=gallery
    - GH_REF: github.com/owncloud/gallery.git
    - secure: "<KEY>
  matrix:
    - DB=sqlite

branches:
  only:
    - master
    - /^stable\d+(\.\d+)?$/

cache:
  directories:
    # ${TRAVIS_BUILD_DIR} is /home/travis/build/owncloud/gallery/
    - ${TRAVIS_BUILD_DIR}/travis/php-cache
    - $HOME/.composer/cache

before_cache:
  # Archive the vendor folder
  - cp ${TRAVIS_BUILD_DIR}/../core/apps/$APP_NAME/vendor ${TRAVIS_BUILD_DIR}/travis/php-cache/`php-config --vernum`

before_install:
  # Setup Selenium
  - export DISPLAY=:99.0
  - sh -e /etc/init.d/xvfb start
  - sleep 3
  - wget https://selenium-release.storage.googleapis.com/2.47/selenium-server-standalone-2.47.0.jar
  - java -jar selenium-server-standalone-2.47.0.jar -port 4444 >/dev/null 2>&1 & # WARNING - Takes a long time to start up. Keep here

  # Ghostdriver does not work on Travis - Download the latest PhantomJS
  #- mkdir travis-phantomjs
  #- wget https://s3.amazonaws.com/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -O $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2
  #- tar -xvf $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -C $PWD/travis-phantomjs
  #- export PATH=$PWD/travis-phantomjs:$PATH
  #- phantomjs --webdriver=4444 --ignore-ssl-errors=true --webdriver-loglevel=DEBUG &

  # Getting dependencies
  # Graphviz. Disabled on Travis because it requires sudo and will be replaced by proper diagrams
  #- sudo apt-get -qq update > /dev/null
  #- sudo apt-get -qq install graphviz > /dev/null
  #- phpenv rehash > /dev/null

  # Installing ownCloud
  - wget https://raw.githubusercontent.com/owncloud/administration/master/travis-ci/before_install.sh
  - bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB
  - cd ../core
  - php occ app:enable $APP_NAME

  # Sets up the cache
  - sh -c "if [ ! -d ${TRAVIS_BUILD_DIR}/travis/php-cache/`php-config --vernum` ]; then mkdir -p ${TRAVIS_BUILD_DIR}/travis/php-cache/`php-config --vernum`; fi;"
  - rm -rf ${TRAVIS_BUILD_DIR}/../core/apps/$APP_NAME/vendor
  - sh -c "if [ -d ${TRAVIS_BUILD_DIR}/travis/php-cache/`php-config --vernum`/vendor ]; then cp ${TRAVIS_BUILD_DIR}/travis/php-cache/`php-config --vernum`/vendor ${TRAVIS_BUILD_DIR}/../core/apps/$APP_NAME; fi;"

  # Composer
  - cd ${TRAVIS_BUILD_DIR}/../core/apps/$APP_NAME
  - composer self-update
  - composer install -o --prefer-source

before_script:
  # Make sure Webdriver is running
  - curl http://localhost:4444/wd/hub/status
  #- phantomjs --version

  # Install the Imagick PHP extension
  - sh -c "if [ '$TRAVIS_PHP_VERSION' != 'hhvm' ]; then printf "\n" | pecl install imagick; fi;"

script:
  # Test lint
  - php vendor/bin/parallel-lint --exclude vendor . vendor/composer vendor/symfony/yaml vendor/autoload.php

  # Acceptance tests, using Firefox, without code coverage
  - sh -c "if [ '$TRAVIS_PHP_VERSION' != 'hhvm' ] && [ '$TRAVIS_PHP_VERSION' != '7' ]; then php vendor/bin/codecept run acceptance --env firefox; fi;"
  # Unit, integration and api tests, without code coverage
  - sh -c "if [ '$TRAVIS_PHP_VERSION' != 'hhvm' ] && [ '$TRAVIS_PHP_VERSION' != '7' ] && [ '$TRAVIS_PHP_VERSION' != '5.6' ]; then php vendor/bin/codecept run unit,integration,api; fi;"

  # PHP 5.6 ONLY: Unit, integration and api tests with code coverage
  - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.6' ]; then php vendor/bin/codecept run unit,integration,api --coverage --coverage-xml --coverage-html; fi;"
  # Send coverage report to Scrutinizer
  - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.6' ]; then wget https://scrutinizer-ci.com/ocular.phar; fi"
  - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.6' ]; then php ocular.phar code-coverage:upload --format=php-clover tests/_output/coverage.xml; fi"

  # Generate API documentation
  - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.6' ]; then php vendor/bin/phpdoc run; fi"
  # Generate Wiki documentation
  - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.6' ]; then git submodule update --init; fi"
  # Send documentation to Github Pages
  - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.6' ]; then cd build/documentation; bash ./docpublisher.sh; fi"

matrix:
  include:
    - php: 5.4
      env: DB=mysql
{'fraction_non_alphanumeric': 0.15062602757050714, 'fraction_numerical': 0.02048817503477931, 'mean_word_length': 3.1446540880503147, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1812912', 'n_tokens_mistral': 3120, 'n_tokens_neox': 2930, 'n_words': 689}