#!/bin/bash # * The way .travis.yml is fed to the command controller is idiotic - it # makes using multiline `bash -c` statements impossible. Therefore to # aid readability (our travis logic is rather complex), the bulk of # functionality is moved to a script. More about the problem here: # https://github.com/travis-ci/travis-ci/issues/497 set -e if [[ "$TRAVIS" != "true" ]] ; then echo "Running this script makes no sense outside of travis-ci" exit 1 fi # # Current dir is the root of the DBIC checkout (make sure to # come back there if moving around before end of this script) # # envvars available for us: # # NUMTHREADS = { number} # dynamically determined amount of threads we want to run on this # smoker concurrently # # CLEANTEST = [ true | false ] # controls whether we simulate a "user-side" install experience # that is - no author deps and no M::I installation # # BREWVER = { tripple dotted perl version, e.g. 5.8.3 } # brew a custom perl version such and such # # BREWOPTS = { string to be fed unquoted to perlbrew, e.g. -Duseithreads } # build options for perlbrew # if [[ -n "$BREWVER" ]] ; then # if this is not master and not a smoke/ branch - cancel all testing if [[ "$TRAVIS_BRANCH" =~ "topic/" ]]; then export SHORT_CIRCUIT_SMOKE=1 sleep 20 # give the console time to attach, otherwise it hangs return # this is like an `exit 0` in sourcing fi perlbrew install --as $BREWVER --notest $BREWOPTS -j $NUMTHREADS perl-$BREWVER perlbrew use $BREWVER fi export PERL_MM_USE_DEFAULT=1 PERL_MM_NONINTERACTIVE=1 PERL_AUTOINSTALL_PREFER_CPAN=1 export PERL_CPANM_OPT="$( echo $PERL_CPANM_OPT | sed 's/--skip-satisfied//' )" installdeps() { if [[ -z "$@" ]] ; then return; fi # The reason we do things so "non-interactively" is that xargs -P will have the # latest cpanm instance overwrite the buildlog. There seems to be no way to # specify a custom buildlog, hence we just collect the verbose output # and display it in case of failure echo -n "Installing $@... " if ! OUT=$( echo "$@" | xargs -n 1 -P $NUMTHREADS cpanm --verbose --no-interactive --notest --no-man-pages 2>&1 ) ; then EX=$? echo "FAILED !!!" echo "$OUT" exit $? else echo "done." fi } # Install *hard dep* modules that typically appear in more than one dep # # *NEVER* add optional depenencies here - will make CLEANTEST=true smokes useless # # do it in several passes to minimize amount of cross-deps installing multiple # times, and to avoid module re-architecture breaking another install # (e.g. once Carp is upgraded there's no more Carp::Heavy) # installdeps $(cpanm --notest --quiet --showdeps Module::Build) installdeps Test::Exception Test::Fatal Module::Runtime Carp installdeps Sub::Name multidimensional namespace::clean Class::XSAccessor MRO::Compat installdeps DBI Moo Class::Accessor::Grouped # configure CPAN.pm - older versions get tickled by M::AI and # go into an endless loop when trying to autoconf themselves # we are not *supposed* to actually use it, this is just a # precaution perl -e ' require CPAN; require CPAN::FirstTime; *CPAN::FirstTime::conf_sites = sub {}; CPAN::Config->load; $CPAN::Config->{urllist} = [ "http://cpan.cpantesters.org/" ]; CPAN::Config->commit; ' &> /dev/null if [[ "$CLEANTEST" = "true" ]]; then # get the last inc/ off cpan - we will get rid of MI # soon enough, but till then this will do # the point is to have a *really* clean perl (the ones # we build are guaranteed to be clean, without side # effects from travis preinstalls) # # FIXME - not yet implemented - not sure how to reliably # feed to wget this location: http://cpansearch.perl.org/src/GETTY/DBIx-Class-0.08204/inc/ echo TODOOOO - M::I is not supposed to be installed here - this test is useless now installdeps Module::Install else # we will be running all tests - preinstall MOAR stuff, run basic tests using SQLT # and set up whatever databases necessary installdeps Module::Install DateTime::Format::Strptime MooseX::Types JSON::Any Class::DBI export DBICTEST_SQLT_DEPLOY=1 ### apt-get invocation - faster to grab everything at once # # FIXME these debconf lines should automate the firebird config but do not :((( sudo bash -c 'echo -e "firebird2.5-super\tshared/firebird/enabled\tboolean\ttrue" | debconf-set-selections' sudo bash -c 'echo -e "firebird2.5-super\tshared/firebird/sysdba_password/new_password\tpassword\t123" | debconf-set-selections' sudo apt-get install -y memcached firebird2.5-super firebird2.5-dev expect ### memcached export DBICTEST_MEMCACHED=127.0.0.1:11211 ### mysql mysql -e 'create database dbic_test;' export DBICTEST_MYSQL_DSN='dbi:mysql:database=dbic_test;host=127.0.0.1' export DBICTEST_MYSQL_USER=root ### pg psql -c 'create database dbic_test;' -U postgres export DBICTEST_PG_DSN='dbi:Pg:database=dbic_test;host=127.0.0.1' export DBICTEST_PG_USER=postgres ### firebird # poor man's deb config echo -n "Re-configuring firebird... " if ! OUT=$( sync DEBIAN_FRONTEND=text sudo expect -c ' spawn dpkg-reconfigure --frontend=text firebird2.5-super expect "Enable Firebird server?" send "\177\177\177\177yes\r" expect "Password for SYSDBA" send "123\r" sleep 1 wait sleep 1 ' # restart the server for good measure sudo /etc/init.d/firebird2.5-super stop || true sudo /etc/init.d/firebird2.5-super start ) ; then EX=$? echo "FAILED !!!" echo "$OUT" exit $? else echo "done." fi # creating testdb sudo isql-fb -u sysdba -p 123 <<< "CREATE DATABASE '/var/lib/firebird/2.5/data/dbic_test.fdb';" # the official version is full of 5.10-isms, but works perfectly fine on 5.8 # pull in our patched copy git clone https://github.com/dbsrgits/perl-dbd-firebird-5.8.git ~/dbd-firebird # the official version is very much outdated and does not compile on 5.14+ # use this rather updated source tree (needs to go to PAUSE): # https://github.com/pilcrow/perl-dbd-interbase git clone https://github.com/dbsrgits/perl-dbd-interbase ~/dbd-interbase installdeps ~/dbd-interbase/ ~/dbd-firebird/ export DBICTEST_FIREBIRD_DSN=dbi:Firebird:dbname=/var/lib/firebird/2.5/data/dbic_test.fdb export DBICTEST_FIREBIRD_USER=SYSDBA export DBICTEST_FIREBIRD_PASS=123 export DBICTEST_FIREBIRD_INTERBASE_DSN=dbi:InterBase:dbname=/var/lib/firebird/2.5/data/dbic_test.fdb export DBICTEST_FIREBIRD_INTERBASE_USER=SYSDBA export DBICTEST_FIREBIRD_INTERBASE_PASS=123 ### oracle # FIXME: todo #DBICTEST_ORA_DSN=dbi:Oracle:host=localhost;sid=XE #DBICTEST_ORA_USER=dbic_test #DBICTEST_ORA_PASS=123 #DBICTEST_ORA_EXTRAUSER_DSN=dbi:Oracle:host=localhost;sid=XE #DBICTEST_ORA_EXTRAUSER_USER=dbic_test_extra #DBICTEST_ORA_EXTRAUSER_PASS=123 #ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client fi # install the rest perl Makefile.PL installdeps $(make listalldeps) # announce what are we running perl -V echo "Using $NUMTHREADS Travis-CI concurrent processes" # make sure we got everything we need perl Makefile.PL &> /dev/null if [[ -n "$(make listdeps)" ]] ; then echo "Not all deps installed - something went wrong :(" make listdeps exit 1 fi