Skip to content

Commit

Permalink
Merge pull request #1124 from xwp/devops/ci-update
Browse files Browse the repository at this point in the history
Use local tooling to run PHPUnit tests instead of wp-dev-lib
  • Loading branch information
kasparsd committed Jul 6, 2020
2 parents a3e3af3 + 5e86ca8 commit cb8e5c4
Show file tree
Hide file tree
Showing 18 changed files with 839 additions and 423 deletions.
47 changes: 23 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

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:
Expand All @@ -69,3 +67,4 @@ cache:
npm: true
directories:
- $HOME/.composer/cache
- /tmp/docker_images
12 changes: 2 additions & 10 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -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",
run: "always"
end
28 changes: 14 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
],
"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"
},
"scripts": {
"pre-install-cmd": [
"Composer\\Config::disableProcessTimeout"
],
"release": [
"composer install --no-dev --prefer-dist --optimize-autoloader"
],
Expand All @@ -43,7 +38,12 @@
"@lint-php"
],
"test": [
"phpunit --coverage-text"
"phpunit --coverage-text",
"php local/scripts/make-clover-relative.php ./tests/reports/clover.xml"
],
"test-multisite": [
"WP_MULTISITE=1 phpunit --coverage-text",
"php local/scripts/make-clover-relative.php ./tests/reports/clover.xml"
],
"test-report": [
"php-coveralls --verbose"
Expand Down

0 comments on commit cb8e5c4

Please sign in to comment.