Skip to content

Commit 5dcb274

Browse files
committed
Travis: Switch to build stages
1 parent 17885bf commit 5dcb274

File tree

1 file changed

+50
-33
lines changed

1 file changed

+50
-33
lines changed

Diff for: .travis.yml

+50-33
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
cache:
2-
apt: true
1+
# Run in Container-based environment - see https://docs.travis-ci.com/user/reference/overview/#Virtualization-environments
2+
dist: trusty
3+
sudo: false
34

45
language: php
56

@@ -13,43 +14,59 @@ php:
1314
- 7.2
1415
- nightly
1516

16-
matrix:
17-
fast_finish: true
17+
before_install:
18+
# Turn off Xdebug
19+
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available"
20+
21+
install: composer install --no-interaction
22+
23+
stages:
24+
- lint and code standards
25+
- test
26+
27+
jobs:
1828
include:
19-
# Run PHP CodeSniffer and XMLLint against just PHP 7.1 job, even
20-
# though the PHPCompatibility config checks against 7.0.
21-
- php: 7.1
22-
env: SNIFF=1 LINT=1
29+
- stage: lint and code standards
30+
# Run PHP CodeSniffer and XMLLint against just PHP 7.1 job, even
31+
# though the PHPCompatibility config checks against 7.0.
32+
php: 7.1
2333
addons:
2434
apt:
2535
packages:
26-
- libxml2-utils
27-
28-
allow_failures:
29-
# Allow failures for unstable builds
30-
- php: nightly
31-
32-
before_install:
33-
- export XMLLINT_INDENT=" "
34-
35-
install:
36-
- composer install
36+
- libxml2-utils # Needed for XML linting.
37+
before_script:
38+
- export XMLLINT_INDENT=" "
39+
script:
40+
# Validate the XML files.
41+
# @link http://xmlsoft.org/xmllint.html
42+
- xmllint --noout ./.phpcs.xml.dist
43+
- xmllint --noout --schema ./vendor/phpunit/phpunit/phpunit.xsd ./phpunit.xml.dist
3744

38-
script:
39-
# Lint the PHP files against parse errors.
40-
- if [[ "$LINT" == "1" ]]; then if find . -name "*.php" -maxdepth 1 -exec php -l {} \; | grep "^[Parse error|Fatal error]"; then exit 1; fi; fi
41-
- if [[ "$LINT" == "1" ]]; then if find config src tests views -name "*.php" -exec php -l {} \; | grep "^[Parse error|Fatal error]"; then exit 1; fi; fi
45+
# Lint the PHP files against parse errors.
46+
- if find . -path ./vendor -prune -o -name "*.php" -exec php -l {} \; | grep "^[Parse error|Fatal error]"; then exit 1; fi
4247

43-
# Validate the xml file.
44-
# @link http://xmlsoft.org/xmllint.html
45-
- if [[ "$LINT" == "1" ]]; then xmllint --noout ./.phpcs.xml.dist; fi
48+
# Check code standards
49+
- composer phpcs
4650

47-
# Check coding standards. Run through composer script, to allow
48-
# PHP 5.2 compatibility check of main plugin file.
49-
- if [[ "$SNIFF" == "1" ]]; then composer phpcs; fi
51+
- stage: test
52+
# env: WP_VERSION=latest WP_MULTISITE=1
53+
# install:
54+
# - composer install --no-interaction
55+
# - bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
56+
before_script:
57+
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,}
58+
- if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for coverage"; exit 1; fi
59+
script:
60+
- vendor/bin/phpunit --testsuite unit
61+
- vendor/bin/infection
62+
# - vendor/bin/phpunit --testsuite integration
5063

51-
# Run tests.
52-
- ./vendor/bin/phpunit --testsuite unit
64+
fast_finish: true
65+
allow_failures:
66+
# Allow failures for unstable builds.
67+
- php: nightly
5368

54-
# Run mutation tests.
55-
- ./vendor/bin/infection
69+
cache:
70+
apt: true
71+
directories:
72+
- $HOME/.composer/cache

0 commit comments

Comments
 (0)