From c27c9de5b862edaf17ff1ee940bae7cf0b922724 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Thu, 28 Aug 2014 12:14:05 +0200 Subject: [PATCH 1/8] check if sphinx is installed --- tests/unit/data/travis/sphinx-setup.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/unit/data/travis/sphinx-setup.sh b/tests/unit/data/travis/sphinx-setup.sh index ba09595cea..2c097aa19c 100755 --- a/tests/unit/data/travis/sphinx-setup.sh +++ b/tests/unit/data/travis/sphinx-setup.sh @@ -2,6 +2,8 @@ SCRIPT=$(readlink -f "$0") CWD=$(dirname "$SCRIPT") +sudo dpkg -l |grep sphinx + # log files sudo mkdir /var/log/sphinx sudo touch /var/log/sphinx/searchd.log From 326d26af0667e6651e8191d7ec3c83473016c990 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Thu, 28 Aug 2014 13:49:36 +0200 Subject: [PATCH 2/8] install cubrid DB not using sudo and use travis cache --- .gitignore | 2 + .travis.yml | 12 +++++ tests/unit/data/travis/cubrid-setup.sh | 68 ++++++++++++++++++++++---- 3 files changed, 73 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index fb5029b719..657cc74ae9 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,8 @@ Thumbs.db # composer vendor dir /vendor +# cubrid install dir +/cubrid # composer itself is not needed composer.phar diff --git a/.travis.yml b/.travis.yml index 6657fab283..a373965c63 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,9 @@ php: - hhvm - hhvm-nightly +env: + - CUBRID_VERSION=9.3.0/CUBRID-9.3.0.0206 CUBRID_PDO_VERSION=9.2.0.0001 + # run build against hhvm but allow them to fail # http://docs.travis-ci.com/user/build-configuration/#Rows-That-are-Allowed-To-Fail matrix: @@ -21,6 +24,15 @@ services: - elasticsearch - mongodb +# faster builds on new travis setup not using sudo +sudo: false + +# cache vendor dirs +cache: + directories: + - cubrid + - vendor + # try running against postgres 9.3 addons: postgresql: "9.3" diff --git a/tests/unit/data/travis/cubrid-setup.sh b/tests/unit/data/travis/cubrid-setup.sh index 13b0a4ba8e..1eaa257c32 100755 --- a/tests/unit/data/travis/cubrid-setup.sh +++ b/tests/unit/data/travis/cubrid-setup.sh @@ -7,18 +7,64 @@ if (php --version | grep -i HipHop > /dev/null); then exit 0 fi +CWD=$(pwd) + # cubrid dbms -echo 'yes' | sudo add-apt-repository ppa:cubrid/cubrid -sudo apt-get update -sudo apt-get install cubrid -/etc/profile.d/cubrid.sh -sudo apt-get install cubrid-demodb +mkdir -p cubrid/$CUBRID_VERSION +cd cubrid +if (test -f $CUBRID_VERSION-linux.x86_64.tar.gz); then + echo "CUBRID is already installed" +else + wget http://ftp.cubrid.org/CUBRID_Engine/$CUBRID_VERSION-linux.x86_64.tar.gz -O $CUBRID_VERSION-linux.x86_64.tar.gz +fi + + cd $CUBRID_VERSION + tar xzvf ../../$CUBRID_VERSION-linux.x86_64.tar.gz + cd ../.. + + +# setting cubrid env +CUBRID=$CWD/cubrid/$CUBRID_VERSION/CUBRID +CUBRID_DATABASES=$CUBRID/databases +CUBRID_LANG=en_US + +ld_lib_path=`printenv LD_LIBRARY_PATH` +if [ "$ld_lib_path" = "" ] +then + LD_LIBRARY_PATH=$CUBRID/lib +else + LD_LIBRARY_PATH=$CUBRID/lib:$LD_LIBRARY_PATH +fi + +SHLIB_PATH=$LD_LIBRARY_PATH +LIBPATH=$LD_LIBRARY_PATH +PATH=$CUBRID/bin:$CUBRID/cubridmanager:$PATH + +export CUBRID +export CUBRID_DATABASES +export CUBRID_LANG +export LD_LIBRARY_PATH +export SHLIB_PATH +export LIBPATH +export PATH + +# start cubrid +cubrid service start +# create and start the demo db +$CUBRID/demo/make_cubrid_demo.sh +cubrid server start demodb + +echo "" +echo "Installed CUBRID $CUBRID_VERSION" +echo "" # cubrid pdo install_pdo_cubrid() { - wget "http://pecl.php.net/get/PDO_CUBRID-9.2.0.0001.tgz" && - tar -zxf "PDO_CUBRID-9.2.0.0001.tgz" && - sh -c "cd PDO_CUBRID-9.2.0.0001 && phpize && ./configure && make && sudo make install" + if (test "! -f PDO_CUBRID-$CUBRID_PDO_VERSION.tgz"); then + wget "http://pecl.php.net/get/PDO_CUBRID-$CUBRID_PDO_VERSION.tgz" + fi + tar -zxf "PDO_CUBRID-$CUBRID_PDO_VERSION.tgz" + sh -c "cd PDO_CUBRID-$CUBRID_PDO_VERSION && phpize && ./configure && make && sudo make install" echo "extension=pdo_cubrid.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini @@ -27,4 +73,8 @@ install_pdo_cubrid() { install_pdo_cubrid > ~/pdo_cubrid.log || ( echo "=== PDO CUBRID BUILD FAILED ==="; cat ~/pdo_cubrid.log ) -echo "Installed CUBRID `dpkg -s cubrid |grep Version`" +echo "" +echo "Installed CUBRID PDO $CUBRID_PDO_VERSION" +echo "" + +cd .. From 83f5f49469b45193e1e6a8a5d55d31d62d1ac5ea Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Thu, 28 Aug 2014 14:01:29 +0200 Subject: [PATCH 3/8] try mongodb without sudo --- tests/unit/data/travis/mongodb-setup.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/unit/data/travis/mongodb-setup.sh b/tests/unit/data/travis/mongodb-setup.sh index b79a897888..fb2e80dbfc 100755 --- a/tests/unit/data/travis/mongodb-setup.sh +++ b/tests/unit/data/travis/mongodb-setup.sh @@ -2,10 +2,12 @@ # # install mongodb -echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini -sudo sh -c 'echo "setParameter = textSearchEnabled=true" >> /etc/mongodb.conf' -cat /etc/mongodb.conf - mongod --version -sudo service mongodb restart +echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini + +# version 2.6 has this enabled by default +#sudo sh -c 'echo "setParameter = textSearchEnabled=true" >> /etc/mongodb.conf' +cat /etc/mongodb.conf + +#sudo service mongodb restart From 9174358f7e64a896f421384e77ac89f08dc8e9ba Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Thu, 28 Aug 2014 14:17:15 +0200 Subject: [PATCH 4/8] fixed sphinx setup --- tests/unit/data/travis/sphinx-setup.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/unit/data/travis/sphinx-setup.sh b/tests/unit/data/travis/sphinx-setup.sh index 2c097aa19c..83fd7c6e15 100755 --- a/tests/unit/data/travis/sphinx-setup.sh +++ b/tests/unit/data/travis/sphinx-setup.sh @@ -2,21 +2,22 @@ SCRIPT=$(readlink -f "$0") CWD=$(dirname "$SCRIPT") -sudo dpkg -l |grep sphinx +# work around https://github.com/travis-ci/travis-ci/issues/2728 +PATH=$PATH:/usr/local/sphinx-2.1.9/bin # log files -sudo mkdir /var/log/sphinx -sudo touch /var/log/sphinx/searchd.log -sudo touch /var/log/sphinx/query.log -sudo chmod -R 777 /var/log/sphinx # ugly (for travis) +#sudo mkdir /var/log/sphinx +#sudo touch /var/log/sphinx/searchd.log +#sudo touch /var/log/sphinx/query.log +#sudo chmod -R 777 /var/log/sphinx # ugly (for travis) # spl dir -sudo mkdir /var/lib/sphinx -sudo chmod 777 /var/lib/sphinx # ugly (for travis) +#sudo mkdir /var/lib/sphinx +#sudo chmod 777 /var/lib/sphinx # ugly (for travis) # run dir pid -sudo mkdir /var/run/sphinx -sudo chmod 777 /var/run/sphinx # ugly (for travis) +#sudo mkdir /var/run/sphinx +#sudo chmod 777 /var/run/sphinx # ugly (for travis) # Setup source database mysql -D yiitest -u travis < $CWD/../sphinx/source.sql From e648aef799c23d75696c4972998baef8c3df0ec6 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Thu, 28 Aug 2014 14:43:49 +0200 Subject: [PATCH 5/8] sphinx setup without sudo --- tests/unit/data/sphinx/sphinx.conf | 16 ++++++++-------- tests/unit/data/travis/cubrid-setup.sh | 4 ++-- tests/unit/data/travis/sphinx-setup.sh | 4 ++++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/tests/unit/data/sphinx/sphinx.conf b/tests/unit/data/sphinx/sphinx.conf index 909fdbd15d..583bcc5d8e 100644 --- a/tests/unit/data/sphinx/sphinx.conf +++ b/tests/unit/data/sphinx/sphinx.conf @@ -68,7 +68,7 @@ source yii2_test_item_delta_src : yii2_test_item_src index yii2_test_article_index { source = yii2_test_article_src - path = /var/lib/sphinx/yii2_test_article + path = SPHINX_BASE_DIR/yii2_test_article docinfo = extern charset_type = sbcs } @@ -77,7 +77,7 @@ index yii2_test_article_index index yii2_test_item_index { source = yii2_test_item_src - path = /var/lib/sphinx/yii2_test_item + path = SPHINX_BASE_DIR/yii2_test_item docinfo = extern charset_type = sbcs } @@ -86,14 +86,14 @@ index yii2_test_item_index index yii2_test_item_delta_index : yii2_test_item_index { source = yii2_test_item_delta_src - path = /var/lib/sphinx/yii2_test_item_delta + path = SPHINX_BASE_DIR/yii2_test_item_delta } index yii2_test_rt_index { type = rt - path = /var/lib/sphinx/yii2_test_rt + path = SPHINX_BASE_DIR/yii2_test_rt rt_field = title rt_field = content rt_attr_uint = type_id @@ -118,15 +118,15 @@ searchd { listen = 127.0.0.1:9312 listen = 9306:mysql41 - log = /var/log/sphinx/searchd.log - query_log = /var/log/sphinx/query.log + log = SPHINX_BASE_DIR/searchd.log + query_log = SPHINX_BASE_DIR/query.log read_timeout = 5 max_children = 30 - pid_file = /var/run/sphinx/searchd.pid + pid_file = SPHINX_BASE_DIR/searchd.pid max_matches = 1000 seamless_rotate = 1 preopen_indexes = 1 unlink_old = 1 workers = threads # for RT to work - binlog_path = /var/lib/sphinx + binlog_path = SPHINX_BASE_DIR } diff --git a/tests/unit/data/travis/cubrid-setup.sh b/tests/unit/data/travis/cubrid-setup.sh index 1eaa257c32..dfcbfce2a7 100755 --- a/tests/unit/data/travis/cubrid-setup.sh +++ b/tests/unit/data/travis/cubrid-setup.sh @@ -19,7 +19,7 @@ else fi cd $CUBRID_VERSION - tar xzvf ../../$CUBRID_VERSION-linux.x86_64.tar.gz + tar xzf ../../$CUBRID_VERSION-linux.x86_64.tar.gz cd ../.. @@ -64,7 +64,7 @@ install_pdo_cubrid() { wget "http://pecl.php.net/get/PDO_CUBRID-$CUBRID_PDO_VERSION.tgz" fi tar -zxf "PDO_CUBRID-$CUBRID_PDO_VERSION.tgz" - sh -c "cd PDO_CUBRID-$CUBRID_PDO_VERSION && phpize && ./configure && make && sudo make install" + sh -c "cd PDO_CUBRID-$CUBRID_PDO_VERSION && phpize && ./configure --prefix=$CWD/cubrid/PDO_CUBRID-$CUBRID_PDO_VERSION && make && sudo make install" echo "extension=pdo_cubrid.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini diff --git a/tests/unit/data/travis/sphinx-setup.sh b/tests/unit/data/travis/sphinx-setup.sh index 83fd7c6e15..09ddf57379 100755 --- a/tests/unit/data/travis/sphinx-setup.sh +++ b/tests/unit/data/travis/sphinx-setup.sh @@ -5,6 +5,10 @@ CWD=$(dirname "$SCRIPT") # work around https://github.com/travis-ci/travis-ci/issues/2728 PATH=$PATH:/usr/local/sphinx-2.1.9/bin +mkdir -p sphinx + +sed -i s\~SPHINX_BASE_DIR~$PWD/sphinx~g $CWD/../sphinx/sphinx.conf + # log files #sudo mkdir /var/log/sphinx #sudo touch /var/log/sphinx/searchd.log From 68323f6428497a05b392b5fa595f155f3609692e Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Thu, 28 Aug 2014 14:49:32 +0200 Subject: [PATCH 6/8] fixed cubrid PDO --- tests/unit/data/travis/cubrid-setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/data/travis/cubrid-setup.sh b/tests/unit/data/travis/cubrid-setup.sh index dfcbfce2a7..30b32156ea 100755 --- a/tests/unit/data/travis/cubrid-setup.sh +++ b/tests/unit/data/travis/cubrid-setup.sh @@ -64,9 +64,9 @@ install_pdo_cubrid() { wget "http://pecl.php.net/get/PDO_CUBRID-$CUBRID_PDO_VERSION.tgz" fi tar -zxf "PDO_CUBRID-$CUBRID_PDO_VERSION.tgz" - sh -c "cd PDO_CUBRID-$CUBRID_PDO_VERSION && phpize && ./configure --prefix=$CWD/cubrid/PDO_CUBRID-$CUBRID_PDO_VERSION && make && sudo make install" + sh -c "cd PDO_CUBRID-$CUBRID_PDO_VERSION && phpize && ./configure --prefix=$CWD/cubrid/PDO_CUBRID-$CUBRID_PDO_VERSION && make" - echo "extension=pdo_cubrid.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini + echo "extension=$CWD/cubrid/PDO_CUBRID-$CUBRID_PDO_VERSION/modules/pdo_cubrid.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini return $? } From 63543c0a81240748253bea95decd36ca4c16740d Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Thu, 28 Aug 2014 15:01:55 +0200 Subject: [PATCH 7/8] enable mongo text search --- tests/unit/data/travis/mongodb-setup.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/unit/data/travis/mongodb-setup.sh b/tests/unit/data/travis/mongodb-setup.sh index fb2e80dbfc..1bcf100c6f 100755 --- a/tests/unit/data/travis/mongodb-setup.sh +++ b/tests/unit/data/travis/mongodb-setup.sh @@ -6,8 +6,7 @@ mongod --version echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini -# version 2.6 has this enabled by default -#sudo sh -c 'echo "setParameter = textSearchEnabled=true" >> /etc/mongodb.conf' -cat /etc/mongodb.conf +# enable text search +mongo --eval 'db.adminCommand( { setParameter: true, textSearchEnabled : true})' -#sudo service mongodb restart +cat /etc/mongodb.conf From c4dffa0f1fb1f3e0a5f6e811d7caaecaddd908d3 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Thu, 28 Aug 2014 15:08:37 +0200 Subject: [PATCH 8/8] simplified travis installation --- .travis.yml | 4 +--- tests/unit/data/travis/cubrid-setup.sh | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index a373965c63..d3a51dfec8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,9 +47,7 @@ install: - tests/unit/data/travis/memcache-setup.sh - tests/unit/data/travis/cubrid-setup.sh # codeception - - composer global require "codeception/codeception=2.0.*" - - composer global require "codeception/specify=*" - - composer global require "codeception/verify=*" + - composer global require "codeception/codeception=2.0.*" "codeception/specify=*" "codeception/verify=*" # basic and advanced application: - tests/unit/data/travis/setup-apps.sh diff --git a/tests/unit/data/travis/cubrid-setup.sh b/tests/unit/data/travis/cubrid-setup.sh index 30b32156ea..67b4bf26d4 100755 --- a/tests/unit/data/travis/cubrid-setup.sh +++ b/tests/unit/data/travis/cubrid-setup.sh @@ -60,8 +60,8 @@ echo "" # cubrid pdo install_pdo_cubrid() { - if (test "! -f PDO_CUBRID-$CUBRID_PDO_VERSION.tgz"); then - wget "http://pecl.php.net/get/PDO_CUBRID-$CUBRID_PDO_VERSION.tgz" + if (test "! (-f PDO_CUBRID-$CUBRID_PDO_VERSION.tgz)"); then + wget "http://pecl.php.net/get/PDO_CUBRID-$CUBRID_PDO_VERSION.tgz" -O PDO_CUBRID-$CUBRID_PDO_VERSION.tgz fi tar -zxf "PDO_CUBRID-$CUBRID_PDO_VERSION.tgz" sh -c "cd PDO_CUBRID-$CUBRID_PDO_VERSION && phpize && ./configure --prefix=$CWD/cubrid/PDO_CUBRID-$CUBRID_PDO_VERSION && make"