mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
[Travis] Simplified build configuration, new cache management, moved build directory, made javascripts more fail-safe
This commit is contained in:
parent
89eb4f4bed
commit
b526cb6e89
14 changed files with 67 additions and 69 deletions
27
.travis.yml
27
.travis.yml
|
|
@ -3,7 +3,7 @@ language: php
|
|||
env:
|
||||
global:
|
||||
- SYLIUS_CACHE_DIR=$HOME/.sylius-cache
|
||||
- SYLIUS_BUILD_DIR=etc/travis/build-output
|
||||
- SYLIUS_BUILD_DIR=etc/build
|
||||
|
||||
cache:
|
||||
directories:
|
||||
|
|
@ -32,21 +32,22 @@ matrix:
|
|||
before_install:
|
||||
- mkdir -p $SYLIUS_CACHE_DIR
|
||||
|
||||
- phpenv config-rm xdebug.ini || true
|
||||
|
||||
- etc/travis/prepare-memcached-extension
|
||||
|
||||
- phpenv config-add etc/travis/before-install-php.ini
|
||||
|
||||
- composer self-update
|
||||
|
||||
- if [ $TRAVIS_PHP_VERSION == "7.0" ]; then etc/travis/prepare/prepare-php7-memcached; fi
|
||||
- if [ $TRAVIS_PHP_VERSION != "7.0" ]; then etc/travis/prepare/prepare-mongodb; fi
|
||||
|
||||
- cat etc/travis/prepare/opcache.ini >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||
|
||||
- echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||
- echo "" > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
|
||||
- echo "memory_limit=4096M" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
|
||||
|
||||
- etc/travis/prepare-composer-doctrine-mongodb-odm
|
||||
- composer install --no-interaction --prefer-dist --no-scripts
|
||||
|
||||
- composer run-script travis-build --no-interaction
|
||||
|
||||
before_script:
|
||||
- phpenv config-add etc/travis/before-install-php.ini
|
||||
|
||||
- app/console doctrine:database:create --env=test_cached
|
||||
|
||||
- app/console cache:warmup --env=test_cached --no-debug
|
||||
|
|
@ -61,7 +62,11 @@ before_script:
|
|||
- php -i
|
||||
|
||||
script:
|
||||
- etc/travis/run-tests default
|
||||
- bin/phpspec run -f dot
|
||||
- bin/behat --strict -f progress -p cached
|
||||
|
||||
- etc/travis/prepare-javascript
|
||||
- bin/behat --strict -f progress -p javascript_cached || bin/behat --strict -f progress -p javascript_cached --rerun
|
||||
|
||||
before_cache:
|
||||
- yes 'Y' | rm -fr vendor/symfony-cmf/create-bundle/Resources/public/vendor/*
|
||||
|
|
|
|||
5
etc/travis/before-install-php.ini
Normal file
5
etc/travis/before-install-php.ini
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
; Miscellaneous
|
||||
memory_limit = 4096M
|
||||
|
||||
; Extensions
|
||||
extension = memcached.so
|
||||
|
|
@ -8,4 +8,4 @@ opcache.max_accelerated_files = 32531
|
|||
opcache.interned_strings_buffer = 8
|
||||
opcache.validate_timestamps = 0
|
||||
opcache.save_comments = 1
|
||||
opcache.fast_shutdown = 0
|
||||
opcache.fast_shutdown = 0 ; switching on causes "zend_mm_heap corrupted" errors
|
||||
0
etc/travis/prepare/mongodb/1-before → etc/travis/mongodb/1-before
Executable file → Normal file
0
etc/travis/prepare/mongodb/1-before → etc/travis/mongodb/1-before
Executable file → Normal file
|
|
@ -12,7 +12,7 @@ function main
|
|||
if is_cache_fresh "$UNIQUE_KEY"; then
|
||||
restore_composer_lock_from_cache $UNIQUE_KEY
|
||||
else
|
||||
rebuild_cache_hook $1
|
||||
rebuild_cache_hook $1 $UNIQUE_KEY
|
||||
store_composer_lock_in_cache $UNIQUE_KEY
|
||||
fi
|
||||
|
||||
|
|
@ -40,14 +40,23 @@ function restore_composer_lock_from_cache
|
|||
function is_cache_fresh
|
||||
{
|
||||
if [ -f "$SYLIUS_CACHE_DIR/composer-$1.lock" ] \
|
||||
&& [ -f "$SYLIUS_CACHE_DIR/composer-$1.json.md5sum" ]; then
|
||||
current_md5sum=`file_md5sum composer.json`
|
||||
previous_md5sum=`cat $SYLIUS_CACHE_DIR/composer-$1.json.md5sum`
|
||||
&& [ -f "$SYLIUS_CACHE_DIR/composer-$1.json.md5sum" ] \
|
||||
&& [ -f "$SYLIUS_CACHE_DIR/composer-$1.lock.md5sum" ]; then
|
||||
current_json_md5sum=`file_md5sum composer.json`
|
||||
previous_json_md5sum=`cat $SYLIUS_CACHE_DIR/composer-$1.json.md5sum`
|
||||
|
||||
current_lock_md5sum=`file_md5sum composer.lock`
|
||||
previous_lock_md5sum=`cat $SYLIUS_CACHE_DIR/composer-$1.lock.md5sum`
|
||||
|
||||
echo "Found previous cache"
|
||||
echo "Previous composer.json md5sum: $current_md5sum"
|
||||
echo "Current composer.json md5sum: $previous_md5sum"
|
||||
if [ $current_md5sum = $previous_md5sum ]; then
|
||||
|
||||
echo "Previous composer.json md5sum: $current_json_md5sum"
|
||||
echo "Current composer.json md5sum: $previous_json_md5sum"
|
||||
|
||||
echo "Previous composer.lock md5sum: $current_lock_md5sum"
|
||||
echo "Current composer.lock md5sum: $previous_lock_md5sum"
|
||||
|
||||
if [ $current_json_md5sum = $previous_json_md5sum ] && [ $current_lock_md5sum = $previous_lock_md5sum ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
|
|
@ -81,6 +90,8 @@ function before_hook
|
|||
# Argument 1: Dir with scripts
|
||||
function rebuild_cache_hook
|
||||
{
|
||||
file_md5sum composer.lock > $SYLIUS_CACHE_DIR/composer-$2.lock.md5sum
|
||||
|
||||
if [ -f "$1/2-rebuild-cache" ]; then
|
||||
echo "Executing rebuild_cache_hook"
|
||||
bash "$1/2-rebuild-cache"
|
||||
7
etc/travis/prepare-composer-doctrine-mongodb-odm
Executable file
7
etc/travis/prepare-composer-doctrine-mongodb-odm
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ $TRAVIS_PHP_VERSION == "7.0" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
bash etc/travis/prepare-cached-composer etc/travis/mongodb
|
||||
|
|
@ -17,10 +17,8 @@ fi
|
|||
# Running Selenium with ChromeDriver
|
||||
java -jar $SYLIUS_CACHE_DIR/selenium.jar -Dwebdriver.chrome.driver=$SYLIUS_CACHE_DIR/chromedriver > $SYLIUS_BUILD_DIR/selenium.log 2>&1 &
|
||||
|
||||
vendor/lakion/mink-debug-extension/travis/tools/wait-for-port 9515 # Chromedriver port
|
||||
vendor/lakion/mink-debug-extension/travis/tools/wait-for-port 4444 # Selenium2 port
|
||||
|
||||
# Running webserver
|
||||
app/console server:run 127.0.0.1:8080 --env=test_cached --router=app/config/router_test_cached.php --no-debug > $SYLIUS_BUILD_DIR/webserver.log 2>&1 &
|
||||
|
||||
vendor/lakion/mink-debug-extension/travis/tools/wait-for-port 8080 # Webserver port
|
||||
# Not the best solution, but it works! :)
|
||||
sleep 3
|
||||
18
etc/travis/prepare-memcached-extension
Executable file
18
etc/travis/prepare-memcached-extension
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ $TRAVIS_PHP_VERSION != "7.0" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -f $SYLIUS_CACHE_DIR/memcached.so ]; then
|
||||
git clone -b php7 https://github.com/php-memcached-dev/php-memcached.git php-memcached
|
||||
cd php-memcached
|
||||
|
||||
phpize
|
||||
./configure
|
||||
make
|
||||
|
||||
cp modules/memcached.so $SYLIUS_CACHE_DIR
|
||||
fi
|
||||
|
||||
cp $SYLIUS_CACHE_DIR/memcached.so `php -i | grep extensions | awk '{ print $5 }'`
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
bash etc/travis/prepare/prepare-cached-composer etc/travis/prepare/mongodb
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
git clone -b php7 https://github.com/php-memcached-dev/php-memcached.git php-memcached
|
||||
cd php-memcached
|
||||
|
||||
phpize
|
||||
./configure
|
||||
make
|
||||
|
||||
cp modules/memcached.so `php -i | grep extensions | awk '{ print $5 }'`
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
EXIT_STATUS=0
|
||||
|
||||
IFS=$'\n'
|
||||
|
||||
echo "Date and time (before running tests): `date`"
|
||||
|
||||
for command in `cat $(dirname "$0")/suites/suite-$1`
|
||||
do
|
||||
if [ `echo "$command" | grep "^\s*#"` ]
|
||||
then
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "----------------------------------------------------------------------------"
|
||||
echo "Date and time: `date`"
|
||||
echo "Running: $command"
|
||||
echo "$command" | xargs -0 /bin/bash -c || EXIT_STATUS=$?
|
||||
echo ""
|
||||
done
|
||||
|
||||
echo "Date and time (after running tests): `date`"
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#!/bin/bash
|
||||
bin/phpspec run -f dot
|
||||
|
||||
bin/behat --strict -f progress -p cached
|
||||
|
||||
etc/travis/prepare/prepare-javascript
|
||||
|
||||
bin/behat --strict -f progress -p javascript_cached
|
||||
Loading…
Add table
Reference in a new issue