-
Notifications
You must be signed in to change notification settings - Fork 3
/
.travis.yml
147 lines (125 loc) · 3.11 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
144
145
146
147
language: php
services:
- mysql
- postgresql
cache:
directories:
- "$HOME/.npm"
addons:
apt:
packages:
- tidy
before_install:
# ony install node and update npm if javascript
- |
if [[ $LANG == JS ]]; then
nvm install 8.16
nvm use 8.16
npm i npm -g
fi
install:
# only install node packages if javascript
- |
if [[ $LANG == JS ]]; then
npm ci
fi
env:
global:
- DB=MYSQL
- COMPOSER_ROOT_VERSION=4.0.x-dev
- COVERAGE=0
- LINT=0
- LANG=PHP
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
# js stuff
- php: 7.0
env:
- LANG=JS
- COVERAGE=1
- php: 7.0
env:
- LANG=JS
- LINT=1
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
- |
if [[ $LANG == PHP ]]; then
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
fi
# 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 [[ $LANG == PHP ]] && [[ $COVERAGE == 0 ]] && [[ $LINT == 0 ]]; then
vendor/bin/phpunit
fi
# php with coverage
- |
if [[ $LANG == PHP ]] && [[ $COVERAGE == 1 ]]; then
phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml && \
wget https://scrutinizer-ci.com/ocular.phar;
fi
# php with linting
- |
if [[ $LANG == PHP ]] && [[ $LINT == 1 ]]; then
composer run-script lint
fi
# javascript without coverage
- |
if [[ $LANG == JS ]] && [[ $COVERAGE == 0 ]] && [[ $LINT == 0 ]]; then
npm run test;
fi
# javascript with coverage
- |
if [[ $LANG == JS ]] && [[ $COVERAGE == 1 ]]; then
npm run test:coverage;
fi
# javascript with linting
- |
if [[ $LANG == JS ]] && [[ $LINT == 1 ]]; then
npm run lint
fi
# Upload code coverage when tests pass
after_success:
# php with coverage
- |
if [[ $LANG == PHP ]] && [[ $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
#javascript with coverage
- |
if [[ $LANG == JS ]] && [[ $COVERAGE == 1 ]]; then
bash <(curl -s https://codecov.io/bash) -F js
fi