Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
travis tests
  • Loading branch information
gggeek committed May 4, 2018
1 parent 03754d8 commit fd01545
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 24 deletions.
13 changes: 7 additions & 6 deletions .travis.yml
Expand Up @@ -38,14 +38,13 @@ matrix:
- php: 7.1
env: EZ_PACKAGES='ezsystems/ezplatform:~1.13.0 ezsystems/ezplatform-xmltext-fieldtype:^1.2 ezsystems/behatbundle:^6.4 netgen/tagsbundle:~2.2' EZ_VERSION=ezplatform EZ_APP_DIR=app EZ_KERNEL=AppKernel CODE_COVERAGE=1 INSTALL_TAGSBUNDLE=1
# latest version currently available of eZPlatform 2
# sensio/generator-bundle is only needed because we run the tests using 'behat' sf env
- php: 7.2
env: EZ_PACKAGES='ezsystems/ezplatform:^2.0 ezsystems/ezplatform-xmltext-fieldtype:^1.3 ezsystems/behatbundle:^6.5 netgen/tagsbundle:~3.0 sensio/generator-bundle' EZ_VERSION=ezplatform EZ_APP_DIR=app EZ_KERNEL=AppKernel CODE_COVERAGE=0 INSTALL_TAGSBUNDLE=1
env: EZ_PACKAGES='ezsystems/ezplatform:^2.0 ezsystems/ezplatform-xmltext-fieldtype:^1.3 ezsystems/behatbundle:^6.5 netgen/tagsbundle:~3.0 sensio/generator-bundle' EZ_VERSION=ezplatform2 EZ_APP_DIR=app EZ_KERNEL=AppKernel CODE_COVERAGE=0 INSTALL_TAGSBUNDLE=1

allow_failures:
# this is failing because of composer running out of memory :-(
- php: 5.6
# @todo to be investigated further... fails with "Error: Class 'Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle' not found". Are we not installing dev packages ?
- php: 7.2

before_install:
# No need for a web server, until we start testing using Selenium
Expand All @@ -67,9 +66,10 @@ install:
- if [ "$XDEBUG_INI" != "" ]; then mv "$XDEBUG_INI" "$XDEBUG_INI.bak"; fi

# We do not rely on the requirements set in composer.json, but install a different eZ version depending on the test matrix

# For the moment, to install eZPlatform, a set of DEV packages have to be allowed; really ugly sed expression to alter composer.json follows
# TODO is this still needed?
- 'if [ "$EZ_VERSION" = "ezplatform" ]; then sed -i ''s/"license": "GPL-2.0",/"license": "GPL-2.0", "minimum-stability": "dev", "prefer-stable": true,/'' composer.json; fi'
- 'if [ "$EZ_VERSION" != "ezpublish" ]; then sed -i ''s/"license": "GPL-2.0",/"license": "GPL-2.0", "minimum-stability": "dev", "prefer-stable": true,/'' composer.json; fi'

# debugging memory problems with composer
#- sudo free -m -t
Expand All @@ -80,6 +80,7 @@ install:

# TODO try enabling swap manually

# try to reduce mem usage by running composer in two steps
- composer require --dev --no-update ${EZ_PACKAGES}
- composer update --dev

Expand All @@ -100,7 +101,7 @@ before_script:
#- php vendor/ezsystems/ezpublish-community/ezpublish/console --env=behat cache:clear --no-debug

# TODO for eZPlatform, do we need to set up SOLR as well ?
#- if [ "$EZ_VERSION" = "ezplatform" ]; then ./vendor/ezsystems/ezplatform-solr-search-engine:bin/.travis/init_solr.sh; fi
#- if [ "$EZ_VERSION" != "ezpublish" ]; then ./vendor/ezsystems/ezplatform-solr-search-engine && bin/.travis/init_solr.sh; fi

script:
# Finally! :-D
Expand All @@ -110,7 +111,7 @@ script:
after_failure:
# Display as much info as we can to help developers
- php -i
#- cat composer.lock
- cat composer.lock

after_script:
# Upload code-coverage to Scrutinizer
Expand Down
45 changes: 45 additions & 0 deletions Tests/ezpublish/config/config_behat_ezplatform2.yml
@@ -0,0 +1,45 @@

# This file will be appended to the equivalent one from eZPlatform distribution
# Used to set up an eZPlatform env from scratch for testing purposes (eg. on Travis)

parameters:
ezpublish.kernel.root_dir: %kernel.root_dir%/../../ezpublish-kernel

doctrine:
dbal:
connections:
default:
driver: pdo_mysql
host: localhost
user: root
dbname: behattestdb
charset: UTF8

