-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use local tooling to run PHPUnit tests instead of wp-dev-lib #1124
Changes from all commits
93171e6
576f807
6f59bdf
b966f74
da94955
3002b98
4f3072d
a773fef
9479513
1a8614f
275a83f
c7b8cfc
d0c1ed9
16cf3e0
19c87c4
0fcf906
5d65bf8
b42cbbc
cf3d3f1
ac4f172
5d0686f
aaa4054
023b673
942dc4e
e44f942
dc5483c
18da2c6
5e86ca8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,52 +2,50 @@ dist: xenial | |
|
||
language: php | ||
|
||
php: | ||
- "5.6" | ||
- "7.0" | ||
- "7.2" | ||
- "7.3" | ||
|
||
addons: | ||
apt: | ||
packages: | ||
# For xmllint. | ||
- libxml2-utils | ||
env: | ||
- WP_VERSION=latest WP_MULTISITE=0 | ||
- WP_VERSION=latest WP_MULTISITE=1 | ||
- WP_VERSION=trunk WP_MULTISITE=0 | ||
- WP_VERSION=trunk WP_MULTISITE=1 | ||
php: "7.4" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Travis jobs now handle the different types of runs we need. |
||
|
||
jobs: | ||
include: | ||
- name: Release Package | ||
php: "7.3" | ||
env: WP_VERSION=latest WP_MULTISITE=0 WP_RELEASE=1 | ||
|
||
- stage: test | ||
name: Test with PHP 5.6 | ||
before_script: docker-compose build --build-arg PHP_VERSION=5.6 --build-arg XDEBUG_VERSION=2.5.5 wordpress | ||
|
||
- name: Test with PHP 7.2 | ||
before_script: docker-compose build --build-arg PHP_VERSION=7.2 wordpress | ||
|
||
- name: Default Test | ||
before_script: docker-compose build | ||
|
||
- stage: deploy | ||
name: Release Package | ||
env: WP_RELEASE=1 | ||
|
||
services: | ||
- mysql | ||
- docker | ||
|
||
before_install: | ||
- docker load -i /tmp/docker_images/images.tar || true | ||
- nvm install | ||
- nvm use | ||
|
||
install: | ||
- npm install | ||
- export DEV_LIB_PATH="vendor/xwp/wp-dev-lib/scripts" | ||
- export DEV_LIB_ONLY="phpunit" | ||
- source "$DEV_LIB_PATH/travis.install.sh" | ||
|
||
script: | ||
- npm run lint | ||
- source "$DEV_LIB_PATH/travis.script.sh" | ||
- npm run phpunit | ||
- npm run phpunit-multisite | ||
|
||
after_script: | ||
- test -f ./tests/reports/clover.xml && composer test-report || true | ||
|
||
before_deploy: | ||
- npm run release | ||
|
||
before_cache: | ||
- docker save -o /tmp/docker_images/images.tar $(docker images -a -q) | ||
|
||
deploy: | ||
provider: releases | ||
api_key: | ||
|
@@ -69,3 +67,4 @@ cache: | |
npm: true | ||
directories: | ||
- $HOME/.composer/cache | ||
- /tmp/docker_images |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,16 +6,8 @@ load File.join( | |
Vagrant.configure(2) do |config| | ||
config.vm.hostname = "stream" | ||
|
||
# Wait 10 seconds before the docker containers are up. | ||
config.vm.provision "shell", | ||
inline: "sleep 10", | ||
run: "always" | ||
|
||
# Setup the WP sites. | ||
config.vm.provision "shell", | ||
path: "local/vagrant/setup-wp.sh", | ||
run: "always", | ||
env: { | ||
"DOCKER_COMPOSE_FILE" => "/vagrant/docker-compose.yml" | ||
} | ||
inline: "docker-compose -f /vagrant/docker-compose.yml exec -T --user 1000 wordpress xwp_wait mysql:3306 -t 60 -- wp core multisite-install --url=stream.local", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replaced the bash script with an inline command that does the same thing. |
||
run: "always" | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,34 +4,29 @@ | |
"homepage": "https://wordpress.org/plugins/stream/", | ||
"type": "wordpress-plugin", | ||
"license": "GPL-2.0-or-later", | ||
"repositories": [ | ||
{ | ||
"type": "git", | ||
"url": "https://github.com/WordPress/wordpress-develop.git" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We use https://github.com/johnpbloch/wordpress now which doesn't require any build steps and is much faster to install, and can be used in combination of |
||
} | ||
], | ||
"require": { | ||
"composer/installers": "~1.0" | ||
}, | ||
"require-dev": { | ||
"johnpbloch/wordpress": "^5.4", | ||
"php-coveralls/php-coveralls": "^2.1", | ||
"phpunit/phpunit": "^5.7", | ||
"wordpress/wordpress": "^5.2", | ||
"wp-cli/wp-cli-bundle": "^2.2", | ||
"wp-coding-standards/wpcs": "^2.2", | ||
"wpsh/local": "^0.2.3", | ||
"xwp/wp-dev-lib": "^1.5" | ||
"wp-phpunit/wp-phpunit": "^5.4", | ||
"wpsh/local": "^0.2.3" | ||
}, | ||
"config": { | ||
"process-timeout": 600, | ||
"sort-packages": true, | ||
"platform": { | ||
"php": "5.6" | ||
"php": "5.6.20" | ||
} | ||
}, | ||
"extra": { | ||
"wordpress-install-dir": "local/public" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previously we were using the WP core files provisioned by the |
||
}, | ||
"scripts": { | ||
"pre-install-cmd": [ | ||
"Composer\\Config::disableProcessTimeout" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replaced with a 600 second timeout for all commands as a sane default. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kasparsd I don't know the original purpose of this timeout. |
||
], | ||
"release": [ | ||
"composer install --no-dev --prefer-dist --optimize-autoloader" | ||
], | ||
|
@@ -43,7 +38,12 @@ | |
"@lint-php" | ||
], | ||
"test": [ | ||
"phpunit --coverage-text" | ||
"phpunit --coverage-text", | ||
"php local/scripts/make-clover-relative.php ./tests/reports/clover.xml" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This converts all file paths inside the coverage reports to be relative to the project root instead of absolute paths inside the Docker container which was causing issues to Coveralls reporting. |
||
], | ||
"test-multisite": [ | ||
"WP_MULTISITE=1 phpunit --coverage-text", | ||
"php local/scripts/make-clover-relative.php ./tests/reports/clover.xml" | ||
], | ||
"test-report": [ | ||
"php-coveralls --verbose" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now have
npm run phpunit-multisite
for this.