dist: xenial language: php stages: - name: "Lint and analyse code" - name: "PHP Unit tests" - name: "Other tests" - name: "Documentation" install: - nvm install 10 - composer install --no-interaction - yarn install --non-interactive script: - ./scripts/generate-mo --quiet - ./vendor/bin/phpunit --configuration phpunit.xml.dist --exclude-group selenium after_script: - if [ -f php.log ] ; then cat php.log ; fi - if [ -f nginx-error.log ] ; then cat nginx-error.log ; fi - if [ -f config.inc.php ] ; then rm -rf config.inc.php; fi after_success: - bash <(curl -s https://codecov.io/bash) - 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 - 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 services: - mysql cache: pip: true yarn: true directories: - $HOME/.composer/cache/ - $HOME/browserstack - node_modules jobs: allow_failures: - php: nightly - os: osx - name: "PHPUnit tests in random order" include: - stage: "Lint and analyse code" name: "Lint files" before_install: phpenv config-rm xdebug.ini before_script: skip after_script: skip after_success: skip script: - ./test/ci-phplint - composer phpcs - yarn run js-lint --quiet - yarn run css-lint - stage: "Lint and analyse code" name: "Run phpstan" before_install: phpenv config-rm xdebug.ini before_script: skip after_script: skip after_success: skip script: composer phpstan - stage: "Lint and analyse code" name: "Run psalm" before_install: phpenv config-rm xdebug.ini before_script: skip after_script: skip after_success: skip script: composer psalm - stage: "PHP Unit tests" php: 7.1 name: "PHP 7.1" env: CI_MODE=test - stage: "PHP Unit tests" php: 7.2 name: "PHP 7.2" env: CI_MODE=test - stage: "PHP Unit tests" php: 7.3 name: "PHP 7.3" env: CI_MODE=test - stage: "PHP Unit tests" php: 7.4 name: "PHP 7.4" env: CI_MODE=test before_install: phpenv config-rm xdebug.ini - stage: "PHP Unit tests" php: nightly name: "PHP nightly" env: CI_MODE=test install: - composer install --no-interaction --ignore-platform-reqs - nvm install 10 - yarn install --non-interactive - stage: "PHP Unit tests" name: "OSX" os: osx env: CI_MODE=test language: node_js node_js: 10 before_install: - export PATH="/usr/local/opt/gettext/bin:$PATH" - echo "memory_limit=-1" > /usr/local/etc/php/7.4/conf.d/50-travis.ini - echo "pcre.jit=0" >> /usr/local/etc/php/7.4/conf.d/50-travis.ini - mysql.server start - sleep 5 # Enable password access - mysql -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');" addons: homebrew: packages: - php - composer - mariadb update: true - stage: "PHP Unit tests" name: "Windows" os: windows language: node_js node_js: 10 env: - CI_MODE=test - YARN_GPG=no install: - composer install --no-interaction - yarn install --non-interactive before_install: - choco install php composer - choco install mariadb --version=10.4.8 - export PATH=/c/tools/php74:/c/ProgramData/ComposerSetup/bin:/c/"Program Files"/"MariaDB 10.4"/bin:$PATH - PHP_EXTENSIONS="mysqli curl bz2 gd2 pdo_mysql" - for php_ext in $PHP_EXTENSIONS ; do sed -i -e "s/^;extension=${php_ext}/extension=${php_ext}/" /c/tools/php74/php.ini ; done - sed -i -e 's/^memory_limit = .*/memory_limit = -1/' /c/tools/php74/php.ini - find . -type f -name "*.php" -print0 | xargs -0 sed -i ':a;N;$!ba;s/\r//g' - stage: "PHP Unit tests" php: 7.1 name: "PHP 7.1 with dbase extension" env: CI_MODE=test install: - pecl channel-update pecl.php.net - pecl install dbase - php -m |grep -F 'dbase' - composer install --no-interaction - nvm install 10 - yarn install --non-interactive - stage: "PHP Unit tests" php: 7.4 name: "PHPUnit tests in random order" env: CI_MODE=test script: - scripts/generate-mo --quiet - vendor/bin/phpunit --configuration phpunit.xml.dist --exclude-group selenium --order-by=random --stop-on-failure - stage: "Documentation" name: "Build docs" before_script: skip after_script: skip after_success: skip install: - source ~/virtualenv/python3.6/bin/activate - pip install 'Sphinx' script: ./test/ci-docs - stage: "Documentation" name: "Build API docs" before_install: phpenv config-rm xdebug.ini before_script: skip after_script: skip after_success: skip install: composer global require "sami/sami:^4.0" script: $HOME/.composer/vendor/bin/sami.php --no-interaction update ./test/sami-config.php - stage: "Other tests" name: "Build release" before_script: skip after_script: # Mark Codacy coverage final here because all steps of the previous stage did succeed - bash <(curl -Ls https://coverage.codacy.com/get.sh) final after_success: skip install: - nvm install 10 - source ~/virtualenv/python3.6/bin/activate - pip install 'Sphinx' script: ./scripts/create-release.sh --ci - stage: "Other tests" name: "Run selenium tests on Google Chrome" env: - CI_MODE=selenium - TESTSUITE_SELENIUM_BROWSER=chrome - TESTSUITE_USER=root - TESTSUITE_URL=http://127.0.0.1:8000 before_script: - export TESTSUITE_PASSWORD=`openssl rand -base64 30` - export TESTSUITE_BROWSERSTACK_KEY=`echo cHlDcHJTNmZwZjVlaUR2RmV6VkU= | base64 --decode` - mysql -uroot -e "CREATE DATABASE IF NOT EXISTS test" - mysql -uroot < sql/create_tables.sql - mysql -uroot -e "SET PASSWORD = PASSWORD('$TESTSUITE_PASSWORD')" - ./test/start-local-server after_script: - ~/browserstack/BrowserStackLocal --daemon stop before_install: phpenv config-rm xdebug.ini install: - nvm install 10 - ./test/install-browserstack - composer install --no-interaction - yarn install --non-interactive - cp test/config.e2e.inc.php config.inc.php script: ./vendor/bin/phpunit --configuration phpunit.xml.nocoverage --group selenium --verbose --debug addons: apt: packages: - nginx