forked from PHP-CS-Fixer/PHP-CS-Fixer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
143 lines (125 loc) · 6.73 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
language: php
sudo: false
git:
depth: 1
cache:
directories:
- $HOME/.composer
- $HOME/bin
env:
global:
- DEFAULT_COMPOSER_FLAGS="--no-interaction --no-progress"
- COMPOSER_FLAGS=""
before_install:
# turn off XDebug
- phpenv config-rm xdebug.ini || return 0
# Composer: boost installation
- composer global show hirak/prestissimo -q || travis_retry composer global require $DEFAULT_COMPOSER_FLAGS hirak/prestissimo
jobs:
include:
-
stage: Static Code Analysis
php: 7.2
env: COMPOSER_FLAGS="--no-dev --prefer-stable"
install:
- travis_retry composer update -d dev-tools $DEFAULT_COMPOSER_FLAGS
- composer info -d dev-tools -D | sort
- travis_retry composer update $DEFAULT_COMPOSER_FLAGS $COMPOSER_FLAGS
- composer info -D | sort
- wget --no-clobber --output-document=$HOME/bin/checkbashisms https://sourceforge.net/projects/checkbaskisms/files/2.0.0.2/checkbashisms/download || true
- chmod +x $HOME/bin/checkbashisms
before_script:
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then COMMIT_RANGE=$TRAVIS_COMMIT_RANGE; else COMMIT_RANGE="HEAD~..HEAD"; fi;
- export COMMIT_SCA_FILES=`git diff --name-only --diff-filter=ACMRTUXB $COMMIT_RANGE`
script:
# @TODO remove at 3.0
- |
git archive -o /dev/null HEAD -v 2>&1 | grep tests | grep \.php \
| grep -v tests/Test/AbstractFixerTestCase.php \
| grep -v tests/Test/AbstractIntegrationCaseFactory.php \
| grep -v tests/Test/AbstractIntegrationTestCase.php \
| grep -v tests/Test/Assert/AssertTokensTrait.php \
| grep -v tests/Test/Constraint/SameStringsConstraint.php \
| grep -v tests/Test/Constraint/SameStringsConstraintForV5.php \
| grep -v tests/Test/Constraint/SameStringsConstraintForV7.php \
| grep -v tests/Test/Constraint/XmlMatchesXsdConstraint.php \
| grep -v tests/Test/Constraint/XmlMatchesXsdConstraintForV5.php \
| grep -v tests/Test/Constraint/XmlMatchesXsdConstraintForV7.php \
| grep -v tests/Test/IntegrationCase.php \
| grep -v tests/Test/IntegrationCaseFactory.php \
| grep -v tests/Test/IntegrationCaseFactoryInterface.php \
| grep -v tests/Test/InternalIntegrationCaseFactory.php \
| grep -v tests/TestCase.php \
&& (echo "UNKNOWN FILES DETECTED" && travis_terminate 1) || echo "NO UNKNOWN FILES"
- ./check_trailing_spaces.sh || travis_terminate 1
- if [ -n "$COMMIT_SCA_FILES" ]; then ./dev-tools/vendor/bin/phpmd `echo "$COMMIT_SCA_FILES" | grep -Ev "^tests/Fixtures" | xargs | sed 's/ /,/g'` text phpmd.xml || travis_terminate 1; fi
- ./dev-tools/vendor/bin/composer-require-checker check composer.json --config-file=.composer-require-checker.json || travis_terminate 1
- composer normalize -d ./dev-tools ./../composer.json --dry-run
- ./dev-tools/check-shell-scripts.sh
- &STANDARD_TEST_JOB
stage: Fast Test
php: 7.0
install:
# Composer: enforce given Symfony components version
- if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update symfony/force-lowest:$SYMFONY_VERSION; fi
- if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update symfony/lts:$(echo $SYMFONY_VERSION | grep -o 'v[0-9]\+') || true; fi
- travis_retry composer update $DEFAULT_COMPOSER_FLAGS $COMPOSER_FLAGS
- composer info -D | sort
script:
- vendor/bin/phpunit || travis_terminate 1
- PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer --diff --dry-run -v fix
-
<<: *STANDARD_TEST_JOB
stage: Test
php: 5.6
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
-
<<: *STANDARD_TEST_JOB
stage: Test
php: 7.1
env: SYMFONY_DEPRECATIONS_HELPER=weak PHP_CS_FIXER_TEST_USE_LEGACY_TOKENIZER=1 SYMFONY_VERSION="v4.0"
-
<<: *STANDARD_TEST_JOB
stage: Test
php: 7.2
env: COLLECT_COVERAGE=1
before_script:
# check phpdbg
- phpdbg --version 2> /dev/null || { echo 'No phpdbg'; export COLLECT_COVERAGE=0; }
# for building a tag release we don't need to collect code coverage
- if [ $TRAVIS_TAG ]; then export COLLECT_COVERAGE=0; fi
script:
- if [ $COLLECT_COVERAGE == 0 ]; then vendor/bin/phpunit || travis_terminate 1; fi
- if [ $COLLECT_COVERAGE == 1 ]; then vendor/bin/phpunit --group covers-nothing || travis_terminate 1; fi
- if [ $COLLECT_COVERAGE == 1 ]; then phpdbg -qrr vendor/bin/phpunit --exclude-group covers-nothing --coverage-clover build/logs/clover.xml || travis_terminate 1; fi
- PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer --diff --dry-run -v fix || travis_terminate 1
- if [ $COLLECT_COVERAGE == 1 ]; then php vendor/bin/php-coveralls -v; fi
-
<<: *STANDARD_TEST_JOB
stage: Test
php: nightly
env: COMPOSER_FLAGS="--ignore-platform-reqs" PHP_CS_FIXER_IGNORE_ENV=1 SYMFONY_DEPRECATIONS_HELPER=weak
script:
- php php-cs-fixer fix --rules @PHP71Migration,@PHP71Migration:risky,native_function_invocation -q || travis_terminate 1
- vendor/bin/phpunit || travis_terminate 1
- git checkout . -q
- PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer --diff --dry-run -v fix
-
stage: Deployment
php: 7.1
install: ./dev-tools/build.sh
script:
- vendor/bin/phpunit tests/Smoke/PharTest.php
deploy:
provider: releases
api_key:
secure: K9NKi7X1OPz898fxtVc1RfWrSI+4hTFFYOik932wTz1jC4dQJ64Khh1LV9frA1+JiDS3+R6TvmQtpzbkX3y4L75UrSnP1ADH5wfMYIVmydG3ZjTMo8SWQWHmRMh3ORAKTMMpjl4Q7EkRkLp6RncKe+FAFPP5mgv55mtIMaE4qUk=
file: php-cs-fixer.phar
skip_cleanup: true
on:
repo: FriendsOfPHP/PHP-CS-Fixer
tags: true
after_deploy:
- ./dev-tools/trigger-website.sh ${TRAVIS_TOKEN} ${TRAVIS_TAG}
allow_failures:
- php: nightly