Merge branch 'QA_5_0'
[phpmyadmin.git] / .travis.yml
blob5545c256137f888aa102ebcb45b656d605b44445
1 dist: xenial
3 language: php
5 stages:
6   - name: "Lint and analyse code"
7   - name: "PHP Unit tests"
8   - name: "Other tests"
9   - name: "Documentation"
11 install:
12   - nvm install 10
13   - composer install --no-interaction
14   - yarn install --non-interactive
16 script:
17   - ./scripts/generate-mo --quiet
18   - ./vendor/bin/phpunit --configuration phpunit.xml.dist --exclude-group selenium
20 after_success:
21   - bash <(curl -s https://codecov.io/bash)
22   - if [ -f build/logs/clover.xml ] ; then curl -LsO https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml; fi
23   - if [ -f build/logs/clover.xml ] ; then bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l php -r build/logs/clover.xml --partial; fi
25 services:
26   - mysql
28 cache:
29   pip: true
30   yarn: true
31   directories:
32     - $HOME/.composer/cache/
33     - node_modules
35 jobs:
36   allow_failures:
37     - php: nightly
38     - os: osx
39     - name: "PHPUnit tests in random order"
41   include:
42     - stage: "Lint and analyse code"
43       name: "Lint files"
44       before_install: phpenv config-rm xdebug.ini
45       before_script: skip
46       after_script: skip
47       after_success: skip
48       script:
49         - ./test/ci-phplint
50         - composer phpcs
51         - yarn run js-lint --quiet
52         - yarn run css-lint
53         - php scripts/console lint:twig templates --show-deprecations
55     - stage: "Lint and analyse code"
56       name: "Run phpstan"
57       before_install: phpenv config-rm xdebug.ini
58       before_script: skip
59       after_script: skip
60       after_success: skip
61       script: composer phpstan -- --memory-limit 2G
63     - stage: "Lint and analyse code"
64       name: "Run psalm"
65       before_install: phpenv config-rm xdebug.ini
66       before_script: skip
67       after_script: skip
68       after_success: skip
69       script: composer psalm
71     - stage: "PHP Unit tests"
72       php: 7.1
73       name: "PHP 7.1"
74       env: CI_MODE=test
76     - stage: "PHP Unit tests"
77       php: 7.2
78       name: "PHP 7.2"
79       env: CI_MODE=test
81     - stage: "PHP Unit tests"
82       php: 7.3
83       name: "PHP 7.3"
84       env: CI_MODE=test
86     - stage: "PHP Unit tests"
87       php: 7.4
88       name: "PHP 7.4"
89       env: CI_MODE=test
90       before_install: phpenv config-rm xdebug.ini
92     - stage: "PHP Unit tests"
93       php: nightly
94       name: "PHP nightly"
95       env: CI_MODE=test
96       install:
97         - composer install --no-interaction --ignore-platform-reqs
98         - nvm install 10
99         - yarn install --non-interactive
101     - stage: "PHP Unit tests"
102       name: "OSX"
103       os: osx
104       env: CI_MODE=test
105       language: node_js
106       node_js: 10
107       before_install:
108         - export PATH="/usr/local/opt/gettext/bin:$PATH"
109         - echo "memory_limit=-1" > /usr/local/etc/php/7.4/conf.d/50-travis.ini
110         - echo "pcre.jit=0" >> /usr/local/etc/php/7.4/conf.d/50-travis.ini
111         - mysql.server start
112         - sleep 5
113         # Enable password access
114         - mysql -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');"
115       addons:
116         homebrew:
117           packages:
118             - php
119             - composer
120             - mariadb
121           update: true
123     - stage: "PHP Unit tests"
124       name: "Windows"
125       os: windows
126       language: node_js
127       node_js: 10
128       env:
129         - CI_MODE=test
130         - YARN_GPG=no
131       install:
132         - composer install --no-interaction
133         - yarn install --non-interactive
134       before_install:
135         - choco install php composer
136         - choco install mariadb --version=10.4.8
137         - export PATH=/c/tools/php74:/c/ProgramData/ComposerSetup/bin:/c/"Program Files"/"MariaDB 10.4"/bin:$PATH
138         - PHP_EXTENSIONS="mysqli curl bz2 gd2 pdo_mysql"
139         - for php_ext in $PHP_EXTENSIONS ; do sed -i -e "s/^;extension=${php_ext}/extension=${php_ext}/" /c/tools/php74/php.ini ; done
140         - sed -i -e 's/^memory_limit = .*/memory_limit = -1/' /c/tools/php74/php.ini
141         - find . -type f -name "*.php" -print0 | xargs -0 sed -i ':a;N;$!ba;s/\r//g'
143     - stage: "PHP Unit tests"
144       php: 7.1
145       name: "PHP 7.1 with dbase extension"
146       env: CI_MODE=test
147       install:
148         - pecl channel-update pecl.php.net
149         - pecl install dbase
150         - php -m |grep -F 'dbase'
151         - composer install --no-interaction
152         - nvm install 10
153         - yarn install --non-interactive
155     - stage: "PHP Unit tests"
156       php: 7.4
157       name: "PHPUnit tests in random order"
158       env: CI_MODE=test
159       script:
160         - scripts/generate-mo --quiet
161         - vendor/bin/phpunit --configuration phpunit.xml.dist --exclude-group selenium --order-by=random --stop-on-failure
163     - stage: "Documentation"
164       name: "Build docs"
165       before_script: skip
166       after_script: skip
167       after_success: skip
168       install:
169         - source ~/virtualenv/python3.6/bin/activate
170         - pip install 'Sphinx'
171       script: ./test/ci-docs
173     - stage: "Documentation"
174       name: "Build API docs"
175       before_install: phpenv config-rm xdebug.ini
176       before_script: skip
177       after_script: skip
178       after_success: skip
179       install: composer global require "code-lts/doctum:^5.0"
180       script: $HOME/.composer/vendor/bin/doctum.php --no-interaction update ./test/doctum-config.php
182     - stage: "Other tests"
183       name: "Build release"
184       before_script: skip
185       after_script:
186         # Mark Codacy coverage final here because all steps of the previous stage did succeed
187         - bash <(curl -Ls https://coverage.codacy.com/get.sh) final
188       after_success: skip
189       install:
190         - nvm install 10
191         - source ~/virtualenv/python3.6/bin/activate
192         - pip install 'Sphinx'
193       script: ./scripts/create-release.sh --ci
195     - stage: "Other tests"
196       name: "Run selenium tests on Google Chrome"
197       env:
198         - CI_MODE=selenium
199         - TESTSUITE_SELENIUM_BROWSER=chrome
200         - TESTSUITE_USER=root
201         - TESTSUITE_URL=http://127.0.0.1:8000
202         - TESTSUITE_SERVER="127.0.0.1"
203         - TESTSUITE_DATABASE="selenium"
204         - TESTSUITE_SELENIUM_HOST="127.0.0.1"
205         - TESTSUITE_SELENIUM_PORT="4444"
206         - SKIP_STANDALONE=1
207       before_install:
208         - docker run -d -e SCREEN_WIDTH=1920 -e SCREEN_HEIGHT=1080 --rm --name=selenium --net=host -v /dev/shm:/dev/shm selenium/standalone-chrome:3.141.59
209         - phpenv config-rm xdebug.ini
210         - cp test/config.e2e.inc.php config.inc.php
211       before_script:
212         - export TESTSUITE_PASSWORD=`openssl rand -base64 30`
213         - mysql -uroot -e "CREATE DATABASE IF NOT EXISTS test"
214         - mysql -uroot < sql/create_tables.sql
215         - mysql -uroot -e "SET PASSWORD = PASSWORD('$TESTSUITE_PASSWORD')"
216         - ./test/start-local-server
217       script: ./vendor/bin/phpunit --no-coverage --group selenium --verbose --debug
218       after_script:
219         - if [ -f php.log ] ; then cat php.log ; fi
220         - if [ -f nginx-error.log ] ; then cat nginx-error.log ; fi
221         - if [ -f config.inc.php ] ; then rm -rf config.inc.php; fi
222         - ./test/stop-local-server
223         - docker logs selenium
224         - docker stop selenium
225       services:
226         - docker
227         - mysql
228       addons:
229         apt:
230           packages:
231             - nginx