3 # * The way .travis.yml is fed to the command controller is idiotic - it
4 # makes using multiline `bash -c` statements impossible. Therefore to
5 # aid readability (our travis logic is rather complex), the bulk of
6 # functionality is moved to a script. More about the problem here:
7 # https://github.com/travis-ci/travis-ci/issues/497
11 if [[ "$TRAVIS" != "true" ]] ; then
12 echo "Running this script makes no sense outside of travis-ci"
17 # Current dir is the root of the DBIC checkout (make sure to
18 # come back there if moving around before end of this script)
20 # envvars available for us:
22 # NUMTHREADS = { number}
23 # dynamically determined amount of threads we want to run on this
26 # CLEANTEST = [ true | false ]
27 # controls whether we simulate a "user-side" install experience
28 # that is - no author deps and no M::I installation
30 # BREWVER = { tripple dotted perl version, e.g. 5.8.3 }
31 # brew a custom perl version such and such
33 # BREWOPTS = { string to be fed unquoted to perlbrew, e.g. -Duseithreads }
34 # build options for perlbrew
37 if [[ -n "$BREWVER" ]] ; then
38 # if this is not master and not a smoke/ branch - cancel all testing
39 if [[ "$TRAVIS_BRANCH" =~ "topic/" ]]; then
40 export SHORT_CIRCUIT_SMOKE=1
41 return # this is like an `exit 0` in sourcing
44 perlbrew install --as $BREWVER --notest $BREWOPTS -j $NUMTHREADS perl-$BREWVER
48 export PERL_MM_USE_DEFAULT=1 PERL_MM_NONINTERACTIVE=1 PERL_AUTOINSTALL_PREFER_CPAN=1
49 export PERL_CPANM_OPT="$( echo $PERL_CPANM_OPT | sed 's/--skip-satisfied//' )"
51 # configure CPAN.pm - older versions get tickled by M::AI and
52 # go into an endless loop when trying to autoconf themselves
55 require CPAN::FirstTime;
56 *CPAN::FirstTime::conf_sites = sub {};
58 $CPAN::Config->{urllist} = [ "http://cpan.cpantesters.org/" ];
62 # if this won't be a CLEANTEST (i.e. no deps) - run basic tests using SQLT
63 # and set up whatever databases necessary
64 if [[ "$CLEANTEST" != "true" ]]; then
66 sudo apt-get -y install memcached firebird2.5-super
70 export DBICTEST_SQLT_DEPLOY=1
73 export DBICTEST_MEMCACHED=127.0.0.1:11211
76 mysql -e 'create database dbic_test;'
77 export DBICTEST_MYSQL_DSN='dbi:mysql:database=dbic_test;host=127.0.0.1'
78 export DBICTEST_MYSQL_USER=root
81 psql -c 'create database dbic_test;' -U postgres
82 export DBICTEST_PG_DSN='dbi:Pg:database=dbic_test;host=127.0.0.1'
83 export DBICTEST_PG_USER=postgres
86 sudo perl -pi -e 's/\=no/=yes/' /etc/default/firebird2.5
87 sudo /etc/init.d/firebird2.5-super start
89 #sudo gsec -add dbic_test -pw 123
90 #export DBICTEST_FIREBIRD_DSN=dbi:Firebird:dbname=/var/lib/firebird/2.5/data/dbic_test
91 #export DBICTEST_FIREBIRD_USER=dbic_test
92 #export DBICTEST_FIREBIRD_PASS=123
93 #export DBICTEST_FIREBIRD_INTERBASE_DSN=dbi:InterBase:dbname=/var/lib/firebird/2.5/data/dbic_test
94 #export DBICTEST_FIREBIRD_INTERBASE_USER=dbic_test
95 #export DBICTEST_FIREBIRD_INTERBASE_PASS=123
99 #DBICTEST_ORA_DSN=dbi:Oracle:host=localhost;sid=XE
100 #DBICTEST_ORA_USER=dbic_test
101 #DBICTEST_ORA_PASS=123
102 #DBICTEST_ORA_EXTRAUSER_DSN=dbi:Oracle:host=localhost;sid=XE
103 #DBICTEST_ORA_EXTRAUSER_USER=dbic_test_extra
104 #DBICTEST_ORA_EXTRAUSER_PASS=123
105 #ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
109 if [[ -z "$@" ]] ; then return; fi
111 echo -n "Installing $@... "
112 if ! OUT=$( echo "$@" | xargs -n 1 -P $NUMTHREADS cpanm --verbose --notest 2>&1 ) ; then
122 # Install *hard dep* modules that typically appear in more than one dep
124 # *NEVER* add optional depenencies here - will make CLEANTEST=true smokes useless
126 # do it in several passes to minimize amount of cross-deps installing multiple
127 # times, and to avoid module re-architecture breaking another install
128 # (e.g. once Carp is upgraded there's no more Carp::Heavy)
130 installdeps $(cpanm --notest --quiet --showdeps Module::Build)
131 installdeps Test::Exception Test::Fatal Module::Runtime Carp
132 installdeps Sub::Name multidimensional namespace::clean Class::XSAccessor MRO::Compat
133 installdeps DBI Moo Class::Accessor::Grouped
135 if [[ "$CLEANTEST" = "true" ]]; then
136 # get the last inc/ off cpan - we will get rid of MI
137 # soon enough, but till then this will do
138 # the point is to have a *really* clean perl (the ones
139 # we build are guaranteed to be clean, without side
140 # effects from travis preinstalls)
142 # FIXME - not yet implemented - not sure how to reliably
143 # feed to wget this location: http://cpansearch.perl.org/src/GETTY/DBIx-Class-0.08204/inc/
144 echo TODOOOO - M::I is not supposed to be installed here - this test is useless now
145 installdeps Module::Install
147 # we will be running all tests, preinstall MOAR stuff
148 installdeps Module::Install DateTime::Format::Strptime MooseX::Types JSON::Any Class::DBI
153 installdeps $(make listalldeps)
155 # announce what are we running
157 echo "Using $NUMTHREADS Travis-CI concurrent processes"
159 # make sure we got everything we need
160 perl Makefile.PL &> /dev/null
161 if [[ -n "$(make listdeps)" ]] ; then
162 echo "Not all deps installed - something went wrong :("