diff --git a/.travis.yml b/.travis.yml index 949412cac3..ecf697a707 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,26 +1,17 @@ -# The Travis setup: -# - run testsuite for every PHP version -# - run lint for every PHP version -# - run Selenium for single PHP version - +language: php dist: trusty -language: php +stages: + - name: "Lint and analyse code" + - name: "PHP Unit tests" + - name: "Documentation" + - name: "Other tests" -services: - - mysql - -sudo: required - -install: - - if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then source ~/virtualenv/python3.6/bin/activate ; fi - - ./test/ci-install-$CI_MODE - - if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then case "$TRAVIS_PHP_VERSION" in hhvm*) ;; *) phpenv config-add test/php-noprofile.ini ;; esac ; fi +install: composer install --no-interaction before_script: - export TESTSUITE_PASSWORD=`openssl rand -base64 30` - export TESTSUITE_BROWSERSTACK_KEY=`echo cHlDcHJTNmZwZjVlaUR2RmV6VkU= | base64 --decode` - - export PATH=~/.composer/vendor/bin/:$PATH - mysql -uroot -e "CREATE DATABASE IF NOT EXISTS test" - mysql -uroot < sql/create_tables.sql - mysql -uroot -e "SET PASSWORD = PASSWORD('$TESTSUITE_PASSWORD')" @@ -28,8 +19,7 @@ before_script: script: - ./scripts/generate-mo --quiet - - if [ $CI_MODE = test ] ; then ./test/ci-phplint ; fi - - ./test/ci-$CI_MODE + - ./vendor/bin/phpunit --configuration phpunit.xml.dist --exclude-group selenium after_script: - if [ -f vendor/bin/codacycoverage ] ; then php vendor/bin/codacycoverage clover || true ; fi @@ -39,33 +29,57 @@ after_script: - if [ -f config.inc.php ] ; then rm -rf config.inc.php; fi - if [ "$CI_MODE" = "selenium" ] ; then ~/browserstack/BrowserStackLocal --daemon stop; fi -after_success: - - bash <(curl -s https://codecov.io/bash) - -stages: - - name: "PHP Unit tests" - - name: "Lint and analyse code" - - name: "Documentation" - - name: "Other tests" +after_success: bash <(curl -s https://codecov.io/bash) jobs: + allow_failures: + - php: nightly + - name: "Run phpstan" + - os: windows + include: - stage: "Lint and analyse code" - name: "Lint PHP files" - php: "7.1" - env: CI_MODE=lint + name: "Lint files" + php: 7.1 + before_script: skip + after_script: skip + after_success: skip + install: + - composer install --no-interaction + - yarn install --non-interactive + script: + - ./test/ci-phplint + - ./vendor/bin/phpcs --exclude=PSR1.Files.SideEffects,Generic.Metrics.NestingLevel + - ./node_modules/.bin/eslint --quiet ./js + - stage: "Lint and analyse code" name: "Run phpstan" - php: "7.2" - env: CI_MODE=phpstan - - stage: "Documentation" - name: "Build docs" - php: "7.1" - env: CI_MODE=docs - - stage: "Documentation" - name: "Build API docs" - php: "7.1" - env: CI_MODE=apidocs + php: 7.1 + before_script: skip + after_script: skip + after_success: skip + script: ./vendor/bin/phpstan analyse + + - 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: nightly + name: "PHP nightly" + env: CI_MODE=test + - stage: "PHP Unit tests" name: "PHP 7.2" os: osx @@ -77,22 +91,7 @@ jobs: - brew link --force gettext - sed -i -e 's/^memory_limit = .*/memory_limit = -1/' /usr/local/etc/php/7.2/php.ini - mysql.server start - - stage: "PHP Unit tests" - php: "7.3" - name: "PHP 7.3" - 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.1" - name: "PHP 7.1" - env: CI_MODE=test - - stage: "PHP Unit tests" - php: "nightly" - name: "PHP nightly" - env: CI_MODE=test + - stage: "PHP Unit tests" name: "PHP 7.2" os: windows @@ -105,24 +104,54 @@ jobs: - for php_ext in $PHP_EXTENSIONS ; do sed -i -e "s/^;extension=${php_ext}/extension=${php_ext}/" /c/tools/php72/php.ini ; done - sed -i -e 's/^memory_limit = .*/memory_limit = -1/' /c/tools/php72/php.ini - find . -type f -name "*.php" -print0 | xargs -0 sed -i ':a;N;$!ba;s/\r//g' + + - 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" + php: 7.1 + 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" - php: "7.1" - env: CI_MODE=release + php: 7.1 + before_script: skip + after_script: skip + after_success: skip + install: + - 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" - php: "7.1" + php: 7.1 env: - CI_MODE=selenium - TESTSUITE_SELENIUM_BROWSER=chrome - TESTSUITE_USER=root - TESTSUITE_URL=http://127.0.0.1:8000 - allow_failures: - - php: "nightly" - env: CI_MODE=test - - php: "7.2" - env: CI_MODE=phpstan - - os: windows + install: + - ./test/install-browserstack + - composer install --no-interaction + - echo -e " config.inc.php + script: ./vendor/bin/phpunit --configuration phpunit.xml.nocoverage --group selenium + addons: + apt: + packages: + - nginx cache: pip: true @@ -131,12 +160,3 @@ cache: - $HOME/.composer/cache/ - $HOME/browserstack - node_modules -# Install APT packages -# - git > 2.5.1 needed for worktrees -# - mysql server does not seem to be always present on Travis Trusty environment -addons: - apt: - packages: - - git - - mysql-server-5.6 - - nginx diff --git a/test/ci-apidocs b/test/ci-apidocs deleted file mode 100755 index 8ffb60be65..0000000000 --- a/test/ci-apidocs +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -set -e -$HOME/.composer/vendor/bin/sami.php --no-interaction --verbose update ./test/sami-config.php diff --git a/test/ci-install-apidocs b/test/ci-install-apidocs deleted file mode 100755 index 01f95e582a..0000000000 --- a/test/ci-install-apidocs +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -set -e -composer global require "sami/sami:^4.0" diff --git a/test/ci-install-docs b/test/ci-install-docs deleted file mode 100755 index a823b967ea..0000000000 --- a/test/ci-install-docs +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -# Install deps for building documentation - -pip install 'Sphinx' diff --git a/test/ci-install-lint b/test/ci-install-lint deleted file mode 100755 index d51724c769..0000000000 --- a/test/ci-install-lint +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -composer install --no-interaction -yarn install --non-interactive diff --git a/test/ci-install-phplint b/test/ci-install-phplint deleted file mode 100755 index 13f47935d9..0000000000 --- a/test/ci-install-phplint +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh - diff --git a/test/ci-install-phpstan b/test/ci-install-phpstan deleted file mode 100755 index 2fe1edee6b..0000000000 --- a/test/ci-install-phpstan +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -composer install --no-interaction diff --git a/test/ci-install-release b/test/ci-install-release deleted file mode 100755 index 32cccf2b6a..0000000000 --- a/test/ci-install-release +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -./test/ci-install-docs diff --git a/test/ci-install-selenium b/test/ci-install-selenium deleted file mode 100755 index 7b8eca160a..0000000000 --- a/test/ci-install-selenium +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -./test/install-browserstack -composer install --no-interaction - -echo -e " config.inc.php \ No newline at end of file diff --git a/test/ci-install-test b/test/ci-install-test deleted file mode 100755 index 2fe1edee6b..0000000000 --- a/test/ci-install-test +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -composer install --no-interaction diff --git a/test/ci-lint b/test/ci-lint deleted file mode 100755 index b2d8ec1701..0000000000 --- a/test/ci-lint +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -./vendor/bin/phpcs --version && -./vendor/bin/phpcs --exclude=PSR1.Files.SideEffects,Generic.Metrics.NestingLevel && - -echo "ESLint `./node_modules/.bin/eslint --version`" && -./node_modules/.bin/eslint --quiet ./js diff --git a/test/ci-phpstan b/test/ci-phpstan deleted file mode 100755 index 5f8db42f43..0000000000 --- a/test/ci-phpstan +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -cd $(dirname $0)/../ -echo "Running in : $(pwd)" - -./vendor/bin/phpstan analyse diff --git a/test/ci-release b/test/ci-release deleted file mode 100755 index c53099fa04..0000000000 --- a/test/ci-release +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -./scripts/create-release.sh --ci diff --git a/test/ci-selenium b/test/ci-selenium deleted file mode 100755 index d5d6b91dfb..0000000000 --- a/test/ci-selenium +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -./vendor/bin/phpunit --configuration phpunit.xml.nocoverage --group selenium --debug diff --git a/test/ci-test b/test/ci-test deleted file mode 100755 index 1717e8f984..0000000000 --- a/test/ci-test +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -./vendor/bin/phpunit --configuration phpunit.xml.dist --exclude-group selenium diff --git a/test/php-noprofile.ini b/test/php-noprofile.ini deleted file mode 100644 index 2ab76d36b6..0000000000 --- a/test/php-noprofile.ini +++ /dev/null @@ -1,3 +0,0 @@ -; PHP configuration tweaks for tests on Travis - -xdebug.profiler_enable=0