|
1 | | -# Travis CI (MIT License) configuration file |
2 | | -# @link https://travis-ci.org/ |
| 1 | +# Travis CI |
3 | 2 |
|
4 | 3 | # Use new container based environment |
5 | 4 | sudo: false |
6 | 5 |
|
7 | 6 | # Declare project language. |
8 | | -# @link http://about.travis-ci.org/docs/user/languages/php/ |
9 | 7 | language: php |
10 | 8 |
|
11 | | -# Declare versions of PHP to use. Use one decimal max. |
12 | | -# @link http://docs.travis-ci.com/user/build-configuration/ |
| 9 | +env: |
| 10 | + global: |
| 11 | + # Name and folder of the the standard to test. |
| 12 | + - STANDARD="CodeIgniter4" |
| 13 | + # Upload covarage to coveralls. |
| 14 | + - COVERALLS="1" |
| 15 | + |
13 | 16 | matrix: |
14 | 17 | fast_finish: true |
15 | 18 |
|
| 19 | + # Declare versions of PHP to use. Use one decimal max. |
16 | 20 | include: |
17 | 21 | # aliased to a recent 5.4.x version |
18 | 22 | # - php: '5.4' |
19 | 23 | # aliased to a recent 5.5.x version |
20 | 24 | # - php: '5.5' |
21 | 25 | # aliased to a recent 5.6.x version |
22 | 26 | # - php: '5.6' |
23 | | - # env: SNIFF=1 |
24 | 27 | # aliased to a recent 7.x version |
25 | 28 | # - php: '7.0' |
26 | 29 | # aliased to a recent 7.x version |
27 | 30 | - php: '7.1' |
28 | | - env: SNIFF=1 |
29 | 31 | # aliased to a recent hhvm version |
30 | | - - php: 'hhvm' |
| 32 | + # - php: 'hhvm' |
31 | 33 | # php nightly |
32 | | - - php: 'nightly' |
| 34 | + # - php: 'nightly' |
33 | 35 |
|
34 | | - allow_failures: |
35 | | - - php: 'hhvm' |
36 | | - - php: nightly |
| 36 | + # allow_failures: |
| 37 | + # - php: 'hhvm' |
| 38 | + # - php: 'nightly' |
37 | 39 |
|
38 | 40 | before_install: |
39 | | - # Install CodeIgniter4-Standard deps. |
40 | | - - if [[ "$SNIFF" == "1" ]]; then composer self-update; fi |
41 | | - - if [[ "$SNIFF" == "1" ]]; then composer require squizlabs/php_codesniffer:dev-master; fi |
42 | | - - if [[ "$SNIFF" == "1" ]]; then composer require satooshi/php-coveralls:dev-master; fi |
43 | | - - if [[ "$SNIFF" == "1" ]]; then composer install; fi |
44 | | - - phpenv rehash |
| 41 | + # Remove xdebug. Needed for coverage. |
| 42 | + # - phpenv config-rm xdebug.ini |
| 43 | + |
| 44 | +install: |
| 45 | + # Update composer to latest version. |
| 46 | + - composer self-update |
| 47 | + # Install project composer deps in composer.json |
| 48 | + - composer install --no-interaction |
| 49 | + |
| 50 | +before_script: |
| 51 | + # Rehash the php environment if testing on several PHP versions. |
| 52 | + # - phpenv rehash |
45 | 53 |
|
46 | 54 | script: |
47 | | - # Search for PHP syntax errors. |
48 | | - - if [[ "$SNIFF" == "1" ]]; then find -L . -path ./vendor -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l; fi |
49 | | - # Change dir. |
50 | | - - if [[ "$SNIFF" == "1" ]]; then cd ./vendor/squizlabs/php_codesniffer/; fi |
51 | | - # Install php_codesniffer deps. |
52 | | - - if [[ "$SNIFF" == "1" ]]; then composer install; fi |
| 55 | + # Check for PHP syntax errors. |
| 56 | + - find -L . -path ./vendor -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l |
53 | 57 | # - Check files match the PHPCS standard. |
54 | | - - if [[ "$SNIFF" == "1" ]]; then ./bin/phpcs --ignore=*/Tests/* ../../../CodeIgniter4; fi |
55 | | - # - Change the default standard. |
56 | | - - if [[ "$SNIFF" == "1" ]]; then ./bin/phpcs --config-set installed_paths ../../../CodeIgniter4; fi |
57 | | - # - Verify it's installed. |
58 | | - - if [[ "$SNIFF" == "1" ]]; then ./bin/phpcs -i; fi |
59 | | - # - Run unit tests for CodeIgniter4 standard. |
60 | | - - if [[ "$SNIFF" == "1" ]]; then ./vendor/bin/phpunit --debug --coverage-clover=../../../build/logs/clover.xml --filter CodeIgniter4 ./tests/AllTests.php; fi |
| 58 | + - ./vendor/bin/phpcs --ignore=*/Tests/* ./$STANDARD/ --standard=./vendor/squizlabs/php_codesniffer/phpcs.xml.dist |
| 59 | + # Change the default standard. |
| 60 | + - ./vendor/bin/phpcs --config-set installed_paths $TRAVIS_BUILD_DIR/$STANDARD |
| 61 | + # Verify it's installed. |
| 62 | + - ./vendor/bin/phpcs -i |
| 63 | + # Run unit tests for the standard. |
| 64 | + - ./vendor/bin/phpunit --debug --filter $STANDARD |
61 | 65 |
|
62 | 66 | after_success: |
63 | | - - if [[ "$SNIFF" == "1" ]]; then cd ../../../; fi |
64 | | - - if [[ "$SNIFF" == "1" ]]; then php ./vendor/bin/coveralls -v -x ./build/logs/clover.xml; fi |
| 67 | + - if [[ "$COVERALLS" == "1" ]]; then ./vendor/bin/coveralls -v -x ./build/logs/coverage/clover/clover.xml; fi |
0 commit comments