ezpublish:
repositories:
behat: ~
siteaccess:
# Available siteaccesses
list:
- behat_site
- behat_site_admin
# Siteaccess groups. Use them to group common settings.
groups:
behat_group: [behat_site, behat_site_admin]
default_siteaccess: behat_site
match:
Map\URI:
behat_site_admin: behat_site_admin
Map\Host:
localhost: behat_site
system:
behat_group:
repository: behat
languages: [eng-GB]
var_dir: var/behat_site

swiftmailer:
disable_delivery: false
spool:
type: file
path: '%kernel.root_dir%/spool'
4 changes: 2 additions & 2 deletions Tests/travis/create-db.sh
Expand Up @@ -15,8 +15,8 @@ mysql -u${DB_USER} ${DB_PWD} -e "CREATE DATABASE ${DB}; GRANT ALL ON ${DB}.* TO
# Create the database from sql files present in either the legacy stack or kernel
if [ "$EZ_VERSION" = "ezpublish-community" ]; then mysql -u${DB_USER} ${DB_PWD} ${DB} < vendor/ezsystems/ezpublish-legacy/kernel/sql/mysql/kernel_schema.sql; fi
if [ "$EZ_VERSION" = "ezpublish-community" ]; then mysql -u${DB_USER} ${DB_PWD} ${DB} < vendor/ezsystems/ezpublish-legacy/kernel/sql/common/cleandata.sql; fi
if [ "$EZ_VERSION" = "ezplatform" ]; then mysql -u${DB_USER} ${DB_PWD} ${DB} < vendor/ezsystems/ezpublish-kernel/data/mysql/schema.sql; fi
if [ "$EZ_VERSION" = "ezplatform" ]; then mysql -u${DB_USER} ${DB_PWD} ${DB} < vendor/ezsystems/ezpublish-kernel/data/cleandata.sql; fi
if [ "$EZ_VERSION" = "ezplatform" -o "$EZ_VERSION" = "ezplatform2" ]; then mysql -u${DB_USER} ${DB_PWD} ${DB} < vendor/ezsystems/ezpublish-kernel/data/mysql/schema.sql; fi
if [ "$EZ_VERSION" = "ezplatform" -o "$EZ_VERSION" = "ezplatform2" ]; then mysql -u${DB_USER} ${DB_PWD} ${DB} < vendor/ezsystems/ezpublish-kernel/data/cleandata.sql; fi

if [ "$INSTALL_TAGSBUNDLE" = "1" ]; then
if [ -f vendor/netgen/tagsbundle/Netgen/TagsBundle/Resources/sql/mysql/schema.sql ]; then
Expand Down
30 changes: 18 additions & 12 deletions Tests/travis/setup-config.sh
Expand Up @@ -5,34 +5,40 @@ EZ_APP_DIR=$2
EZ_KERNEL=$3
INSTALL_TAGSBUNDLE=$4

if [ "$EZ_VERSION" = "ezplatform2" ]; then
APP_DIR=vendor/ezsystems/ezplatform/${EZ_APP_DIR}
else
APP_DIR=vendor/ezsystems/${EZ_VERSION}/${EZ_APP_DIR}
fi

# Set up configuration files:
# eZ5 config files
cp vendor/ezsystems/${EZ_VERSION}/${EZ_APP_DIR}/config/parameters.yml.dist vendor/ezsystems/${EZ_VERSION}/${EZ_APP_DIR}/config/parameters.yml
cat Tests/ezpublish/config/config_behat_${EZ_VERSION}.yml >> vendor/ezsystems/${EZ_VERSION}/${EZ_APP_DIR}/config/config_behat.yml
cp ${APP_DIR}/config/parameters.yml.dist ${APP_DIR}/config/parameters.yml
cat Tests/ezpublish/config/config_behat_${EZ_VERSION}.yml >> ${APP_DIR}/config/config_behat.yml

