Build Tools: Run `composer` commands in a Docker container on Travis.

This tidies up the `.travis.yml` file a little more.

See #47767.



git-svn-id: https://develop.svn.wordpress.org/trunk@45799 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast 2019-08-14 23:11:39 +00:00
parent a2a28e4608
commit da411cd17a
1 changed files with 17 additions and 17 deletions

View File

@ -13,19 +13,21 @@ cache:
directories: directories:
- $HOME/.npm - $HOME/.npm
- vendor - vendor
- $HOME/.composer/cache
env: env:
global: global:
- LOCAL_DIR: build - LOCAL_DIR: build
- COMPOSER_INSTALL: false
- NPM_INSTALL: true
- WP_INSTALL: true
matrix: matrix:
include: include:
- env: WP_TRAVISCI=test:e2e - env: WP_TRAVISCI=test:e2e
name: E2E Tests name: E2E Tests
- env: WP_TRAVISCI=travis:phpcs - env: WP_TRAVISCI=lint:php COMPOSER_INSTALL=true NPM_INSTALL=false WP_INSTALL=false
name: PHP Linting name: PHP Linting
- env: WP_TRAVISCI=travis:js - env: WP_TRAVISCI=travis:js WP_INSTALL=false
name: JS Tests name: JS Tests
- env: LOCAL_PHP=7.3-fpm WP_TRAVISCI=test:php - env: LOCAL_PHP=7.3-fpm WP_TRAVISCI=test:php
name: "PHPUnit Tests: PHP 7.3" name: "PHPUnit Tests: PHP 7.3"
@ -61,23 +63,17 @@ before_install:
before_script: before_script:
- | - |
# Remove Xdebug for a huge performance increase: if [[ "$COMPOSER_INSTALL" == "true" ]]; then
if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then docker-compose run --rm php composer --version
phpenv config-rm xdebug.ini docker-compose run --rm php composer install
else
echo "xdebug.ini does not exist"
fi
- |
# We only need to run composer install on the PHP coding standards job.
if [[ "$WP_TRAVISCI" == "travis:phpcs" ]]; then
composer --version
travis_retry composer install
fi fi
- npm --version - npm --version
- node --version - node --version
- nvm install 10.13.0 - nvm install 10.13.0
- npm install - |
- npm prune if [[ "$NPM_INSTALL" == "true" ]]; then
npm ci
fi
- | - |
if [[ "$WP_TRAVISCI" == "test:e2e" ]] || [[ "$WP_TRAVISCI" == "test:php" ]]; then if [[ "$WP_TRAVISCI" == "test:e2e" ]] || [[ "$WP_TRAVISCI" == "test:php" ]]; then
npm run env:start npm run env:start
@ -94,7 +90,7 @@ before_script:
docker run --name memcached --net wordpress-develop_wpdevnet -d memcached docker run --name memcached --net wordpress-develop_wpdevnet -d memcached
fi fi
- | - |
if [[ "$WP_TRAVISCI" == "test:e2e" ]] || [[ "$WP_TRAVISCI" == "test:php" ]]; then if [[ "$WP_INSTALL" == "true" ]]; then
# Run the install process after memcached has started. # Run the install process after memcached has started.
npm run env:install npm run env:install
fi fi
@ -116,6 +112,10 @@ script:
npm run test:php -- --verbose -c tests/phpunit/multisite.xml --group ms-files && npm run test:php -- --verbose -c tests/phpunit/multisite.xml --group ms-files &&
npm run test:php -- --verbose -c phpunit.xml.dist --group external-http && npm run test:php -- --verbose -c phpunit.xml.dist --group external-http &&
npm run test:php -- --verbose -c phpunit.xml.dist --group restapi-jsclient npm run test:php -- --verbose -c phpunit.xml.dist --group restapi-jsclient
elif [[ "$WP_TRAVISCI" == "lint:php" ]]; then
docker-compose run --rm php composer format &&
docker-compose run --rm php composer lint:errors &&
docker-compose run --rm php composer lint tests
else else
npm run grunt $WP_TRAVISCI npm run grunt $WP_TRAVISCI
fi fi