-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
85 lines (75 loc) · 3.72 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Travis CI (MIT License) configuration file for the Underscores WordPress theme.
# @link https://travis-ci.org/
# For use with the MIT Libraries' WordPress themes.
# @link https://github.com/search?q=topic%3Awordpress-theme+org%3AMITLibraries
# Declare what Travis environment should be used. Specifically, we need the
# 'precise' environment rather than 'trusty' to get PHP 5.3.
dist: precise
# Declare project language.
# @link http://about.travis-ci.org/docs/user/languages/php/
language: php
# Declare "future" releases to be acceptable failures.
# @link https://buddypress.trac.wordpress.org/ticket/5620
# @link http://docs.travis-ci.com/user/build-configuration/
matrix:
fast_finish: true
include:
# Declare versions of PHP to use. Use one decimal max.
# We sniff the current and +1 release of PHP, and just run syntax checking
# for others.
- php: 'nightly'
- php: '7.3'
- php: '7.2'
env: PHPCS_BRANCH=master PHPCS_SCRIPT=bin SNIFF=1
- php: '7.1'
env: PHPCS_BRANCH=master PHPCS_SCRIPT=bin SNIFF=1
allow_failures:
- php: "nightly"
- php: "7.3"
- php: "7.2"
# 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:
# 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:
# Define PHP_CodeSniffer install
- export PHPCS_DIR=/tmp/phpcs
# Define WordPress Coding Standards
- export WPCS_DIR=/tmp/wpcs
- export WPCS_BRANCH=master
# Install WordPress Coding Standards (master branch, not develop).
- if [[ "$SNIFF" == "1" ]]; then git clone -b $WPCS_BRANCH https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git $WPCS_DIR; fi
# Install CodeSniffer for WordPress Coding Standards checks (pre 3.x version).
- if [[ "$SNIFF" == "1" ]]; then git clone -b $PHPCS_BRANCH https://github.com/squizlabs/PHP_CodeSniffer.git $PHPCS_DIR; fi
- if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/$PHPCS_SCRIPT/phpcs --version; fi
# Set install path for WordPress Coding Standards.
# @link https://github.com/squizlabs/PHP_CodeSniffer/blob/4237c2fc98cc838730b76ee9cee316f99286a2a7/CodeSniffer.php#L1941
- if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/$PHPCS_SCRIPT/phpcs --config-set installed_paths $WPCS_DIR; fi
# After CodeSniffer install you should refresh your path.
- phpenv rehash
# 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 outside the libs directory
# @link http://stackoverflow.com/questions/4210042/exclude-directory-from-find-command
- find . -path ./libs -prune -o \( -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.
# --report=source: Return summary table
# --report=full: Returns verbose list of problems by test and line
- if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/$PHPCS_SCRIPT/phpcs -p -s -v -n . --standard=./codesniffer.mitlib.xml --extensions=php --report=source --report=full; fi
# Receive notifications for build results.
# @link http://docs.travis-ci.com/user/notifications/#Email-notifications
notifications:
email: false