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 perlbrew install --as $BREWVER --notest $BREWOPTS -j $NUMTHREADS perl-$BREWVER
42 export PERL_MM_USE_DEFAULT=1 PERL_MM_NONINTERACTIVE=1 PERL_AUTOINSTALL_PREFER_CPAN=1
44 # configure CPAN.pm - older versions get tickled by M::AI and
45 # go into an endless loop when trying to autoconf themselves
48 require CPAN::FirstTime;
49 *CPAN::FirstTime::conf_sites = sub {};
51 $CPAN::Config->{urllist} = [ "http://cpan.cpantesters.org/" ];
55 # if this won't be a CLEANTEST (i.e. no deps) - run basic tests using SQLT
56 # and set up whatever databases necessary
57 if [[ "$CLEANTEST" != "true" ]]; then
59 sudo apt-get -y install memcached firebird2.5-super
63 export DBICTEST_SQLT_DEPLOY=1
66 export DBICTEST_MEMCACHED=127.0.0.1:11211
69 mysql -e 'create database dbic_test;'
70 export DBICTEST_MYSQL_DSN='dbi:mysql:database=dbic_test;host=127.0.0.1'
71 export DBICTEST_MYSQL_USER=root
74 psql -c 'create database dbic_test;' -U postgres
75 export DBICTEST_PG_DSN='dbi:Pg:database=dbic_test;host=127.0.0.1'
76 export DBICTEST_PG_USER=postgres
79 sudo perl -pi -e 's/\=no/=yes/' /etc/default/firebird2.5
80 sudo /etc/init.d/firebird2.5-super start
82 #sudo gsec -add dbic_test -pw 123
83 #export DBICTEST_FIREBIRD_DSN=dbi:Firebird:dbname=/var/lib/firebird/2.5/data/dbic_test
84 #export DBICTEST_FIREBIRD_USER=dbic_test
85 #export DBICTEST_FIREBIRD_PASS=123
86 #export DBICTEST_FIREBIRD_INTERBASE_DSN=dbi:InterBase:dbname=/var/lib/firebird/2.5/data/dbic_test
87 #export DBICTEST_FIREBIRD_INTERBASE_USER=dbic_test
88 #export DBICTEST_FIREBIRD_INTERBASE_PASS=123
92 #DBICTEST_ORA_DSN=dbi:Oracle:host=localhost;sid=XE
93 #DBICTEST_ORA_USER=dbic_test
94 #DBICTEST_ORA_PASS=123
95 #DBICTEST_ORA_EXTRAUSER_DSN=dbi:Oracle:host=localhost;sid=XE
96 #DBICTEST_ORA_EXTRAUSER_USER=dbic_test_extra
97 #DBICTEST_ORA_EXTRAUSER_PASS=123
98 #ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
102 if [[ -z "$@" ]] ; then return; fi
104 echo -n "Installing $@... "
106 # the --reinstall is here because for some reason e.g. `cpanm Carp` does
107 # not install a newer Carp since it already exists on the system
108 # investigation pending
109 if ! OUT=$( echo "$@" | xargs -n 1 -P $NUMTHREADS cpanm --reinstall --verbose --notest 2>&1 ) ; then
119 # Install *hard dep* modules that typically appear in more than one dep
121 # *NEVER* add optional depenencies here - will make CLEANTEST=true smokes useless
123 # do it in several passes to minimize amount of cross-deps installing multiple
124 # times, and to avoid module re-architecture breaking another install
125 # (e.g. once Carp is upgraded there's no more Carp::Heavy)
127 installdeps $(cpanm --notest --quiet --showdeps Module::Build)
128 installdeps Test::Exception Test::Fatal Module::Runtime Carp
129 installdeps Sub::Name multidimensional namespace::clean Class::XSAccessor MRO::Compat
130 installdeps DBI Moo Class::Accessor::Grouped
132 if [[ "$CLEANTEST" = "true" ]]; then
133 # get the last inc/ off cpan - we will get rid of MI
134 # soon enough, but till then this will do
135 # the point is to have a *really* clean perl (the ones
136 # we build are guaranteed to be clean, without side
137 # effects from travis preinstalls)
139 # FIXME - not yet implemented - not sure how to reliably
140 # feed to wget this location: http://cpansearch.perl.org/src/GETTY/DBIx-Class-0.08204/inc/
141 echo TODOOOO - M::I is not supposed to be installed here - this test is useless now
142 installdeps Module::Install
144 # we will be running all tests, preinstall MOAR stuff
145 installdeps Module::Install DateTime::Format::Strptime MooseX::Types JSON::Any Class::DBI
150 installdeps $(make listalldeps)
152 # FIXME - for some reason the above invocation does not upgrade outdated
153 # core libs - just punt and install the remainder by hand (these run tests)
154 # This snippet should not be here at all
155 perl Makefile.PL &> /dev/null
158 # announce what are we running
160 echo "Using $NUMTHREADS Travis-CI concurrent processes"
162 # make sure we got everything we need
163 perl Makefile.PL &> /dev/null
164 if [[ -n "$(make listdeps)" ]] ; then
165 echo "Not all deps installed - something went wrong :("