Skip to content

Commit

Permalink
improve travis composer installation (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
solverat committed Jul 26, 2019
1 parent 4398a71 commit 5146e78
Showing 1 changed file with 14 additions and 42 deletions.
56 changes: 14 additions & 42 deletions tests/_etc/travis/install
Original file line number Diff line number Diff line change
@@ -1,59 +1,41 @@
#!/usr/bin/env bash
set -e


## include global bundle test configuration

source $TRAVIS_BUILD_DIR/tests/_etc/bundle_configuration


## setup php

phpenv config-add $DACHCOM_BUNDLE_HOME/tests/_etc/config/system/php.ini

phpenv config-add ./tests/_etc/config/system/php.ini

## setup mysql

mysql --version
mysql -e "SET GLOBAL innodb_file_format=Barracuda;"
mysql -e "SET GLOBAL innodb_large_prefix=1;"
mysql -e "CREATE DATABASE dachcom_bundle_test CHARSET=utf8mb4;"


## move bundle temporarily and clean dir in order to install pimcore

mkdir -p $DACHCOM_BUNDLE_HOME/../lib/$DACHCOM_BUNDLE_NAME
mv $DACHCOM_BUNDLE_HOME/{.[!.],}* $DACHCOM_BUNDLE_HOME/../lib/$DACHCOM_BUNDLE_NAME
rm -rf $DACHCOM_BUNDLE_HOME/{.[!.],}*

mkdir -p ../lib/$DACHCOM_BUNDLE_NAME
mv {.[!.],}* ../lib/$DACHCOM_BUNDLE_NAME
rm -rf {.[!.],}*

## clone pimcore

git clone https://github.com/pimcore/skeleton.git $DACHCOM_BUNDLE_HOME
git checkout ${PIMCORE_SKELETON_BRANCH} $DACHCOM_BUNDLE_HOME


## move bundle back into lib/$DACHCOM_BUNDLE_NAME

mv $DACHCOM_BUNDLE_HOME/../lib $DACHCOM_BUNDLE_HOME

mv ../lib .

## copy _etc dir to root dir

cp -r $DACHCOM_BUNDLE_HOME/lib/$DACHCOM_BUNDLE_NAME/tests/_etc/bundle_configuration $DACHCOM_BUNDLE_HOME/bundle_configuration
cp -r $DACHCOM_BUNDLE_HOME/lib/$DACHCOM_BUNDLE_NAME/tests/_etc $DACHCOM_BUNDLE_HOME/_etc
chmod -R +x $DACHCOM_BUNDLE_HOME/_etc

cp -r ./lib/$DACHCOM_BUNDLE_NAME/tests/_etc/bundle_configuration ./bundle_configuration
cp -r ./lib/$DACHCOM_BUNDLE_NAME/tests/_etc ./_etc
chmod -R +x ./_etc

## create download dir

mkdir $DACHCOM_BUNDLE_HOME/lib/$DACHCOM_BUNDLE_NAME/tests/_data/downloads

mkdir ./lib/$DACHCOM_BUNDLE_NAME/tests/_data/downloads

## add config templates

mkdir -p $DACHCOM_BUNDLE_HOME/var/config
cp $DACHCOM_BUNDLE_HOME/_etc/config/system/config.yml app/config/config.yml
mkdir -p ./var/config
cp ./_etc/config/system/config.yml app/config/config.yml
cp app/config/parameters.example.yml app/config/parameters.yml

for K in "${!DACHCOM_INSTALL_CONFIG_FILES[@]}"
Expand All @@ -72,20 +54,10 @@ mv -nv GeoLite2-City.mmdb var/config/
## install composer dependencies
rm composer.lock

COMPOSER_MEMORY_LIMIT=-1 composer require symfony/symfony:$SYMFONY_VERSION phpstan/phpstan:^0.11.1 phpstan/phpstan-symfony:^0.11.0 symplify/easy-coding-standard:^5.4 --no-scripts --no-interaction --no-update
COMPOSER_MEMORY_LIMIT=-1 composer install --no-scripts

## install $DACHCOM_BUNDLE_NAME dependencies
BRANCH_REGEX="^(([[:digit:]]+\.)+[[:digit:]]+)$"
composer config repositories.pimcore-${DACHCOM_BUNDLE_REPO_NAME} '{"type": "path", "url": "./lib/'${DACHCOM_BUNDLE_NAME}'", "options": {"symlink": true}}'

if [[ ${TRAVIS_BRANCH} =~ $BRANCH_REGEX ]]; then
echo "composer require dachcom-digital/${DACHCOM_BUNDLE_REPO_NAME}:${TRAVIS_BRANCH}"
COMPOSER_MEMORY_LIMIT=-1 composer require dachcom-digital/${DACHCOM_BUNDLE_REPO_NAME}:${TRAVIS_BRANCH}
else
echo "composer require dachcom-digital/${DACHCOM_BUNDLE_REPO_NAME}:dev-${TRAVIS_BRANCH}"
COMPOSER_MEMORY_LIMIT=-1 composer require "dachcom-digital/${DACHCOM_BUNDLE_REPO_NAME}:dev-${TRAVIS_BRANCH}#${TRAVIS_COMMIT}"
fi
COMPOSER_MEMORY_LIMIT=-1 composer install --no-scripts
COMPOSER_MEMORY_LIMIT=-1 composer require symfony/symfony:$SYMFONY_VERSION phpstan/phpstan:^0.11.1 phpstan/phpstan-symfony:^0.11.0 symplify/easy-coding-standard:^5.4 dachcom-digital/${DACHCOM_BUNDLE_REPO_NAME} @dev

## clear cache

rm -rf var/cache

0 comments on commit 5146e78

Please sign in to comment.