Skip to content

Commit

Permalink
Merge pull request #87 from disqus/troubleshoot-ci
Browse files Browse the repository at this point in the history
Fix Travis CI builds
  • Loading branch information
hlgott1593 authored Jan 8, 2021
2 parents a0c2a3e + 93e513e commit f3c9a87
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 59 deletions.
45 changes: 29 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,52 @@
sudo: required
os: linux

language: php

services: mysql

notifications:
email:
on_success: never
on_failure: change

# PHP v5.x isn't supported in the default build environment
dist: trusty

php:
- 5.4
- 7.0
- 7.1
- 7.3

env:
- WP_VERSION=latest WP_MULTISITE=0
- WP_VERSION=latest

matrix:
jobs:
include:
- php: 5.4
env: WP_VERSION=4.4 WP_MULTISITE=0
- php: 5.4
env: WP_VERSION=latest WP_MULTISITE=1
# Canary for our oldest-supported version
# PHP v5.6 is the oldest version Wordpress supports
- php: 5.6
env: WP_VERSION=4.4

# Enable dependency caching
cache:
apt: true
directories:
- vendor
- $HOME/.npm
- $HOME/.composer/cache

before_script:
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
- |
if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.0" ]]; then
composer global require "phpunit/phpunit=6.*"
elif [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then
composer global require "phpunit/phpunit=7.*"
if [[ ${TRAVIS_PHP_VERSION:0:3} == "5.6" ]]; then
composer require phpunit/phpunit "^4.8"
elif [[ ${TRAVIS_PHP_VERSION:0:3} == "7.0" ]]; then
composer require phpunit/phpunit "^6.5"
else
composer global require "phpunit/phpunit=4.8.*"
composer require phpunit/phpunit "^7.5"
fi
- |
- composer install
- composer install --no-interaction
- nvm install --lts
- nvm use --lts
- npm install -g yarn
Expand All @@ -42,13 +55,13 @@ before_script:

script:
- ./vendor/bin/phpcs -s --standard=phpcs.ruleset.xml
- phpunit
- bash bin/test.sh
- yarn run build
- npm test

deploy:
provider: script
skip_cleanup: true
cleanup: false
script: sh bin/deploy.sh
on:
branch: master
Expand Down
11 changes: 11 additions & 0 deletions bin/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
# Run PHPUnit with and without multisite enabled to prevent the need for
# multiple CI builds

# Run single-site unit tests
export WP_MULTISITE=0
./vendor/bin/phpunit --exclude-group=ms-required

# Run Multisite unit tests
export WP_MULTISITE=1
./vendor/bin/phpunit --exclude-group=ms-excluded
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
"type": "wordpress-plugin",
"require": {
"php": ">=5.4.0",
"composer/installers": "v1.2.0"
"composer/installers": "v1.9.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.0.2",
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
"wp-coding-standards/wpcs": "^0.14.0"
}
}
129 changes: 88 additions & 41 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f3c9a87

Please sign in to comment.