WordPress.org

Make WordPress Core

Changeset 45745 for trunk/.travis.yml


Ignore:
Timestamp:
08/05/2019 07:09:14 AM (6 weeks ago)
Author:
pento
Message:

Build Tools: Add a WordPress Development Environment.

This commit adds the first iteration of a Docker-based config for setting up a local WordPress development environment.

Props pento, noisysocks, mcsf, pbearne, isabel_brison.
See #47767.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/.travis.yml

    r45607 r45745  
    1 sudo: false
    2 dist: trusty
    31language: php
     2services:
     3  - docker
     4  - mysql
     5
     6addons:
     7  apt:
     8    packages:
     9      - docker-ce
     10
    411cache:
    512  apt: true
     
    815    - vendor
    916    - $HOME/.composer/cache
     17
    1018env:
    1119  global:
    12     - WP_TRAVISCI=travis:phpunit
     20    - LOCAL_DIR=build
     21
    1322matrix:
    1423  include:
    15   - php: 7.2
    16     env: WP_TRAVISCI=e2e
    17   - php: 7.2
    18     env: WP_TRAVISCI=travis:phpcs
    19   - php: 7.1
    20     env: WP_TRAVISCI=travis:js
     24  - env: WP_TRAVISCI=test:e2e
     25  - env: WP_TRAVISCI=travis:phpcs
     26  - env: WP_TRAVISCI=travis:js
     27  - env: LOCAL_PHP=7.3-fpm WP_TRAVISCI=test:php
     28  - php: 7.3
     29    dist: trusty
     30    env: WP_TRAVIS_OBJECT_CACHE=true WP_TRAVISCI=travis:phpunit
     31    services: memcached
     32  - env: LOCAL_PHP=7.2-fpm WP_TRAVISCI=test:php
     33  - env: LOCAL_PHP=7.1-fpm WP_TRAVISCI=test:php
     34  - env: LOCAL_PHP=7.0-fpm WP_TEST_REPORTER=true WP_TRAVISCI=test:php
     35  - env: LOCAL_PHP=5.6-fpm WP_TRAVISCI=test:php
    2136  - php: 7.4snapshot
    22   - php: 7.3
    23   - php: 7.3
    24     env: WP_TRAVIS_OBJECT_CACHE=true
    25     services: memcached
    26   - php: 7.2
    27   - php: 7.1
    28   - php: 7.0
    29     env: WP_TEST_REPORTER=true
    30   - php: 5.6
     37    dist: trusty
     38    env: WP_TRAVISCI=travis:phpunit
    3139  - php: nightly
     40    dist: trusty
     41    env: WP_TRAVISCI=travis:phpunit
    3242  allow_failures:
    3343  - php: 7.4snapshot
    3444  - php: nightly
    3545  fast_finish: true
     46
    3647before_install:
    3748- |
     
    4556  fi
    4657- |
     58  if [[ "$WP_TRAVISCI" == "test:php" ]]; then
     59      cp wp-tests-config-sample.php wp-tests-config.php
     60      sed -i "s/youremptytestdbnamehere/wordpress_develop_tests/" wp-tests-config.php
     61      sed -i "s/yourusernamehere/root/" wp-tests-config.php
     62      sed -i "s/yourpasswordhere/password/" wp-tests-config.php
     63      sed -i "s/localhost/mysql/" wp-tests-config.php
     64      travis_retry svn checkout https://plugins.svn.wordpress.org/wordpress-importer/tags/0.6.3/ tests/phpunit/data/plugins/wordpress-importer
     65  fi
     66- |
     67  sudo rm /usr/local/bin/docker-compose
     68  curl -L https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` > docker-compose
     69  chmod +x docker-compose
     70  sudo mv docker-compose /usr/local/bin
     71- |
    4772  if [[ "$WP_TRAVIS_OBJECT_CACHE" == "true" ]]; then
    4873    cp tests/phpunit/includes/object-cache.php src/wp-content/object-cache.php
    4974    echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
    5075  fi
     76
    5177before_script:
    5278- |
     
    5884  fi
    5985- |
    60   # Export Composer's global bin dir to PATH, but not on PHP 5.2:
     86  # Export Composer's global bin dir to PATH:
    6187  composer config --list --global
    6288  export PATH=`composer config --list --global | grep '\[home\]' | { read a; echo "${a#* }/vendor/bin:$PATH"; }`
    6389- |
    64   # Install the specified version of PHPUnit depending on the PHP version:
     90  # Install PHPUnit for the tests that don't run in Docker.
    6591  if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
    66     case "$TRAVIS_PHP_VERSION" in
    67       7.4snapshot|7.3|7.2|7.1|nightly)
    68         echo "Using PHPUnit 7.x"
    69         travis_retry composer global require "phpunit/phpunit:^7"
    70         ;;
    71       7.0)
    72         echo "Using PHPUnit 6.x"
    73         travis_retry composer global require "phpunit/phpunit:^6"
    74         ;;
    75       5.6)
    76         echo "Using PHPUnit 4.x"
    77         travis_retry composer global require "phpunit/phpunit:^4"
    78         ;;
    79       *)
    80         echo "No PHPUnit version handling for PHP version $TRAVIS_PHP_VERSION"
    81         exit 1
    82         ;;
    83     esac
     92    echo "Using PHPUnit 7.x"
     93    travis_retry composer global require "phpunit/phpunit:^7"
    8494  fi
    8595- |
     
    94104- npm install
    95105- npm prune
     106- |
     107  if [[ "$WP_TRAVISCI" == "test:e2e" ]] || [[ "$WP_TRAVISCI" == "test:php" ]]; then
     108    npm run env:start
     109    npm run build
     110  fi
     111- |
     112  if [[ "$WP_TRAVISCI" == "test:e2e" ]]; then
     113    npm run env:install
     114  fi
    96115- mysql --version
    97116- phpenv versions
     
    106125- svn --version
    107126- locale -a
     127
    108128script:
    109 - |
    110   if [[ "$WP_TRAVISCI" == "e2e" ]]; then
    111     npm run env:start
    112     npm run env:reset-site
    113     npm run test:e2e
    114   else
    115     npm run grunt $WP_TRAVISCI
    116   fi
     129  - |
     130    if [[ "$WP_TRAVISCI" == "test:e2e" ]]; then
     131      npm run test:e2e
     132    elif [[ "$WP_TRAVISCI" == "test:php" ]]; then
     133      npm run test:php -- -- -- --verbose -c phpunit.xml.dist
     134      npm run test:php -- -- -- --verbose -c phpunit.xml.dist --group ajax
     135      npm run test:php -- -- -- --verbose -c tests/phpunit/multisite.xml
     136      npm run test:php -- -- -- --verbose -c tests/phpunit/multisite.xml --group ms-files
     137      npm run test:php -- -- -- --verbose -c phpunit.xml.dist --group external-http
     138      npm run test:php -- -- -- --verbose -c phpunit.xml.dist --group restapi-jsclient
     139    else
     140      npm run grunt $WP_TRAVISCI
     141    fi
     142
    117143after_script:
    118144- |
     
    123149    php test-runner/report.php
    124150  fi
     151
    125152notifications:
    126153  slack:
Note: See TracChangeset for help on using the changeset viewer.