# Load the migration bundle in the Sf kernel
sed -i 's/$bundles = array(/$bundles = array(new Kaliop\\eZMigrationBundle\\EzMigrationBundle(),/' vendor/ezsystems/${EZ_VERSION}/${EZ_APP_DIR}/${EZ_KERNEL}.php
sed -i 's/$bundles = array(/$bundles = array(new Kaliop\\eZMigrationBundle\\EzMigrationBundle(),/' ${APP_DIR}/${EZ_KERNEL}.php
# And optionally the Netgen tags bundle
if [ "$INSTALL_TAGSBUNDLE" = "1" ]; then
# we have to load netgen tags bundle after the Kernel bundles... hopefully OneupFlysystemBundle will stay there :-)
sed -i 's/OneupFlysystemBundle(),\?/OneupFlysystemBundle(), new Netgen\\TagsBundle\\NetgenTagsBundle(),/' vendor/ezsystems/${EZ_VERSION}/${EZ_APP_DIR}/${EZ_KERNEL}.php
sed -i 's/OneupFlysystemBundle(),\?/OneupFlysystemBundle(), new Netgen\\TagsBundle\\NetgenTagsBundle(),/' ${APP_DIR}/${EZ_KERNEL}.php
fi
# And optionally the EzCoreExtraBundle bundle
# And optionally the EzCoreExtraBundle bundle - not needed any more ?
#if grep -q 'lolautruche/ez-core-extra-bundle' composer.lock; then
# sed -i 's/OneupFlysystemBundle(),\?/OneupFlysystemBundle(), new Lolautruche\\EzCoreExtraBundle\\EzCoreExtraBundle(),/' vendor/ezsystems/${EZ_VERSION}/${EZ_APP_DIR}/${EZ_KERNEL}.php
# sed -i 's/OneupFlysystemBundle(),\?/OneupFlysystemBundle(), new Lolautruche\\EzCoreExtraBundle\\EzCoreExtraBundle(),/' ${APP_DIR}/${EZ_KERNEL}.php
#fi

# For eZPlatform, load the xmltext bundle
if [ "$EZ_VERSION" = "ezplatform" ]; then
if [ "$EZ_VERSION" = "ezplatform" -o "$EZ_VERSION" = "ezplatform2" ]; then
# we have to load netgen tags bundle after the Kernel bundles... hopefully OneupFlysystemBundle will stay there :-)
sed -i 's/AppBundle(),\?/AppBundle(), new EzSystems\\EzPlatformXmlTextFieldTypeBundle\\EzSystemsEzPlatformXmlTextFieldTypeBundle (),/' vendor/ezsystems/${EZ_VERSION}/${EZ_APP_DIR}/${EZ_KERNEL}.php
sed -i 's/AppBundle(),\?/AppBundle(), new EzSystems\\EzPlatformXmlTextFieldTypeBundle\\EzSystemsEzPlatformXmlTextFieldTypeBundle (),/' ${APP_DIR}/${EZ_KERNEL}.php
fi
# Fix the eZ5 autoload configuration for the unexpected directory layout
sed -i "s#'/../vendor/autoload.php'#'/../../../../vendor/autoload.php'#" vendor/ezsystems/${EZ_VERSION}/${EZ_APP_DIR}/autoload.php
sed -i "s#'/../vendor/autoload.php'#'/../../../../vendor/autoload.php'#" ${APP_DIR}/autoload.php

# Generate legacy autoloads
if [ "$EZ_VERSION" != "ezplatform" ]; then cat Tests/ezpublish-legacy/config.php > vendor/ezsystems/ezpublish-legacy/config.php; fi
if [ "$EZ_VERSION" != "ezplatform" ]; then cd vendor/ezsystems/ezpublish-legacy && php bin/php/ezpgenerateautoloads.php && cd ../../..; fi
if [ "$EZ_VERSION" = "ezpublish-community" ]; then cat Tests/ezpublish-legacy/config.php > vendor/ezsystems/ezpublish-legacy/config.php; fi
if [ "$EZ_VERSION" = "ezpublish-community" ]; then cd vendor/ezsystems/ezpublish-legacy && php bin/php/ezpgenerateautoloads.php && cd ../../..; fi

# Fix the phpunit configuration if needed
if [ "$EZ_VERSION" = "ezplatform" ]; then sed -i 's/"vendor\/ezsystems\/ezpublish-community\/ezpublish"/"vendor\/ezsystems\/ezplatform\/app"/' phpunit.xml; fi
if [ "$EZ_VERSION" = "ezplatform" -o "$EZ_VERSION" = "ezplatform2" ]; then sed -i 's/"vendor\/ezsystems\/ezpublish-community\/ezpublish"/"vendor\/ezsystems\/ezplatform\/app"/' phpunit.xml; fi
9 changes: 5 additions & 4 deletions Tests/travis/setup-env.sh
Expand Up @@ -6,8 +6,9 @@ EZ_VERSION=$1

export SYMFONY_ENV=behat

if [ "$EZ_VERSION" = "ezplatform" ]; then
export KERNEL_DIR=vendor/ezsystems/ezplatform/app
else
export KERNEL_DIR=vendor/ezsystems/ezpublish-community/ezpublish
if [ "$EZ_VERSION" = "ezpublish-community" ]; then
export KERNEL_DIR=vendor/ezsystems/ezpublish-community/ezpublish
fi
if [ "$EZ_VERSION" = "ezplatform" -o "$EZ_VERSION" = "ezplatform2" ]; then
export KERNEL_DIR=vendor/ezsystems/ezplatform/app
fi

0 comments on commit fd01545

Please sign in to comment.