-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
93 lines (78 loc) · 2.06 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
language: php
sudo: false
addons:
apt:
packages:
- tidy
# Caching so future tests go faster
cache:
directories:
- $HOME/.composer/cache/files
env:
global:
- DB=MYSQL
- COMPOSER_ROOT_VERSION=4.0.x-dev
- COVERAGE=0
- LINT=0
matrix:
include:
- php: 7.0
env: DB=SQLITE
- php: 7.0
env: DB=PGSQL
- php: 7.0
env: COVERAGE=1
- php: 7.0
env: LINT=1
- php: 5.6
allow_failures:
- php: 7.0
env: DB=SQLITE
- php: 7.0
env: DB=PGSQL
before_script:
# Removes xdebug (speeds up php tests, coverage is done with phpdbg instead)
- phpenv config-rm xdebug.ini
# Only install composer stuff if PHP
- |
phpenv rehash
composer self-update || true
echo 'memory_limit = 2048M' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
composer require --prefer-dist --no-update silverstripe-themes/simple:~3.2
composer update --no-suggest --prefer-dist
# Needs an extra package if it is PGSQL
- |
if [[ $DB == PGSQL ]]; then
composer require --no-update silverstripe/postgresql:2.0.x-dev --prefer-dist
fi
# Needs an extra package if it is SQLITE
- |
if [[ $DB == SQLITE ]]; then
composer require --no-update silverstripe/sqlite3:2.0.x-dev --prefer-dist
fi
# Execute tests with or without coverage
script:
# php without coverage and without linting
- |
if [[ $COVERAGE == 0 ]] && [[ $LINT == 0 ]]; then
vendor/bin/phpunit
fi
# php with coverage
- |
if [[ $COVERAGE == 1 ]]; then
phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml && \
wget https://scrutinizer-ci.com/ocular.phar;
fi
# php with linting
- |
if [[ $LINT == 1 ]]; then
composer run-script lint
fi
# Upload code coverage when tests pass
after_success:
# php with coverage
- |
if [[ $COVERAGE == 1 ]]; then
bash <(curl -s https://codecov.io/bash) -f coverage.xml -F php
travis_retry php ocular.phar code-coverage:upload --format=php-clover --access-token=$SCRUT_TOKEN coverage.xml;
fi