forked from PHP-CS-Fixer/PHP-CS-Fixer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
109 lines (84 loc) · 3.95 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
language: php
sudo: false
git:
depth: 1
env:
global:
- DEFAULT_COMPOSER_FLAGS="--no-interaction --no-progress --optimize-autoloader"
- TASK_TESTS=1
- TASK_TESTS_COVERAGE=0
- TASK_CS=1
- TASK_SCA=0
matrix:
fast_finish: true
include:
- php: 7.1
env: DEPLOY=yes TASK_TESTS_COVERAGE=1
- php: nightly
env: TASK_SCA=1 COMPOSER_FLAGS="--ignore-platform-reqs" SYMFONY_DEPRECATIONS_HELPER=weak PHP_CS_FIXER_IGNORE_ENV=1
- php: 5.6
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
- php: 7.0
# Use the newer stack for HHVM as HHVM does not support Precise anymore since a long time and so Precise has an outdated version
- php: hhvm
env: SKIP_LINT_TEST_CASES=1
sudo: required
dist: trusty
group: edge
cache:
directories:
- $HOME/.composer
before_install:
# check phpdbg
- phpdbg --version 2> /dev/null || { echo 'No phpdbg'; export TASK_TESTS_COVERAGE=0; }
# turn off XDebug
- phpenv config-rm xdebug.ini || return 0
# validate tasks configuration
- if [ $TASK_TESTS == 0 ] && [ $TASK_TESTS_COVERAGE == 1 ]; then travis_terminate 1; fi
# for building a tag release we don't need to run SCA tools, collect code coverage or self-fix CS
- if [ $TRAVIS_TAG ]; then export TASK_SCA=0; fi
- if [ $TRAVIS_TAG ]; then export TASK_TESTS_COVERAGE=0; fi
- if [ $TRAVIS_TAG ]; then export TASK_CS=0; fi
# Composer: boost installation
- composer global show -ND 2>&1 | grep "hirak/prestissimo" || travis_retry composer global require $DEFAULT_COMPOSER_FLAGS hirak/prestissimo
# display tasks configuration for a job
- set | grep ^TASK | sort
install:
- travis_retry composer update $DEFAULT_COMPOSER_FLAGS $COMPOSER_FLAGS
- composer info -D | sort
before_script:
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then COMMIT_RANGE=$TRAVIS_COMMIT_RANGE; else COMMIT_RANGE="HEAD~..HEAD"; fi;
- if [ $TASK_SCA == 1 ]; then export COMMIT_SCA_FILES=`git diff --name-only --diff-filter=ACMRTUXB $COMMIT_RANGE`; fi
script:
- if [ $TASK_SCA == 1 ]; then ./check_trailing_spaces.sh; fi
- if [ $TASK_SCA == 1 ] && [ -n "$COMMIT_SCA_FILES" ]; then vendor/bin/phpmd `echo $COMMIT_SCA_FILES | sed 's/ /,/g'` text phpmd.xml --exclude src/Resources,tests/Fixtures; fi;
- if [ $TASK_SCA == 1 ]; then php php-cs-fixer fix --rules @PHP70Migration:risky,@PHP71Migration,native_function_invocation -q; fi
- if [ $TASK_TESTS == 1 ] && [ $TASK_TESTS_COVERAGE == 0 ]; then vendor/bin/phpunit --verbose; fi
- if [ $TASK_TESTS == 1 ] && [ $TASK_TESTS_COVERAGE == 1 ]; then phpdbg -qrr vendor/bin/phpunit --verbose --coverage-clover build/logs/clover.xml; fi
- if [ $TASK_SCA == 1 ]; then git checkout . -q; fi
- if [ $TASK_CS == 1 ]; then php php-cs-fixer --diff --dry-run -v fix; fi
after_success:
- if [ $TASK_TESTS_COVERAGE == 1 ]; then php vendor/bin/coveralls -v; fi
before_deploy:
# install box2
- curl -LSs http://box-project.github.io/box2/installer.php | php
- php box.phar --version
# ensure that deps will work on lowest supported PHP version
- composer config platform.php 2> /dev/null || composer config platform.php 5.6.0
# require suggested packages
- composer require --no-update symfony/polyfill-mbstring
# update deps to highest possible for lowest supported PHP version
- composer update $DEFAULT_COMPOSER_FLAGS --no-dev --prefer-stable
- composer info -D | sort
# build phar file
- php -d phar.readonly=false box.phar build
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
condition: $DEPLOY = yes