forked from PHPCSStandards/composer-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
140 lines (129 loc) · 5.2 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
---
language: php
cache:
directories:
- "${HOME}/.composer/cache"
- "${HOME}/.npm/"
env:
global:
- PATH="${HOME}/bin:${PATH}"
jobs:
include:
- php: 7.3
name: Linting
stage: lint
before_install:
- npm set loglevel error
- npm set progress false
install:
- npm install -g jsonlint
script:
- find . -type f -name "*.json" -print0 | xargs -0 -n1 jsonlint -q
- composer validate
- stage: test
php: 8.0
env: PHPCS_VERSION="dev-master" LINT=1
- php: 8.0
# Lowest PHPCS version on which PHP 8.0 is supported.
env: PHPCS_VERSION="3.5.7"
- php: 7.4
env: PHPCS_VERSION="dev-master" LINT=1
- php: 7.4
# Lowest PHPCS version on which PHP 7.4 is supported.
env: PHPCS_VERSION="3.5.0"
- php: 7.3
env: SECURITY=1 PHPCS_VERSION="3.5.3" LINT=1 PHPCS=1
- php: 7.3
# Lowest PHPCS version on which PHP 7.3 is supported.
env: PHPCS_VERSION="3.3.1"
- php: 7.2
env: PHPCS_VERSION="3.2.3" LINT=1
- php: 7.2
# Lowest PHPCS version on which PHP 7.2 is supported.
env: PHPCS_VERSION="2.9.2"
- php: 7.1
env: PHPCS_VERSION="3.1.1" LINT=1
- php: 7.1
env: PHPCS_VERSION="2.0.0"
- php: 7.0
env: PHPCS_VERSION="3.4.2" LINT=1
- php: 7.0
env: PHPCS_VERSION="2.2.0"
- php: 5.6
env: PHPCS_VERSION="3.0.2" LINT=1
- php: 5.6
env: PHPCS_VERSION="2.4.0"
- php: 5.5
# As the latest Debian does not support PHP 5.5 anymore, we need to force using 'trusty'.
dist: trusty
env: PHPCS_VERSION="dev-master" LINT=1
- php: 5.5
# As the latest Debian does not support PHP 5.5 anymore, we need to force using 'trusty'.
dist: trusty
env: PHPCS_VERSION="2.6.1"
- php: 5.4
# As the latest Debian does not support PHP 5.4 anymore, we need to force using 'trusty'.
dist: trusty
env: PHPCS_VERSION="3.5.3" LINT=1
- php: 5.4
# As the latest Debian does not support PHP 5.4 anymore, we need to force using 'trusty'.
dist: trusty
env: PHPCS_VERSION="2.8.1"
- php: 5.3
# As the latest Debian does not support PHP 5.3 anymore, we need to force using 'precise'.
dist: precise
env: PHPCS_VERSION="2.9.2"
- php: 5.3
# As the latest Debian does not support PHP 5.3 anymore, we need to force using 'precise'.
dist: precise
env: PHPCS_VERSION="2.0.0"
- php: 7.4
env: PHPCS_VERSION="4.0.x-dev as 3.9.99"
- php: nightly
env: PHPCS_VERSION="dev-master" LINT=1
allow_failures:
# Allow failures for unstable builds.
- php: "nightly"
- env: PHPCS_VERSION="4.0.x-dev as 3.9.99"
fast_finish: true
before_install:
# Speed up build time by disabling Xdebug.
phpenv config-rm xdebug.ini || echo 'No xdebug config.'
install:
- composer require --no-update --no-suggest --no-scripts squizlabs/php_codesniffer:"${PHPCS_VERSION}"
- |
if [[ ${PHPCS_VERSION:0:3} < "2.2" ]]; then
# Install PHPCompatibility 7.x for PHPCS < 2.2.
composer require --no-update --no-suggest --no-scripts phpcompatibility/php-compatibility:"^7.0"
elif [[ ${PHPCS_VERSION:0:3} < "2.3" ]]; then
# Install PHPCompatibility 8.x for PHPCS 2.2 < 2.3.
composer require --no-update --no-suggest --no-scripts phpcompatibility/php-compatibility:"^8.0"
fi
- |
if [[ $TRAVIS_PHP_VERSION != "nightly" && $TRAVIS_PHP_VERSION != "8.0" ]]; then
travis_wait composer install --no-interaction --no-progress --no-scripts --no-suggest --optimize-autoloader --prefer-dist --verbose
else
composer require --no-update --no-suggest --no-scripts phpcompatibility/php-compatibility
travis_wait composer install --no-dev --no-interaction --no-progress --no-scripts --no-suggest --optimize-autoloader --prefer-dist --verbose --ignore-platform-reqs
fi
- |
if [[ ${PHPCS_VERSION:0:3} < "2.2" ]]; then
# Rename the PHPCompatibility directory as PHPCompatibility 7.x wasn't fully compatible with Composer yet.
mv ./vendor/phpcompatibility/php-compatibility ./vendor/phpcompatibility/PHPCompatibility
fi
script:
- if [[ "$LINT" == "1" ]]; then if find . -path ./vendor -prune -o -name "*.php" -exec php -l {} \; | grep "^[Parse error|Fatal error]"; then exit 1; fi; fi
- composer install-codestandards
- ./vendor/bin/phpcs -i
- |
if [[ "$PHPCS" == "1" ]]; then
# Do the actual code style check for this repo.
./vendor/bin/phpcs
elif [[ ${PHPCS_VERSION:0:3} < "2.3" ]]; then
# Test that an external standard has been registered correctly by running it against the codebase on PHPCS < 2.3.
./vendor/bin/phpcs -ps ./src/ --standard=PHPCompatibility --runtime-set testVersion "${TRAVIS_PHP_VERSION:0:3}" --sniffs=PHPCompatibility.PHP.DeprecatedFunctions
else
# Test that an external standard has been registered correctly by running it against the codebase.
./vendor/bin/phpcs -ps ./src/ --standard=PHPCompatibility --runtime-set testVersion "${TRAVIS_PHP_VERSION:0:3}" --sniffs=PHPCompatibility.FunctionUse.RemovedFunctions
fi
- if [[ "$SECURITY" == "1" ]];then ./vendor/bin/security-checker -n security:check --end-point=http://security.symfony.com/check_lock; fi