Merge pull request #14712 from mauriciofauth/travis

Refactor .travis.yml
This commit is contained in:
Maurício Meneghini Fauth 2018-11-05 23:14:40 -02:00 committed by GitHub
commit 7905af28c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 93 additions and 130 deletions

View File

@ -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 "<?php\n\$cfg['UploadDir'] = './test/test_data/';" > 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

View File

@ -1,3 +0,0 @@
#!/bin/sh
set -e
$HOME/.composer/vendor/bin/sami.php --no-interaction --verbose update ./test/sami-config.php

View File

@ -1,3 +0,0 @@
#!/bin/sh
set -e
composer global require "sami/sami:^4.0"

View File

@ -1,5 +0,0 @@
#!/bin/sh
# Install deps for building documentation
pip install 'Sphinx'

View File

@ -1,4 +0,0 @@
#!/bin/sh
composer install --no-interaction
yarn install --non-interactive

View File

@ -1,2 +0,0 @@
#!/bin/sh

View File

@ -1,3 +0,0 @@
#!/bin/sh
composer install --no-interaction

View File

@ -1,3 +0,0 @@
#!/bin/sh
./test/ci-install-docs

View File

@ -1,6 +0,0 @@
#!/bin/sh
./test/install-browserstack
composer install --no-interaction
echo -e "<?php\n\$cfg['UploadDir'] = './test/test_data/';" > config.inc.php

View File

@ -1,3 +0,0 @@
#!/bin/sh
composer install --no-interaction

View File

@ -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

View File

@ -1,6 +0,0 @@
#!/bin/sh
cd $(dirname $0)/../
echo "Running in : $(pwd)"
./vendor/bin/phpstan analyse

View File

@ -1,3 +0,0 @@
#!/bin/sh
./scripts/create-release.sh --ci

View File

@ -1,3 +0,0 @@
#!/bin/sh
./vendor/bin/phpunit --configuration phpunit.xml.nocoverage --group selenium --debug

View File

@ -1,3 +0,0 @@
#!/bin/sh
./vendor/bin/phpunit --configuration phpunit.xml.dist --exclude-group selenium

View File

@ -1,3 +0,0 @@
; PHP configuration tweaks for tests on Travis
xdebug.profiler_enable=0