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 # trick cpanm into executing true as shell - we just need the find+unpack
104 SHELL=/bin/true cpanm --look DBIx::Class
105 mv ~/.cpanm/latest-build/*/inc .
107 # we will be running all tests - preinstall MOAR stuff, run basic tests using SQLT
108 # and set up whatever databases necessary
109 installdeps Module::Install DateTime::Format::Strptime MooseX::Types JSON::Any Class::DBI
111 export DBICTEST_SQLT_DEPLOY=1
113 ### apt-get invocation - faster to grab everything at once
115 # FIXME these debconf lines should automate the firebird config but do not :(((
116 sudo bash -c 'echo -e "firebird2.5-super\tshared/firebird/enabled\tboolean\ttrue" | debconf-set-selections'
117 sudo bash -c 'echo -e "firebird2.5-super\tshared/firebird/sysdba_password/new_password\tpassword\t123" | debconf-set-selections'
119 sudo apt-get install -y memcached firebird2.5-super firebird2.5-dev expect
122 export DBICTEST_MEMCACHED=127.0.0.1:11211
125 mysql -e 'create database dbic_test;'
126 export DBICTEST_MYSQL_DSN='dbi:mysql:database=dbic_test;host=127.0.0.1'
127 export DBICTEST_MYSQL_USER=root
130 psql -c 'create database dbic_test;' -U postgres
131 export DBICTEST_PG_DSN='dbi:Pg:database=dbic_test;host=127.0.0.1'
132 export DBICTEST_PG_USER=postgres
135 # poor man's deb config
136 echo -n "Re-configuring firebird... "
139 DEBIAN_FRONTEND=text sudo expect -c '
140 spawn dpkg-reconfigure --frontend=text firebird2.5-super
141 expect "Enable Firebird server?"
142 send "\177\177\177\177yes\r"
143 expect "Password for SYSDBA"
150 # restart the server for good measure
151 sudo /etc/init.d/firebird2.5-super stop || true
153 sudo /etc/init.d/firebird2.5-super start
164 sudo isql-fb -u sysdba -p 123 <<< "CREATE DATABASE '/var/lib/firebird/2.5/data/dbic_test.fdb';"
166 # the official version is full of 5.10-isms, but works perfectly fine on 5.8
167 # pull in our patched copy
168 git clone https://github.com/dbsrgits/perl-dbd-firebird-5.8.git ~/dbd-firebird
170 # the official version is very much outdated and does not compile on 5.14+
171 # use this rather updated source tree (needs to go to PAUSE):
172 # https://github.com/pilcrow/perl-dbd-interbase
173 git clone https://github.com/dbsrgits/perl-dbd-interbase ~/dbd-interbase
175 installdeps ~/dbd-interbase/ ~/dbd-firebird/
177 export DBICTEST_FIREBIRD_DSN=dbi:Firebird:dbname=/var/lib/firebird/2.5/data/dbic_test.fdb
178 export DBICTEST_FIREBIRD_USER=SYSDBA
179 export DBICTEST_FIREBIRD_PASS=123
181 export DBICTEST_FIREBIRD_INTERBASE_DSN=dbi:InterBase:dbname=/var/lib/firebird/2.5/data/dbic_test.fdb
182 export DBICTEST_FIREBIRD_INTERBASE_USER=SYSDBA
183 export DBICTEST_FIREBIRD_INTERBASE_PASS=123
187 #DBICTEST_ORA_DSN=dbi:Oracle:host=localhost;sid=XE
188 #DBICTEST_ORA_USER=dbic_test
189 #DBICTEST_ORA_PASS=123
190 #DBICTEST_ORA_EXTRAUSER_DSN=dbi:Oracle:host=localhost;sid=XE
191 #DBICTEST_ORA_EXTRAUSER_USER=dbic_test_extra
192 #DBICTEST_ORA_EXTRAUSER_PASS=123
193 #ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
196 # install the remaining dependencies
198 installdeps $(make listalldeps)
200 # announce what are we running
202 echo "Using $NUMTHREADS Travis-CI concurrent processes"
204 # make sure we got everything we need
205 perl Makefile.PL &> /dev/null
206 if [[ -n "$(make listdeps)" ]] ; then
207 echo "Not all deps installed - something went wrong :("