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 sleep 20 # give the console time to attach, otherwise it hangs
42 return # this is like an `exit 0` in sourcing
45 perlbrew install --as $BREWVER --notest $BREWOPTS -j $NUMTHREADS perl-$BREWVER
49 export PERL_MM_USE_DEFAULT=1 PERL_MM_NONINTERACTIVE=1 PERL_AUTOINSTALL_PREFER_CPAN=1
50 export PERL_CPANM_OPT="$( echo $PERL_CPANM_OPT | sed 's/--skip-satisfied//' )"
53 if [[ -z "$@" ]] ; then return; fi
55 # The reason we do things so "non-interactively" is that xargs -P will have the
56 # latest cpanm instance overwrite the buildlog. There seems to be no way to
57 # specify a custom buildlog, hence we just collect the verbose output
58 # and display it in case of failure
59 echo -n "Installing $@... "
60 if ! OUT=$( echo "$@" | xargs -n 1 -P $NUMTHREADS cpanm --verbose --no-interactive --notest --no-man-pages 2>&1 ) ; then
70 # Install *hard dep* modules that typically appear in more than one dep
72 # *NEVER* add optional depenencies here - will make CLEANTEST=true smokes useless
74 # do it in several passes to minimize amount of cross-deps installing multiple
75 # times, and to avoid module re-architecture breaking another install
76 # (e.g. once Carp is upgraded there's no more Carp::Heavy)
78 installdeps $(cpanm --notest --quiet --showdeps Module::Build)
79 installdeps Test::Exception Test::Fatal Module::Runtime Carp
80 installdeps Sub::Name multidimensional namespace::clean Class::XSAccessor MRO::Compat
81 installdeps DBI Moo Class::Accessor::Grouped
83 # configure CPAN.pm - older versions get tickled by M::AI and
84 # go into an endless loop when trying to autoconf themselves
85 # we are not *supposed* to actually use it, this is just a
89 require CPAN::FirstTime;
90 *CPAN::FirstTime::conf_sites = sub {};
92 $CPAN::Config->{urllist} = [ "http://cpan.cpantesters.org/" ];
96 if [[ "$CLEANTEST" = "true" ]]; then
97 # get the last inc/ off cpan - we will get rid of MI
98 # soon enough, but till then this will do
99 # the point is to have a *really* clean perl (the ones
100 # we build are guaranteed to be clean, without side
101 # effects from travis preinstalls)
103 # FIXME - not yet implemented - not sure how to reliably
104 # feed to wget this location: http://cpansearch.perl.org/src/GETTY/DBIx-Class-0.08204/inc/
105 echo TODOOOO - M::I is not supposed to be installed here - this test is useless now
106 installdeps Module::Install
108 # we will be running all tests - preinstall MOAR stuff, run basic tests using SQLT
109 # and set up whatever databases necessary
110 installdeps Module::Install DateTime::Format::Strptime MooseX::Types JSON::Any Class::DBI
112 export DBICTEST_SQLT_DEPLOY=1
115 sudo apt-get -y install memcached firebird2.5-super
120 export DBICTEST_MEMCACHED=127.0.0.1:11211
123 mysql -e 'create database dbic_test;'
124 export DBICTEST_MYSQL_DSN='dbi:mysql:database=dbic_test;host=127.0.0.1'
125 export DBICTEST_MYSQL_USER=root
128 psql -c 'create database dbic_test;' -U postgres
129 export DBICTEST_PG_DSN='dbi:Pg:database=dbic_test;host=127.0.0.1'
130 export DBICTEST_PG_USER=postgres
133 sudo perl -pi -e 's/\=no/=yes/' /etc/default/firebird2.5
134 sudo /etc/init.d/firebird2.5-super start
136 #sudo gsec -add dbic_test -pw 123
137 #export DBICTEST_FIREBIRD_DSN=dbi:Firebird:dbname=/var/lib/firebird/2.5/data/dbic_test
138 #export DBICTEST_FIREBIRD_USER=dbic_test
139 #export DBICTEST_FIREBIRD_PASS=123
140 #export DBICTEST_FIREBIRD_INTERBASE_DSN=dbi:InterBase:dbname=/var/lib/firebird/2.5/data/dbic_test
141 #export DBICTEST_FIREBIRD_INTERBASE_USER=dbic_test
142 #export DBICTEST_FIREBIRD_INTERBASE_PASS=123
146 #DBICTEST_ORA_DSN=dbi:Oracle:host=localhost;sid=XE
147 #DBICTEST_ORA_USER=dbic_test
148 #DBICTEST_ORA_PASS=123
149 #DBICTEST_ORA_EXTRAUSER_DSN=dbi:Oracle:host=localhost;sid=XE
150 #DBICTEST_ORA_EXTRAUSER_USER=dbic_test_extra
151 #DBICTEST_ORA_EXTRAUSER_PASS=123
152 #ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
157 installdeps $(make listalldeps)
159 # announce what are we running
161 echo "Using $NUMTHREADS Travis-CI concurrent processes"
163 # make sure we got everything we need
164 perl Makefile.PL &> /dev/null
165 if [[ -n "$(make listdeps)" ]] ; then
166 echo "Not all deps installed - something went wrong :("