-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
88 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,132 +1,66 @@ | ||
# Travis CI (MIT License) configuration file for the WordPress Plugin Boilerplate | ||
# @link https://travis-ci.org/ | ||
sudo: false | ||
dist: trusty | ||
|
||
# For use with the WordPress Plugin Boilerplate | ||
# @link https://github.com/seb86/WordPress-Plugin-Boilerplate | ||
|
||
# Declare project language. | ||
# @link http://about.travis-ci.org/docs/user/languages/php/ | ||
language: php | ||
|
||
# Declare versions of PHP to use. Use one decimal max. | ||
php: | ||
# aliased to a recent 7.0.x version | ||
- "7.0" | ||
# aliased to a recent 5.6.x version | ||
- "5.6" | ||
# aliased to a recent 5.5.x version | ||
- "5.5" | ||
# aliased to a recent 5.4.x version | ||
- "5.4" | ||
# aliased to a recent 5.3.x version | ||
- "5.3" | ||
notifications: | ||
email: | ||
on_success: never | ||
on_failure: change | ||
|
||
branches: | ||
only: | ||
- master | ||
|
||
# Declare which versions of WordPress to test against. | ||
# Also declare whether or not to test in Multisite. | ||
env: | ||
# Trunk | ||
# @link https://github.com/WordPress/WordPress | ||
- WP_VERSION=master WP_MULTISITE=0 | ||
- WP_VERSION=master WP_MULTISITE=1 | ||
# WordPress 4.8 | ||
# @link https://github.com/WordPress/WordPress/tree/3.9-branch | ||
- WP_VERSION=4.8 WP_MULTISITE=0 | ||
- WP_VERSION=4.8 WP_MULTISITE=1 | ||
# WordPress 4.7 | ||
# @link https://github.com/WordPress/WordPress/tree/3.8-branch | ||
- WP_VERSION=4.7 WP_MULTISITE=0 | ||
- WP_VERSION=4.7 WP_MULTISITE=1 | ||
cache: | ||
directories: | ||
- vendor | ||
- $HOME/.composer/cache | ||
|
||
# Declare 5.6 beta in test matrix. | ||
# @link http://docs.travis-ci.com/user/build-configuration/ | ||
matrix: | ||
include: | ||
- php: 5.6 | ||
env: WP_VERSION=master | ||
allow_failures: | ||
- php: 5.6 | ||
fast_finish: true | ||
|
||
# Use this to prepare the system to install prerequisites or dependencies. | ||
# e.g. sudo apt-get update. | ||
# Failures in this section will result in build status 'errored'. | ||
# before_install: | ||
include: | ||
- php: 7.1 | ||
env: WP_VERSION=latest | ||
- php: 7.0 | ||
env: WP_VERSION=latest | ||
- php: 5.6 | ||
env: WP_VERSION=4.4 | ||
- php: 5.6 | ||
env: WP_VERSION=latest | ||
- php: 5.6 | ||
env: WP_VERSION=trunk | ||
- php: 5.6 | ||
env: WP_TRAVISCI=phpcs | ||
- php: 5.3 | ||
env: WP_VERSION=latest | ||
dist: precise | ||
|
||
# Use this to prepare your build for testing. | ||
# e.g. copy database configurations, environment variables, etc. | ||
# Failures in this section will result in build status 'errored'. | ||
# Use this to prepare your build for testing. | ||
# e.g. copy database configurations, environment variables, etc. | ||
# Failures in this section will result in build status 'errored'. | ||
before_script: | ||
# Set up WordPress installation. | ||
- export WP_DEVELOP_DIR=/tmp/wordpress/ | ||
- mkdir -p $WP_DEVELOP_DIR | ||
# Use the Git mirror of WordPress. | ||
- git clone --depth=1 --branch="$WP_VERSION" git://develop.git.wordpress.org/ $WP_DEVELOP_DIR | ||
# Set up Twenty Seventeen theme information. | ||
- theme_slug=$(basename $(pwd)) | ||
- theme_dir=$WP_DEVELOP_DIR/src/wp-content/themes/$theme_slug | ||
- cd .. | ||
- mv $theme_slug $theme_dir | ||
# Set up WordPress configuration. | ||
- cd $WP_DEVELOP_DIR | ||
- echo $WP_DEVELOP_DIR | ||
- cp wp-tests-config-sample.php wp-tests-config.php | ||
- sed -i "s/youremptytestdbnamehere/wordpress_test/" wp-tests-config.php | ||
- sed -i "s/yourusernamehere/root/" wp-tests-config.php | ||
- sed -i "s/yourpasswordhere//" wp-tests-config.php | ||
# Create WordPress database. | ||
- mysql -e 'CREATE DATABASE wordpress_test;' -uroot | ||
# Install CodeSniffer for WordPress Coding Standards checks. | ||
- mkdir php-codesniffer && curl -L https://github.com/squizlabs/PHP_CodeSniffer/archive/master.tar.gz | tar xz --strip-components=1 -C php-codesniffer | ||
# Install WordPress Coding Standards. | ||
- mkdir wordpress-coding-standards && curl -L https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/archive/master.tar.gz | tar xz --strip-components=1 -C wordpress-coding-standards | ||
# Hop into CodeSniffer directory. | ||
- cd php-codesniffer | ||
# Set install path for WordPress Coding Standards | ||
# @link https://github.com/squizlabs/PHP_CodeSniffer/blob/4237c2fc98cc838730b76ee9cee316f99286a2a7/CodeSniffer.php#L1941 | ||
- scripts/phpcs --config-set installed_paths ../wordpress-coding-standards | ||
# Hop into themes directory. | ||
- cd $theme_dir | ||
# After CodeSniffer install you should refresh your path. | ||
- phpenv rehash | ||
# Install JSCS: JavaScript Code Style checker | ||
# @link http://jscs.info/ | ||
- npm install -g jscs | ||
# Install JSHint, a JavaScript Code Quality Tool | ||
# @link http://jshint.com/docs/ | ||
- npm install -g jshint | ||
- wget https://develop.svn.wordpress.org/trunk/.jshintrc | ||
- export PATH="$HOME/.composer/vendor/bin:$PATH" | ||
- | | ||
if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then | ||
phpenv config-rm xdebug.ini | ||
else | ||
echo "xdebug.ini does not exist" | ||
fi | ||
- | | ||
if [[ ! -z "$WP_VERSION" ]] ; then | ||
bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION | ||
composer global require "phpunit/phpunit=4.8.*|5.7.*" | ||
fi | ||
- | | ||
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then | ||
composer global require wp-coding-standards/wpcs | ||
phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs | ||
fi | ||
script: | ||
phpunit | ||
- bin/atoum --test-all | ||
- jshing . | ||
- jscs . | ||
- $WP_DEVELOP_DIR/php-codesniffer/scripts/phpcs -p -s -v -n . --standard=./codesniffer.ruleset.xml --extensions=php | ||
|
||
# Run test script commands. | ||
# Default is specific to project language. | ||
# All commands must exit with code 0 on success. Anything else is considered failure. | ||
#script: | ||
# Search for PHP syntax errors. | ||
##- find . \( -name '*.php' \) -exec php -lf {} \; | ||
# WordPress Coding Standards | ||
# @link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards | ||
# @link http://pear.php.net/package/PHP_CodeSniffer/ | ||
# -p flag: Show progress of the run. | ||
# -s flag: Show sniff codes in all reports. | ||
# -v flag: Print verbose output. | ||
# -n flag: Do not print warnings (shortcut for --warning-severity=0) | ||
# --standard: Use WordPress as the standard. | ||
# --extensions: Only sniff PHP files. | ||
##- $WP_DEVELOP_DIR/php-codesniffer/scripts/phpcs -p -s -v -n . --standard=./codesniffer.ruleset.xml --extensions=php | ||
|
||
after_script: | ||
- php vendor/bin/coveralls --config tests/.coveralls.yml -v --exclude-no-stmt | ||
|
||
# Receive notifications for build results. | ||
# @link http://docs.travis-ci.com/user/notifications/#Email-notifications | ||
notifications: | ||
email: true | ||
script: | ||
- | | ||
if [[ ! -z "$WP_VERSION" ]] ; then | ||
phpunit | ||
WP_MULTISITE=1 phpunit | ||
fi | ||
- | | ||
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then | ||
phpcs | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="WordPress Coding Standards for Plugins"> | ||
<description>Generally-applicable sniffs for WordPress plugins</description> | ||
|
||
<rule ref="WordPress-Core" /> | ||
<rule ref="WordPress-Docs" /> | ||
|
||
<!-- Check all PHP files in directory tree by default. --> | ||
<arg name="extensions" value="php"/> | ||
<file>.</file> | ||
|
||
<!-- Show progress and sniff codes in all reports --> | ||
<arg value="ps"/> | ||
|
||
<exclude-pattern>*/node_modules/*</exclude-pattern> | ||
<exclude-pattern>*/vendor/*</exclude-pattern> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<phpunit | ||
bootstrap="tests/bootstrap.php" | ||
backupGlobals="false" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
> | ||
<testsuites> | ||
<testsuite> | ||
<directory prefix="test-" suffix=".php">./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |