Exclude node_modules from PHP code coverage
[phpmyadmin.git] / .travis.yml
blob7d54d91ae990ba44acac7ae54fee9d2321b66e22
1 dist: xenial
3 language: php
5 stages:
6   - name: "Lint and analyse code"
7   - name: "PHP Unit tests"
8   - name: "Documentation"
9   - name: "Other tests"
11 install:
12   - composer install --no-interaction
13   - yarn install --non-interactive
15 before_script:
16   - export TESTSUITE_PASSWORD=`openssl rand -base64 30`
17   - export TESTSUITE_BROWSERSTACK_KEY=`echo cHlDcHJTNmZwZjVlaUR2RmV6VkU= | base64 --decode`
18   - mysql -uroot -e "CREATE DATABASE IF NOT EXISTS test"
19   - mysql -uroot < sql/create_tables.sql
20   - mysql -uroot -e "SET PASSWORD = PASSWORD('$TESTSUITE_PASSWORD')"
21   - ./test/start-local-server
23 script:
24   - ./scripts/generate-mo --quiet
25   - ./vendor/bin/phpunit --configuration phpunit.xml.dist --exclude-group selenium
27 after_script:
28   - if [ -f vendor/bin/codacycoverage ] ; then php vendor/bin/codacycoverage clover || true ; fi
29   - if [ -f php.log ] ; then cat php.log ; fi
30   - if [ -f nginx-error.log ] ; then cat nginx-error.log ; fi
31   - if [ -f config.inc.php ] ; then rm -rf config.inc.php; fi
32   - if [ "$CI_MODE" = "selenium" ] ; then ~/browserstack/BrowserStackLocal --daemon stop; fi
34 after_success: bash <(curl -s https://codecov.io/bash)
36 services:
37   - mysql
39 cache:
40   pip: true
41   yarn: true
42   directories:
43     - $HOME/.composer/cache/
44     - $HOME/browserstack
45     - node_modules
47 jobs:
48   allow_failures:
49     - php: nightly
50     - os: osx
51     - name: "PHPUnit tests in random order"
53   include:
54     - stage: "Lint and analyse code"
55       name: "Lint files"
56       before_install: phpenv config-rm xdebug.ini
57       before_script: skip
58       after_script: skip
59       after_success: skip
60       script:
61         - ./test/ci-phplint
62         - composer phpcs
63         - yarn run js-lint --quiet
64         - yarn run css-lint
66     - stage: "Lint and analyse code"
67       name: "Run phpstan"
68       before_install: phpenv config-rm xdebug.ini
69       before_script: skip
70       after_script: skip
71       after_success: skip
72       script: composer phpstan
74     - stage: "PHP Unit tests"
75       php: 7.1
76       name: "PHP 7.1"
77       env: CI_MODE=test
79     - stage: "PHP Unit tests"
80       php: 7.2
81       name: "PHP 7.2"
82       env: CI_MODE=test
84     - stage: "PHP Unit tests"
85       php: 7.3
86       name: "PHP 7.3"
87       env: CI_MODE=test
89     - stage: "PHP Unit tests"
90       php: 7.4
91       name: "PHP 7.4"
92       env: CI_MODE=test
93       before_install: phpenv config-rm xdebug.ini
95     - stage: "PHP Unit tests"
96       php: nightly
97       name: "PHP nightly"
98       env: CI_MODE=test
99       install:
100         - composer install --no-interaction --ignore-platform-reqs
101         - yarn install --non-interactive
103     - stage: "PHP Unit tests"
104       name: "OSX"
105       os: osx
106       env: CI_MODE=test
107       language: node_js
108       node_js: 10
109       before_install:
110         - brew link --force gettext
111         - echo "memory_limit=-1" > /usr/local/etc/php/7.4/conf.d/50-travis.ini
112         - echo "pcre.jit=0" >> /usr/local/etc/php/7.4/conf.d/50-travis.ini
113         - mysql.server start
114         - sleep 5
115         # Enable password access
116         - mysql -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');"
117       addons:
118         homebrew:
119           packages:
120             - php
121             - composer
122             - mariadb
123           update: true
125     - stage: "PHP Unit tests"
126       name: "Windows"
127       os: windows
128       language: node_js
129       node_js: 10
130       env:
131         - CI_MODE=test
132         - YARN_GPG=no
133       before_install:
134         - choco install php composer
135         - choco install mariadb --version=10.4.8
136         - export PATH=/c/tools/php74:/c/ProgramData/ComposerSetup/bin:/c/"Program Files"/"MariaDB 10.4"/bin:$PATH
137         - PHP_EXTENSIONS="mysqli curl bz2 gd2 pdo_mysql"
138         - for php_ext in $PHP_EXTENSIONS ; do sed -i -e "s/^;extension=${php_ext}/extension=${php_ext}/" /c/tools/php74/php.ini ; done
139         - sed -i -e 's/^memory_limit = .*/memory_limit = -1/' /c/tools/php74/php.ini
140         - find . -type f -name "*.php" -print0 | xargs -0 sed -i ':a;N;$!ba;s/\r//g'
142     - stage: "PHP Unit tests"
143       php: 7.1
144       name: "PHP 7.1 with dbase extension"
145       env: CI_MODE=test
146       install:
147         - pecl channel-update pecl.php.net
148         - pecl install dbase
149         - php -m |grep -F 'dbase'
150         - composer install --no-interaction
151         - yarn install --non-interactive
153     - stage: "PHP Unit tests"
154       php: 7.4
155       name: "PHPUnit tests in random order"
156       env: CI_MODE=test
157       script:
158         - scripts/generate-mo --quiet
159         - vendor/bin/phpunit --configuration phpunit.xml.dist --exclude-group selenium --order-by=random --stop-on-failure
161     - stage: "Documentation"
162       name: "Build docs"
163       before_script: skip
164       after_script: skip
165       after_success: skip
166       install:
167         - source ~/virtualenv/python3.6/bin/activate
168         - pip install 'Sphinx'
169       script: ./test/ci-docs
171     - stage: "Documentation"
172       name: "Build API docs"
173       before_install: phpenv config-rm xdebug.ini
174       before_script: skip
175       after_script: skip
176       after_success: skip
177       install: composer global require "sami/sami:^4.0"
178       script: $HOME/.composer/vendor/bin/sami.php --no-interaction update ./test/sami-config.php
180     - stage: "Other tests"
181       name: "Build release"
182       before_script: skip
183       after_script: skip
184       after_success: skip
185       install:
186         - source ~/virtualenv/python3.6/bin/activate
187         - pip install 'Sphinx'
188       script: ./scripts/create-release.sh --ci
190     - stage: "Other tests"
191       name: "Run selenium tests on Google Chrome"
192       env:
193         - CI_MODE=selenium
194         - TESTSUITE_SELENIUM_BROWSER=chrome
195         - TESTSUITE_USER=root
196         - TESTSUITE_URL=http://127.0.0.1:8000
197       before_install: phpenv config-rm xdebug.ini
198       install:
199         - ./test/install-browserstack
200         - composer install --no-interaction
201         - yarn install --non-interactive
202         - echo -e "<?php\n\$cfg['UploadDir'] = './test/test_data/';" > config.inc.php
203       script: ./vendor/bin/phpunit --configuration phpunit.xml.nocoverage --group selenium --verbose --debug
204       addons:
205         apt:
206           packages:
207             - nginx