(travis) Multiple CI improvements lifted from blead
[dbsrgits/DBIx-Class.git] / maint / travis-ci_scripts / 50_after_success.bash
1 #!/bin/bash
2
3 # this file is executed in a subshell - set up the common stuff
4 source maint/travis-ci_scripts/common.bash
5
6 if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] || [[ "$TRAVIS_PULL_REQUEST" != "false" ]] ; then exit 0 ; fi
7
8 # this part needs to run in parallel unconditionally
9 export VCPU_USE="$VCPU_AVAILABLE"
10 export HARNESS_OPTIONS="j$VCPU_USE"
11
12 if [[ "$DEVREL_DEPS" == "true" ]] && perl -M5.008003 -e1 &>/dev/null ; then
13   # FIXME - Devel::Cover (brought by Test::Strict, but soon needed anyway)
14   # does not test cleanly on 5.8.7 - just get it directly
15   if perl -M5.008007 -e1 &>/dev/null && ! perl -M5.008008 -e1 &>/dev/null; then
16     parallel_installdeps_notest Devel::Cover
17   fi
18
19   # FIXME - workaround for YAML/RT#81120 and L::SRH/RT#107681
20   # We don't actually need these modules, only there because of SQLT (which will be fixed)
21   # does not test cleanly on 5.8.7 - just get them directly
22   if ! perl -M5.008008 -e1 &>/dev/null; then
23     parallel_installdeps_notest YAML Lexical::SealRequireHints
24   fi
25
26   parallel_installdeps_notest "Module::Install@1.15"
27
28   # FIXME Change when Moose goes away
29   installdeps Moose $(perl -Ilib -MDBIx::Class -e 'print join " ", keys %{DBIx::Class::Optional::Dependencies->req_list_for("dist_dir")}')
30
31   run_or_err "Attempt to build a dist" "rm -rf inc/ && perl Makefile.PL --skip-author-deps && make dist"
32   tarball_assembled=1
33
34 elif [[ "$CLEANTEST" != "true" ]] ; then
35   parallel_installdeps_notest "Module::Install@1.15" $(perl -Ilib -MDBIx::Class -e 'print join " ", keys %{DBIx::Class::Optional::Dependencies->req_list_for("dist_dir")}')
36
37   run_or_err "Attempt to build a dist from original checkout" "make dist"
38   tarball_assembled=1
39 fi
40
41 if [[ -n "$tarball_assembled" ]] ; then
42
43   echo "Contents of the resulting dist tarball:"
44   echo "==========================================="
45   tar -vzxf DBIx-Class-*.tar.gz
46   echo "==========================================="
47
48   # kill as much as possible with fire
49   purge_sitelib
50
51
52   # undo some of the pollution (if any) affecting the plain install deps
53   # FIXME - this will go away once we move off Moose, and a new SQLT
54   # with much less recommends ships
55   export DBICTEST_SQLT_DEPLOY=""
56   export DBICTEST_VIA_REPLICATED=""
57
58
59   # make sure we are retrying with newest CPAN possible
60   #
61   # not running tests on CPAN.pm - they are not terribly slow,
62   # but https://rt.cpan.org/Ticket/Display.html?id=96437 sucks
63   parallel_installdeps_notest CPAN
64   run_or_err "Make sure CPAN was upgraded to at least 2.10" "perl -M'CPAN 2.010' -e1"
65
66   run_or_err "Re-Configuring CPAN.pm" "perl -MCPAN -e '\
67     CPAN::Config->load;
68
69     # For the time being smoking with this setting is not realistic
70     # https://rt.cpan.org/Ticket/Display.html?id=103280
71     # https://rt.cpan.org/Ticket/Display.html?id=37641
72     # https://rt.cpan.org/Ticket/Display.html?id=77708
73     # https://rt.cpan.org/Ticket/Display.html?id=87474
74     #\$CPAN::Config->{build_requires_install_policy} = q{no};
75
76     \$CPAN::Config->{recommends_policy} = q{yes};
77     CPAN::Config->commit;
78   '"
79
80   cd "$(find DBIx-Class-* -maxdepth 0 -type d | head -n 1)"
81
82   # only run a full test cycle on devrel_deps, as they are all marked
83   # as "allow fails" in the travis matrix
84   if [[ "$DEVREL_DEPS" == "true" ]] ; then
85
86     for e in $( env | grep 'DBICTEST.*DSN' | cut -f 1 -d '=' ) ; do
87       echo "Unsetting $e"
88       export $e=""
89     done
90
91     run_or_err \
92       "Attempt to configure/test/build/install dist using latest CPAN@$(perl -MCPAN -e 'print CPAN->VERSION')" \
93       "cpan ."
94
95   else
96     run_or_err \
97       "Attempt to configure/build/install dist using latest CPAN@$(perl -MCPAN -e 'print CPAN->VERSION')" \
98       "perl -MCPAN -e 'notest( install => q{.} )'"
99   fi
100 fi