<commit_before>language: php

dist: xenial

git:
    depth: 2

addons:
    apt_packages:
        - parallel
        - language-pack-fr-base
        - ldap-utils
        - slapd
        - zookeeperd
        - libzookeeper-mt-dev

env:
    global:
        - MIN_PHP=7.1.3
        - SYMFONY_PROCESS_PHP_TEST_BINARY=~/.phpenv/shims/php
        - SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE=1

matrix:
    include:
        - php: 7.1
          env: php_extra="7.2 7.4"
        - php: 7.3
          env: deps=high
        - php: 7.4
          env: deps=low
        - php: nightly
          services: [memcached]
    fast_finish: true
    allow_failures:
        - php: nightly
          services: [memcached]

cache:
    directories:
        - .phpunit
        - php-$MIN_PHP
        - ~/php-ext

before_install:
    - |
      # Enable Sury ppa
      sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <KEY>
      sudo add-apt-repository -y ppa:ondrej/php
      sudo rm /etc/apt/sources.list.d/google-chrome.list
      sudo rm /etc/apt/sources.list.d/mongodb-3.4.list
      sudo apt update
      sudo apt install -y librabbitmq-dev libsodium-dev

    - |
      # General configuration
      set -e
      stty cols 120
      mkdir /tmp/slapd
      if [ ! -e /tmp/slapd-modules ]; then
          [ -d /usr/lib/openldap ] && ln -s /usr/lib/openldap /tmp/slapd-modules || ln -s /usr/lib/ldap /tmp/slapd-modules
      fi
      slapd -f src/Symfony/Component/Ldap/Tests/Fixtures/conf/slapd.conf -h ldap://localhost:3389 &
      cp .github/composer-config.json "$(composer config home)/config.json"
      export PHPUNIT=$(readlink -f ./phpunit)
      export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data"
      export COMPOSER_UP='composer update --no-progress --ansi'
      export COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
      find ~/.phpenv -name xdebug.ini -delete

      nanoseconds () {
          local cmd="date"
          local format="+%s%N"
          local os=$(uname)
          if hash gdate > /dev/null 2>&1; then
            cmd="gdate"
          elif [[ "$os" = Darwin ]]; then
            format="+%s000000000"
          fi
          $cmd -u $format
      }
      export -f nanoseconds

      # tfold is a helper to create folded reports
      tfold () {
          local title="🐘 $PHP $1 $FLIP"
          local fold=$(echo $title | sed -r 's/[^-_A-Za-z0-9]+/./g')
          shift
          local id=$(printf %08x $(( RANDOM * RANDOM )))
          local start=$(nanoseconds)
          echo -e "travis_fold:start:$fold"
          echo -e "travis_time:start:$id"
          echo -e "\\e[1;34m$title\\e[0m"

          bash -xc "$*" 2>&1
          local ok=$?
          local end=$(nanoseconds)
          echo -e "\\ntravis_time:end:$id:start=$start,finish=$end,duration=$(($end-$start))"
          (exit $ok) &&
              echo -e "\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold" ||
              echo -e "\\e[41mKO\\e[0m $title\\n"
          (exit $ok)
      }
      export -f tfold

      # tpecl is a helper to compile and cache php extensions
      tpecl () {
          local ext_name=$1
          local ext_so=$2
          local INI=$3
          local input=${4:-yes}
          local ext_dir=$(php -r "echo ini_get('extension_dir');")
          local ext_cache=~/php-ext/$(basename $ext_dir)/$ext_name

          if [[ -e $ext_cache/$ext_so ]]; then
              echo extension = $ext_cache/$ext_so >> $INI
          else
              rm ~/.pearrc /tmp/pear 2>/dev/null || true
              mkdir -p $ext_cache
              echo $input | pecl install -f $ext_name &&
              cp $ext_dir/$ext_so $ext_cache
          fi
      }
      export -f tpecl

    - |
      # Install sigchild-enabled PHP to test the Process component on the lowest PHP matrix line
      if [[ ! $deps && $TRAVIS_PHP_VERSION = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then
          wget http://php.net/get/php-$MIN_PHP.tar.bz2/from/this/mirror -O - | tar -xj &&
          (cd php-$MIN_PHP && ./configure --enable-sigchild --enable-pcntl && make -j2)
      fi

    - |
      # php.ini configuration
      for PHP in $TRAVIS_PHP_VERSION $php_extra; do
          phpenv global $PHP 2>/dev/null || (cd / && wget https://storage.googleapis.com/travis-ci-language-archives/php/binaries/ubuntu/16.04/x86_64/php-$PHP.tar.bz2 -O - | tar -xj)
          INI=~/.phpenv/versions/$PHP/etc/conf.d/travis.ini
          echo date.timezone = Europe/Paris >> $INI
          echo memory_limit = -1 >> $INI
          echo default_socket_timeout = 10 >> $INI
          echo session.gc_probability = 0 >> $INI
          echo opcache.enable_cli = 1 >> $INI
          echo apc.enable_cli = 1 >> $INI
          if [[ $PHP != nightly ]]; then
              echo extension = memcached.so >> $INI
          fi
      done

    - |
      # Install extra PHP extensions
      for PHP in $TRAVIS_PHP_VERSION $php_extra; do
          export PHP=$PHP
          phpenv global $PHP
          composer self-update
          composer self-update --2
          INI=~/.phpenv/versions/$PHP/etc/conf.d/travis.ini
          if ! php --ri sodium > /dev/null; then
              tfold ext.libsodium tpecl libsodium sodium.so $INI
          fi
          if [[ $PHP = nightly ]]; then
              tfold ext.memcached tpecl memcached-3.1.5 memcached.so $INI
          else
              tfold ext.mongodb tpecl mongodb-1.6.16 mongodb.so $INI
              tfold ext.zookeeper tpecl zookeeper-0.7.2 zookeeper.so $INI
              tfold ext.amqp tpecl amqp-1.10.2 amqp.so $INI
              tfold ext.redis tpecl redis-5.2.2 redis.so $INI "no"
          fi

          tfold ext.apcu tpecl apcu-5.1.19 apcu.so $INI
          tfold ext.igbinary tpecl igbinary-3.1.6 igbinary.so $INI
      done

    - |
      # Load fixtures
      if [[ ! $skip ]]; then
          ldapadd -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/base.ldif &&
          ldapadd -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/fixtures.ldif
      fi

install:
    - |
      # Install the phpunit-bridge from a PR if required
      #
      # To run a PR with a patched phpunit-bridge, first submit the patch for the
      # phpunit-bridge as a separate PR against the next feature-branch then
      # uncomment and update the following line with that PR number
      #SYMFONY_PHPUNIT_BRIDGE_PR=32886

      if [[ $SYMFONY_PHPUNIT_BRIDGE_PR ]]; then
          git fetch --depth=2 origin refs/pull/$SYMFONY_PHPUNIT_BRIDGE_PR/head
          git rm -rq src/Symfony/Bridge/PhpUnit
          git checkout -q FETCH_HEAD -- src/Symfony/Bridge/PhpUnit
          export SYMFONY_VERSION=$(curl -s https://api.github.com/repos/symfony/symfony/pulls/$SYMFONY_PHPUNIT_BRIDGE_PR | jq -r .base.ref)
          sed -i 's/"symfony\/phpunit-bridge": ".*"/"symfony\/phpunit-bridge": "'$SYMFONY_VERSION'.x@dev"/' composer.json
          rm -rf .phpunit
      fi
<commit_msg>Enable Redis tests on nightly.<commit_after>language: php

dist: xenial

git:
    depth: 2

addons:
    apt_packages:
        - parallel
        - language-pack-fr-base
        - ldap-utils
        - slapd
        - zookeeperd
        - libzookeeper-mt-dev

env:
    global:
        - MIN_PHP=7.1.3
        - SYMFONY_PROCESS_PHP_TEST_BINARY=~/.phpenv/shims/php
        - SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE=1

matrix:
    include:
        - php: 7.1
          env: php_extra="7.2 7.4"
        - php: 7.3
          env: deps=high
        - php: 7.4
          env: deps=low
        - php: nightly
          services: [memcached]
    fast_finish: true
    allow_failures:
        - php: nightly
          services: [memcached]

cache:
    directories:
        - .phpunit
        - php-$MIN_PHP
        - ~/php-ext

before_install:
    - |
      # Enable Sury ppa
      sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <KEY>
      sudo add-apt-repository -y ppa:ondrej/php
      sudo rm /etc/apt/sources.list.d/google-chrome.list
      sudo rm /etc/apt/sources.list.d/mongodb-3.4.list
      sudo apt update
      sudo apt install -y librabbitmq-dev libsodium-dev

    - |
      # General configuration
      set -e
      stty cols 120
      mkdir /tmp/slapd
      if [ ! -e /tmp/slapd-modules ]; then
          [ -d /usr/lib/openldap ] && ln -s /usr/lib/openldap /tmp/slapd-modules || ln -s /usr/lib/ldap /tmp/slapd-modules
      fi
      slapd -f src/Symfony/Component/Ldap/Tests/Fixtures/conf/slapd.conf -h ldap://localhost:3389 &
      cp .github/composer-config.json "$(composer config home)/config.json"
      export PHPUNIT=$(readlink -f ./phpunit)
      export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data"
      export COMPOSER_UP='composer update --no-progress --ansi'
      export COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
      find ~/.phpenv -name xdebug.ini -delete

      nanoseconds () {
          local cmd="date"
          local format="+%s%N"
          local os=$(uname)
          if hash gdate > /dev/null 2>&1; then
            cmd="gdate"
          elif [[ "$os" = Darwin ]]; then
            format="+%s000000000"
          fi
          $cmd -u $format
      }
      export -f nanoseconds

      # tfold is a helper to create folded reports
      tfold () {
          local title="🐘 $PHP $1 $FLIP"
          local fold=$(echo $title | sed -r 's/[^-_A-Za-z0-9]+/./g')
          shift
          local id=$(printf %08x $(( RANDOM * RANDOM )))
          local start=$(nanoseconds)
          echo -e "travis_fold:start:$fold"
          echo -e "travis_time:start:$id"
          echo -e "\\e[1;34m$title\\e[0m"

          bash -xc "$*" 2>&1
          local ok=$?
          local end=$(nanoseconds)
          echo -e "\\ntravis_time:end:$id:start=$start,finish=$end,duration=$(($end-$start))"
          (exit $ok) &&
              echo -e "\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold" ||
              echo -e "\\e[41mKO\\e[0m $title\\n"
          (exit $ok)
      }
      export -f tfold

      # tpecl is a helper to compile and cache php extensions
      tpecl () {
          local ext_name=$1
          local ext_so=$2
          local INI=$3
          local input=${4:-yes}
          local ext_dir=$(php -r "echo ini_get('extension_dir');")
          local ext_cache=~/php-ext/$(basename $ext_dir)/$ext_name

          if [[ -e $ext_cache/$ext_so ]]; then
              echo extension = $ext_cache/$ext_so >> $INI
          else
              rm ~/.pearrc /tmp/pear 2>/dev/null || true
              mkdir -p $ext_cache
              echo $input | pecl install -f $ext_name &&
              cp $ext_dir/$ext_so $ext_cache
          fi
      }
      export -f tpecl

    - |
      # Install sigchild-enabled PHP to test the Process component on the lowest PHP matrix line
      if [[ ! $deps && $TRAVIS_PHP_VERSION = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then
          wget http://php.net/get/php-$MIN_PHP.tar.bz2/from/this/mirror -O - | tar -xj &&
          (cd php-$MIN_PHP && ./configure --enable-sigchild --enable-pcntl && make -j2)
      fi

    - |
      # php.ini configuration
      for PHP in $TRAVIS_PHP_VERSION $php_extra; do
          phpenv global $PHP 2>/dev/null || (cd / && wget https://storage.googleapis.com/travis-ci-language-archives/php/binaries/ubuntu/16.04/x86_64/php-$PHP.tar.bz2 -O - | tar -xj)
          INI=~/.phpenv/versions/$PHP/etc/conf.d/travis.ini
          echo date.timezone = Europe/Paris >> $INI
          echo memory_limit = -1 >> $INI
          echo default_socket_timeout = 10 >> $INI
          echo session.gc_probability = 0 >> $INI
          echo opcache.enable_cli = 1 >> $INI
          echo apc.enable_cli = 1 >> $INI
          if [[ $PHP != nightly ]]; then
              echo extension = memcached.so >> $INI
          fi
      done

    - |
      # Install extra PHP extensions
      for PHP in $TRAVIS_PHP_VERSION $php_extra; do
          export PHP=$PHP
          phpenv global $PHP
          composer self-update
          composer self-update --2
          INI=~/.phpenv/versions/$PHP/etc/conf.d/travis.ini
          if ! php --ri sodium > /dev/null; then
              tfold ext.libsodium tpecl libsodium sodium.so $INI
          fi
          if [[ $PHP = nightly ]]; then
              tfold ext.memcached tpecl memcached-3.1.5 memcached.so $INI
          else
              tfold ext.mongodb tpecl mongodb-1.6.16 mongodb.so $INI
              tfold ext.zookeeper tpecl zookeeper-0.7.2 zookeeper.so $INI
              tfold ext.amqp tpecl amqp-1.10.2 amqp.so $INI
          fi

          tfold ext.apcu tpecl apcu-5.1.19 apcu.so $INI
          tfold ext.igbinary tpecl igbinary-3.1.6 igbinary.so $INI
          tfold ext.redis tpecl redis-5.2.3 redis.so $INI "no"
      done

    - |
      # Load fixtures
      if [[ ! $skip ]]; then
          ldapadd -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/base.ldif &&
          ldapadd -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/fixtures.ldif
      fi

install:
    - |
      # Install the phpunit-bridge from a PR if required
      #
      # To run a PR with a patched phpunit-bridge, first submit the patch for the
      # phpunit-bridge as a separate PR against the next feature-branch then
      # uncomment and update the following line with that PR number
      #SYMFONY_PHPUNIT_BRIDGE_PR=32886

      if [[ $SYMFONY_PHPUNIT_BRIDGE_PR ]]; then
          git fetch --depth=2 origin refs/pull/$SYMFONY_PHPUNIT_BRIDGE_PR/head
          git rm -rq src/Symfony/Bridge/PhpUnit
          git checkout -q FETCH_HEAD -- src/Symfony/Bridge/PhpUnit
          export SYMFONY_VERSION=$(curl -s https://api.github.com/repos/symfony/symfony/pulls/$SYMFONY_PHPUNIT_BRIDGE_PR | jq -r .base.ref)
          sed -i 's/"symfony\/phpunit-bridge": ".*"/"symfony\/phpunit-bridge": "'$SYMFONY_VERSION'.x@dev"/' composer.json
          rm -rf .phpunit
      fi

{'fraction_non_alphanumeric': 0.12552153313061312, 'fraction_numerical': 0.016264762039459726, 'mean_word_length': 1.8171314741035856, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 49, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 2, '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': '2787494', 'n_tokens_mistral': 5099, 'n_tokens_neox': 4856, 'n_words': 1130}