Readjust the parallel no-test dependency install order
[dbsrgits/DBIx-Class.git] / maint / travis-ci_scripts / 30_before_script.bash
CommitLineData
b58ecb01 1#!/bin/bash
2
3source maint/travis-ci_scripts/common.bash
4if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then return ; fi
5
992a24f6 6# try Schwern's latest offering on a stock perl and a threaded blead
7# can't do this with CLEANTEST=true yet because a lot of our deps fail
8# tests left and right under T::B 1.5
9if [[ "$CLEANTEST" != "true" ]] && ( [[ -z "$BREWVER" ]] || [[ "$BREWVER" = "blead" ]] ) ; then
10 # FIXME - there got to be a way to ask metacpan for this dynamically
11 TEST_BUILDER_BETA_CPAN_TARBALL="M/MS/MSCHWERN/Test-Simple-1.005000_005.tar.gz"
12fi
13
14
b58ecb01 15if [[ "$CLEANTEST" = "true" ]]; then
16 # get the last inc/ off cpan - we will get rid of MI
17 # soon enough, but till then this will do
18 # the point is to have a *really* clean perl (the ones
19 # we build are guaranteed to be clean, without side
20 # effects from travis preinstalls)
21
22 # trick cpanm into executing true as shell - we just need the find+unpack
23 run_or_err "Downloading DBIC inc/ from CPAN" \
24 "SHELL=/bin/true cpanm --look DBIx::Class"
25
26 mv ~/.cpanm/latest-build/DBIx-Class-*/inc .
27
992a24f6 28 # this should be installable anywhere, regardles of prereqs
29 if [[ -n "$TEST_BUILDER_BETA_CPAN_TARBALL" ]] ; then
30 run_or_err "Pre-installing dev-beta of Test::Builder ($TEST_BUILDER_BETA_CPAN_TARBALL)" \
31 "cpan $TEST_BUILDER_BETA_CPAN_TARBALL"
32 fi
33
b58ecb01 34 # older perls do not have a CPAN which understands configure_requires
35 # properly and what is worse a `cpan Foo` run exits with 0 even if some
36 # modules failed to install
37 # The first CPAN which is somewhat sane is around 1.94_56 (perl 5.12)
38 # The problem is that the first sane version also brings a *lot* of
39 # deps with it, notably things like YAML and HTTP::Tiny
40 # The goal of CLEANTEST is to have as little extra stuff installed as
41 # possible, mainly to catch "but X is perl core" mistakes
42 # So instead we still use our stock (possibly old) CPAN, and add some
43 # handholding
44 CPAN_is_sane || \
45 run_or_err "Pre-installing ExtUtils::MakeMaker and Module::Build" \
46 "cpan ExtUtils::MakeMaker Module::Build"
47
48 if ! perl -MModule::Build -e 1 &> /dev/null ; then
49 echo_err -e "Module::Build installation failed\n$LASTOUT"
50 exit 1
51 fi
52
53 # DBI has by far the longest test runtime - run less tests
54 # FIXME horrible horrible hack, need to implement in DBI itself
55 run_or_err "Downloading latest DBI distdir from CPAN" \
56 "SHELL=/bin/true cpanm --look DBI"
57 cd ~/.cpanm/latest-build/DBI-*/
58 perl -p -i -e 's/(create_.+?_tests) => 1/$1 => 0/' Makefile.PL
59 run_or_err "Pre-installing DBI, but running less tests" "perl Makefile.PL && make && make test && make install"
60 cd - &>/dev/null
61
62else
63 # we will be running all dbic tests - preinstall lots of stuff, run basic tests
64 # using SQLT and set up whatever databases necessary
65 export DBICTEST_SQLT_DEPLOY=1
66
67 # do the preinstall in several passes to minimize amount of cross-deps installing
68 # multiple times, and to avoid module re-architecture breaking another install
69 # (e.g. once Carp is upgraded there's no more Carp::Heavy)
70 #
71 parallel_installdeps_notest ExtUtils::MakeMaker
72 parallel_installdeps_notest Carp
73 parallel_installdeps_notest Module::Build
74 parallel_installdeps_notest Module::Runtime ExtUtils::Depends File::Spec Data::Dumper
84a9f66b 75 parallel_installdeps_notest Test::Exception Encode::Locale HTTP::Status HTTP::Daemon Try::Tiny
76 parallel_installdeps_notest Test::Fatal Test::Warn bareword::filehandles B::Hooks::EndOfScope
77 parallel_installdeps_notest Test::Pod::Coverage Test::EOL Devel::GlobalDestruction Sub::Name MRO::Compat Class::XSAccessor URI::Escape HTML::Entities
78 parallel_installdeps_notest YAML LWP Moose Class::Trigger JSON::XS DBI
79 parallel_installdeps_notest Moo Class::Accessor::Grouped Module::Install JSON
b58ecb01 80
84a9f66b 81 if [[ -n "DBICTEST_FIREBIRD_DSN" ]] ; then
b58ecb01 82 # the official version is full of 5.10-isms, but works perfectly fine on 5.8
83 # pull in our patched copy
84 run_or_err "Fetching patched DBD::Firebird" \
85 "git clone https://github.com/dbsrgits/perl-dbd-firebird-5.8.git ~/dbd-firebird"
86
87 # the official version is very much outdated and does not compile on 5.14+
88 # use this rather updated source tree (needs to go to PAUSE):
89 # https://github.com/pilcrow/perl-dbd-interbase
90 run_or_err "Fetching patched DBD::InterBase" \
91 "git clone https://github.com/dbsrgits/perl-dbd-interbase ~/dbd-interbase"
92
93 parallel_installdeps_notest ~/dbd-interbase/ ~/dbd-firebird/
94 fi
95
96fi
97
98# generate the makefile which will have different deps depending on
99# the runmode and envvars set above
100run_or_err "Configure on current branch" "perl Makefile.PL"
101
102# install (remaining) dependencies, sometimes with a gentle push
103if [[ "$CLEANTEST" = "true" ]]; then
104 # we may need to prepend some stuff to that list
105 HARD_DEPS="$(echo $(make listdeps))"
106
107 # this is a fucked CPAN - won't understand configure_requires of
108 # various pieces we may run into
109 CPAN_is_sane || HARD_DEPS="ExtUtils::Depends B::Hooks::OP::Check $HARD_DEPS"
110
111##### TEMPORARY WORKAROUNDS
112
71dd2ecc 113 # The unicode-in-yaml bug on older cpan clients
114 # FIXME there got to be a saner way to fix this...
b58ecb01 115 perl -M5.008008 -e 1 &> /dev/null || \
71dd2ecc 116 run_or_err "Installing multidimensional and bareword::filehandles via cpanm" \
117 "cpanm multidimensional bareword::filehandles"
b58ecb01 118
119 # work around Params::Validate not having a Makefile.PL so really old
120 # toolchains can not figure out what the prereqs are ;(
121 # Need to do more research before filing a bug requesting Makefile inclusion
122 perl -M5.008008 -e 1 &> /dev/null || \
123 HARD_DEPS="$(extract_prereqs Params::Validate) $HARD_DEPS"
124
125##### END TEMPORARY WORKAROUNDS
126
5cbe5b12 127 run_or_err "Installing/testing dependencies (may take up to 3 minutes): $HARD_DEPS" "cpan $HARD_DEPS"
b58ecb01 128
129 # this is a fucked CPAN - save the log as we may need it
130 CPAN_is_sane || INSTALLDEPS_OUT="$LASTOUT"
131
132else
133 # listalldeps is deliberate - will upgrade everything it can find
134 parallel_installdeps_notest $(make listalldeps)
992a24f6 135
136 if [[ -n "$TEST_BUILDER_BETA_CPAN_TARBALL" ]] ; then
137 parallel_installdeps_notest $TEST_BUILDER_BETA_CPAN_TARBALL
138 fi
b58ecb01 139fi
140
141echo_err "$(tstamp) Dependency configuration finished"
142# this will display list of available versions
143perl Makefile.PL
144
145# make sure we got everything we need
146if [[ -n "$(make listdeps)" ]] ; then
147 echo_err "$(tstamp) Not all deps installed - something went wrong :("
148 sleep 1 # without this the echo below confuses the console listener >.<
149 CPAN_is_sane || echo_err -e "Outdated CPAN.pm used - full logs follows\n$INSTALLDEPS_OUT\n\nSearch for 'NOT OK' in the text above\n\nDeps still missing:"
150 sleep 3 # without this the above echo confuses the console listener >.<
151 make listdeps
152 exit 1
153fi
154
155# announce what are we running
156echo_err "
157===================== DEPENDENCY CONFIGURATION COMPLETE =====================
158$(tstamp) Configuration phase seems to have taken $(date -ud "@$SECONDS" '+%H:%M:%S') (@$SECONDS)
159
160= CPUinfo
161$(perl -0777 -p -e 's/.+\n\n(?!\z)//s' < /proc/cpuinfo)
162
163= Meminfo
164$(free -m -t)
165
166= Environment
167$(env | grep -P 'TEST|TRAVIS|PERL|DBIC' | LC_ALL=C sort | cat -v)
168
169= Perl in use
170$(perl -V)
171============================================================================="