(travis) Enhance post-success to run a full CPAN install cycle
Peter Rabbitson [Thu, 2 Apr 2015 00:52:56 +0000 (02:52 +0200)]
This is as much a check for our installability, as it is a smoke of CPAN.pm

lib/DBIx/Class/Optional/Dependencies.pm
maint/travis-ci_scripts/50_after_success.bash

index e56ffd8..6c71877 100644 (file)
@@ -665,9 +665,19 @@ my $dbic_reqs = {
     # we need to run the dbicadmin so we can self-generate its POD
     # also we do not want surprises in case JSON::XS is in the path
     # so make sure we get an always-working JSON::Any
-    include => [qw( admin_script _json_xs_compatible_json_any )],
+    include => [qw(
+      admin_script
+      _json_xs_compatible_json_any
+      id_shortener
+      deploy
+      test_pod
+      test_podcoverage
+      test_whitespace
+      test_strictures
+    )],
     req => {
       'ExtUtils::MakeMaker' => '6.64',
+      'Module::Install'     => '1.06',
       'Pod::Inherit'        => '0.91',
     },
   },
index a7b78dd..c98ea7d 100755 (executable)
@@ -5,13 +5,71 @@ source maint/travis-ci_scripts/common.bash
 
 if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then exit 0 ; fi
 
-if [[ "$CLEANTEST" != "true" ]] ; then
+# this part needs to run in parallel unconditionally
+export VCPU_USE="$VCPU_AVAILABLE"
+
+
+if [[ "$DEVREL_DEPS" == "true" ]] && perl -M5.008003 -e1 &>/dev/null ; then
+  parallel_installdeps_notest $(perl -Ilib -MDBIx::Class::Optional::Dependencies=-list_missing,dist_dir)
+
+  run_or_err "Attempt to build a dist" "rm -rf inc/ && perl Makefile.PL --skip-author-deps && make dist"
+  tarball_assembled=1
+
+elif [[ "$CLEANTEST" != "true" ]] ; then
   parallel_installdeps_notest $(perl -Ilib -MDBIx::Class::Optional::Dependencies=-list_missing,dist_dir)
-  run_or_err "Attempt to build a dist with all prereqs present" "make dist"
+
+  run_or_err "Attempt to build a dist from original checkout" "make dist"
+  tarball_assembled=1
+fi
+
+
+if [[ -n "$tarball_assembled" ]] ; then
+
   echo "Contents of the resulting dist tarball:"
   echo "==========================================="
   tar -vzxf DBIx-Class-*.tar.gz
   echo "==========================================="
-  run_or_err 'Attempt to configure from re-extracted distdir' \
-    'bash -c "cd \$(find DBIx-Class-* -maxdepth 0 -type d | head -n 1) && perl Makefile.PL"'
+
+  # kill as much as possible with fire
+  purge_sitelib
+
+  # make sure we are retrying with newest CPAN possible
+  #
+  # not running tests on CPAN.pm - they are not terribly slow,
+  # but https://rt.cpan.org/Ticket/Display.html?id=96437 sucks
+  parallel_installdeps_notest CPAN
+  run_or_err "Make sure CPAN was upgraded to at least 2.10" "perl -M'CPAN 2.010' -e1"
+
+  run_or_err "Re-Configuring CPAN.pm" "perl -MCPAN -e '\
+    CPAN::Config->load;
+
+    # For the time being smoking with this setting is not realistic
+    # https://rt.cpan.org/Ticket/Display.html?id=103280
+    # https://rt.cpan.org/Ticket/Display.html?id=37641
+    # https://rt.cpan.org/Ticket/Display.html?id=77708
+    # https://rt.cpan.org/Ticket/Display.html?id=87474
+    #\$CPAN::Config->{build_requires_install_policy} = q{no};
+
+    \$CPAN::Config->{recommends_policy} = q{yes};
+    CPAN::Config->commit;
+  '"
+
+  cd "$(find DBIx-Class-* -maxdepth 0 -type d | head -n 1)"
+
+  if [[ "$DEVREL_DEPS" == "true" ]] ; then
+
+    for e in $( env | grep 'DBICTEST.*DSN' | cut -f 1 -d '=' ) ; do
+      echo "Unsetting $e"
+      export $e=""
+    done
+
+    run_or_err \
+      "Attempt to configure/test/build/install dist using latest CPAN@$(perl -MCPAN -e 'print CPAN->VERSION')" \
+      "cpan ."
+
+  else
+    run_or_err \
+      "Attempt to configure/build/install dist using latest CPAN@$(perl -MCPAN -e 'print CPAN->VERSION')" \
+      "perl -MCPAN -e 'notest( install => q{.} )'"
+  fi
 fi