Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Travis CI (MIT License) configuration file
# @link https://travis-ci.org/

# Use new container based environment
sudo: false

# 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 high PHP version
- 5.6
# Might as well test HHVM too
- hhvm
# Lowest currently possible in travis
- 5.2
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't Travis only support 5.3 min now?

What about 5.3, 5.4, 5.5? Occasionally something breaks there, and currently we would only know that it passed the low PHP level, but failed at 5.6.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure they reverted the removal of PHP 5.2 (under pressure of the WP community).

As we're currently only doing a lint and phpcs, running it on more versions would be wasting resources as the results won't change. If it breaks on either of those two versions, we need to look at the code, everything in between is caught by this.

Once we have unit tests, we should start running it on more versions, though still only lint and phpcs on highest and lowest.


before_script:
# Install CodeSniffer for WordPress Coding Standards checks.
- git clone https://github.com/squizlabs/PHP_CodeSniffer.git phpcs
# Install WordPress Coding Standards.
- git clone -b master https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git wpcs
# Hop into CodeSniffer directory.
- cd phpcs
# 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 ../wpcs
# Hop into project dir.
- cd $TRAVIS_BUILD_DIR
# After CodeSniffer install you should refresh your path.
- phpenv rehash

# Run test script commands.
# All commands must exit with code 0 on success. Anything else is considered failure.
script:
# Search for PHP syntax errors. Ignore the phpcs and wpcs directories.
- find -L . -path "./*pcs" -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l;
# 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.
- $TRAVIS_BUILD_DIR/phpcs/scripts/phpcs -p -s -v -n . --standard=./ruleset.xml --extensions=php
Loading