Skip to content

Commit 13d3566

Browse files
committed
Build Tools: Miscellaneous local-env improvements.
- Move the functionality for controlling `local-env` out of `package.json`, into JS scripts. - Merge the `docker-compose` config files, and move it to the root directory. This allows `docker-compose.override.yml` to work for local overrides. - Fix nginx redirecting to port 80 under some circumstances. - `npm run env:install` now creates `wp-tests.config.php` for you. - Cleaned up a bunch of cruft in `.travis.yml`. See #47767. git-svn-id: https://develop.svn.wordpress.org/trunk@45783 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 83eb411 commit 13d3566

12 files changed

Lines changed: 166 additions & 679 deletions

File tree

.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ LOCAL_WP_DEBUG=true
2929
LOCAL_WP_DEBUG_LOG=true
3030
LOCAL_WP_DEBUG_DISPLAY=true
3131
LOCAL_SCRIPT_DEBUG=true
32+
33+
# The URL to use when running e2e tests.
34+
WP_BASE_URL=http://localhost:${LOCAL_PORT}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,6 @@ wp-tests-config.php
7373
*.diff
7474
.svn
7575
!/src/js/_enqueues/vendor
76+
77+
# Files for local environment config
78+
/docker-compose.override.yml

.travis.yml

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
language: php
1+
language: generic
2+
23
services:
34
- docker
4-
- mysql
55

66
addons:
77
apt:
@@ -51,12 +51,6 @@ matrix:
5151
before_install:
5252
- |
5353
if [[ "$WP_TRAVISCI" == "test:php" ]]; then
54-
cp wp-tests-config-sample.php wp-tests-config.php
55-
sed -i "s/youremptytestdbnamehere/wordpress_develop_tests/" wp-tests-config.php
56-
sed -i "s/yourusernamehere/root/" wp-tests-config.php
57-
sed -i "s/yourpasswordhere/password/" wp-tests-config.php
58-
sed -i "s/localhost/mysql/" wp-tests-config.php
59-
echo "define( 'FS_METHOD', 'direct' );" >> wp-tests-config.php
6054
travis_retry svn checkout https://plugins.svn.wordpress.org/wordpress-importer/tags/0.6.3/ tests/phpunit/data/plugins/wordpress-importer
6155
fi
6256
- |
@@ -73,16 +67,6 @@ before_script:
7367
else
7468
echo "xdebug.ini does not exist"
7569
fi
76-
- |
77-
# Export Composer's global bin dir to PATH:
78-
composer config --list --global
79-
export PATH=`composer config --list --global | grep '\[home\]' | { read a; echo "${a#* }/vendor/bin:$PATH"; }`
80-
- |
81-
# Install PHPUnit for the tests that don't run in Docker.
82-
if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
83-
echo "Using PHPUnit 7.x"
84-
travis_retry composer global require "phpunit/phpunit:^7"
85-
fi
8670
- |
8771
# We only need to run composer install on the PHP coding standards job.
8872
if [[ "$WP_TRAVISCI" == "travis:phpcs" ]]; then
@@ -98,18 +82,20 @@ before_script:
9882
if [[ "$WP_TRAVISCI" == "test:e2e" ]] || [[ "$WP_TRAVISCI" == "test:php" ]]; then
9983
npm run env:start
10084
npm run build
101-
docker-compose -f tools/local-env/docker-compose.yml run --rm mysql mysql --version
102-
docker-compose -f tools/local-env/docker-compose.yml run --rm php php --version
103-
docker-compose -f tools/local-env/docker-compose.yml run --rm php php -m
104-
docker-compose -f tools/local-env/docker-compose.yml -f tools/local-env/docker-compose.scripts.yml run --rm phpunit phpunit --version
85+
docker-compose run --rm mysql mysql --version
86+
docker-compose run --rm php php --version
87+
docker-compose run --rm php php -m
88+
docker-compose run --rm phpunit phpunit --version
10589
fi
10690
- |
10791
if [[ "$LOCAL_PHP_MEMCACHED" == "true" ]]; then
10892
cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php
109-
docker run --name memcached --net local-env_wpdevnet -d memcached
93+
# The memcached server needs to start after `npm run env:start`, which sets up the Docker network.
94+
docker run --name memcached --net wordpress-develop_wpdevnet -d memcached
11095
fi
11196
- |
112-
if [[ "$WP_TRAVISCI" == "test:e2e" ]]; then
97+
if [[ "$WP_TRAVISCI" == "test:e2e" ]] || [[ "$WP_TRAVISCI" == "test:php" ]]; then
98+
# Run the install process after memcached has started.
11399
npm run env:install
114100
fi
115101
- npm --version
@@ -124,12 +110,12 @@ script:
124110
if [[ "$WP_TRAVISCI" == "test:e2e" ]]; then
125111
npm run test:e2e
126112
elif [[ "$WP_TRAVISCI" == "test:php" ]]; then
127-
npm run test:php -- -- -- --verbose -c phpunit.xml.dist &&
128-
npm run test:php -- -- -- --verbose -c phpunit.xml.dist --group ajax &&
129-
npm run test:php -- -- -- --verbose -c tests/phpunit/multisite.xml &&
130-
npm run test:php -- -- -- --verbose -c tests/phpunit/multisite.xml --group ms-files &&
131-
npm run test:php -- -- -- --verbose -c phpunit.xml.dist --group external-http &&
132-
npm run test:php -- -- -- --verbose -c phpunit.xml.dist --group restapi-jsclient
113+
npm run test:php -- --verbose -c phpunit.xml.dist &&
114+
npm run test:php -- --verbose -c phpunit.xml.dist --group ajax &&
115+
npm run test:php -- --verbose -c tests/phpunit/multisite.xml &&
116+
npm run test:php -- --verbose -c tests/phpunit/multisite.xml --group ms-files &&
117+
npm run test:php -- --verbose -c phpunit.xml.dist --group external-http &&
118+
npm run test:php -- --verbose -c phpunit.xml.dist --group restapi-jsclient
133119
else
134120
npm run grunt $WP_TRAVISCI
135121
fi
@@ -138,9 +124,7 @@ after_script:
138124
- |
139125
if [[ "$WP_TEST_REPORTER" == "true" ]]; then
140126
git clone https://github.com/WordPress/phpunit-test-runner.git test-runner
141-
export WPT_PREPARE_DIR=$(pwd)
142-
export WPT_TEST_DIR=$(pwd)
143-
php test-runner/report.php
127+
docker-compose run --rm -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php
144128
fi
145129
146130
notifications:

0 commit comments

Comments
 (0)