# possible set of deps *without testing them*. This ensures we stay within
# a reasonable build-time and still run as many of our tests as possible
#
-# * The perl builds and the DBIC tests run under NUMTHREADS number of threads.
+# * The perl builds and the DBIC tests run under VCPU_USE number of threads.
# The testing of dependencies under CLEANTEST runs single-threaded, at least
# until we fix our entire dep-chain to safely pass under -j
#
env:
- CLEANTEST=false
- - CLEANTEST=true NUMTHREADS=1
+ - CLEANTEST=true VCPU_USE=1
matrix:
fast_finish: true
#
- maint/getstatus maint/travis-ci_scripts/40_script.bash
+###
+### Set -e back, work around https://github.com/travis-ci/travis-ci/issues/3533
+###
+ - set -e
+
after_success:
# Check if we can assemble a dist properly if not in CLEANTEST
#
# 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',
},
},
#!/bin/bash
+export SHORT_CIRCUIT_SMOKE
+
# Stop pre-started RDBMS and sync for some settle time
run_or_err "Stopping MySQL" "sudo /etc/init.d/mysql stop"
run_or_err "Stopping PostgreSQL" "sudo /etc/init.d/postgresql stop || /bin/true"
Short-circuiting buildjob to avoid false negatives, please restart it manually.
============================================================================="
+
+# pull requests are always scrutinized after the fact anyway - run a
+# a simpler matrix
+elif [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
+ if [[ -n "$BREWVER" ]]; then
+ # just don't brew anything
+ SHORT_CIRCUIT_SMOKE=1
+ else
+ # running PRs with 1 thread is non-sensical
+ VCPU_USE=""
+ fi
fi
if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then return ; fi
#
# We also divide the result by a factor, otherwise the travis VM gets
# overloaded (the amount of available swap is just TOOOO damn small)
-if [[ -z "$NUMTHREADS" ]] ; then
- export NUMTHREADS="$(( ( $(perl -0777 -n -e 'print (/ (?: .+ ^ processor \s+ : \s+ (\d+) ) (?! ^ processor ) /smx)' < /proc/cpuinfo) + 1 ) / 3 ))"
+export VCPU_AVAILABLE="$(( ( $(perl -0777 -n -e 'print (/ (?: .+ ^ processor \s+ : \s+ (\d+) ) (?! ^ processor ) /smx)' < /proc/cpuinfo) + 1 ) / 3 ))"
+
+if [[ -z "$VCPU_USE" ]] ; then
+ export VCPU_USE="$VCPU_AVAILABLE"
fi
export CACHE_DIR="/tmp/poormanscache"
# these will be installed no matter what, also some extras unless CLEANTEST
-common_packages="libapp-nopaste-perl tree"
+common_packages="libapp-nopaste-perl"
if [[ "$CLEANTEST" = "true" ]]; then
sudo bash -c 'echo -e "firebird2.5-super\tshared/firebird/enabled\tboolean\ttrue" | debconf-set-selections'
sudo bash -c 'echo -e "firebird2.5-super\tshared/firebird/sysdba_password/new_password\tpassword\t123" | debconf-set-selections'
+ # these APT sources do not mean anything to us anyway
+ sudo rm -rf /etc/apt/sources.list.d/*
+
run_or_err "Updating APT sources" "sudo apt-get update"
apt_install $common_packages libmysqlclient-dev memcached firebird2.5-super firebird2.5-dev unixodbc-dev expect
"echo \"CREATE DATABASE '/var/lib/firebird/2.5/data/dbic_test.fdb';\" | sudo isql-fb -u sysdba -p 123"
then
+ run_or_err "Fetching and building Firebird ODBC driver" '
+ cd "$(mktemp -d)"
+ wget -qO- http://sourceforge.net/projects/firebird/files/firebird-ODBC-driver/2.0.2-Release/OdbcFb-Source-2.0.2.153.gz/download | tar -zx
+ cd Builds/Gcc.lin
+ perl -p -i -e "s|/usr/lib64|/usr/lib/x86_64-linux-gnu|g" ../makefile.environ
+ make -f makefile.linux
+ sudo make -f makefile.linux install
+ '
+
+ sudo bash -c 'cat >> /etc/odbcinst.ini' <<< "
+[Firebird]
+Description = InterBase/Firebird ODBC Driver
+Driver = /usr/lib/x86_64-linux-gnu/libOdbcFb.so
+Setup = /usr/lib/x86_64-linux-gnu/libOdbcFb.so
+Threading = 1
+FileUsage = 1
+"
+
export DBICTEST_FIREBIRD_DSN=dbi:Firebird:dbname=/var/lib/firebird/2.5/data/dbic_test.fdb
export DBICTEST_FIREBIRD_USER=SYSDBA
export DBICTEST_FIREBIRD_PASS=123
export DBICTEST_FIREBIRD_INTERBASE_USER=SYSDBA
export DBICTEST_FIREBIRD_INTERBASE_PASS=123
+ export DBICTEST_FIREBIRD_ODBC_DSN="dbi:ODBC:Driver=Firebird;Dbname=/var/lib/firebird/2.5/data/dbic_test.fdb"
+ export DBICTEST_FIREBIRD_ODBC_USER=SYSDBA
+ export DBICTEST_FIREBIRD_ODBC_PASS=123
+
break
fi
PERL_CPANM_OPT="$PERL_CPANM_OPT --mirror $CPAN_MIRROR"
# do not set PERLBREW_CPAN_MIRROR - not all backpan-like mirrors have the perl tarballs
-export PERL_MM_USE_DEFAULT=1 PERL_MM_NONINTERACTIVE=1 PERL_AUTOINSTALL_PREFER_CPAN=1 HARNESS_TIMER=1 MAKEFLAGS="-j$NUMTHREADS"
+export PERL_MM_USE_DEFAULT=1 PERL_MM_NONINTERACTIVE=1 PERL_AUTOINSTALL_PREFER_CPAN=1 HARNESS_TIMER=1 MAKEFLAGS="-j$VCPU_USE"
# try CPAN's latest offering if requested
if [[ "$DEVREL_DEPS" == "true" ]] ; then
# since perl 5.14 a perl can safely be built concurrently with -j$large
# (according to brute force testing and my power bill)
if [[ "$BREWVER" == "blead" ]] || perl -Mversion -e "exit !!(version->new(q($BREWVER)) < 5.014)" ; then
- perlbrew_jopt="$NUMTHREADS"
+ perlbrew_jopt="$VCPU_USE"
fi
run_or_err "Compiling/installing Perl $BREWVER (without testing, using ${perlbrew_jopt:-1} threads, may take up to 5 minutes)" \
# no brewver - this means a travis perl, which means we want to clean up
# the presently installed libs
-# Idea stolen from
-# https://github.com/kentfredric/Dist-Zilla-Plugin-Prereqs-MatchInstalled-All/blob/master/maint-travis-ci/sterilize_env.pl
-# Only works on 5.12+ (where sitelib was finally properly fixed)
-elif [[ "$CLEANTEST" == "true" ]] && [[ "$POISON_ENV" != "true" ]] && perl -M5.012 -e 1 &>/dev/null ; then
-
- echo_err "$(tstamp) Cleaning precompiled Travis-Perl"
- perl -M5.012 -MConfig -MFile::Find -e '
- my $sitedirs = {
- map { $Config{$_} => 1 }
- grep { $_ =~ /site(lib|arch)exp$/ }
- keys %Config
- };
- find({ bydepth => 1, no_chdir => 1, follow_fast => 1, wanted => sub {
- ! $sitedirs->{$_} and ( -d _ ? rmdir : unlink )
- } }, keys %$sitedirs )
- '
-
- echo_err "Post-cleanup contents of sitelib of the pre-compiled Travis-Perl $TRAVIS_PERL_VERSION:"
- echo_err "$(tree $(perl -MConfig -e 'print $Config{sitelib_stem}'))"
- echo_err
+elif [[ "$CLEANTEST" == "true" ]] && [[ "$POISON_ENV" != "true" ]] ; then
+ purge_sitelib
fi
# configure CPAN.pm - older versions go into an endless loop
if [[ "$DEVREL_DEPS" != "true" ]] && ! CPAN_is_sane ; then
# no configure_requires - we will need the usual suspects anyway
- # without pre-installing these in one pass things like extract_prereqs won't work
- installdeps ExtUtils::MakeMaker ExtUtils::CBuilder Module::Build
+ # without pre-installing these in one pass things won't yet work
+ installdeps Module::Build
fi
else
# (e.g. once Carp is upgraded there's no more Carp::Heavy,
# while a File::Path upgrade may cause a parallel EUMM run to fail)
#
- parallel_installdeps_notest ExtUtils::MakeMaker
parallel_installdeps_notest File::Path
parallel_installdeps_notest Carp
parallel_installdeps_notest Module::Build
- parallel_installdeps_notest File::Spec Data::Dumper Module::Runtime
+ parallel_installdeps_notest File::Spec Module::Runtime
parallel_installdeps_notest Test::Exception Encode::Locale Test::Fatal
parallel_installdeps_notest Test::Warn B::Hooks::EndOfScope Test::Differences HTTP::Status
parallel_installdeps_notest Test::Pod::Coverage Test::EOL Devel::GlobalDestruction Sub::Name MRO::Compat Class::XSAccessor URI::Escape HTML::Entities
parallel_installdeps_notest YAML LWP Class::Trigger DateTime::Format::Builder Class::Accessor::Grouped Package::Variant
- parallel_installdeps_notest SQL::Abstract Moose Module::Install JSON SQL::Translator File::Which
+ parallel_installdeps_notest SQL::Abstract Moose Module::Install@1.15 JSON SQL::Translator File::Which Class::DBI::Plugin
# the official version is very much outdated and does not compile on 5.14+
# use this rather updated source tree (needs to go to PAUSE):
# we are doing a devrel pass - try to upgrade *everything* (we will be using cpanm so safe-ish)
if [[ "$DEVREL_DEPS" == "true" ]] ; then
- HARD_DEPS="$(echo $(make listalldeps))"
+ HARD_DEPS="$(make listalldeps | sort -R)"
else
- HARD_DEPS="$(echo $(make listdeps | sort -R))"
+ HARD_DEPS="$(make listdeps | sort -R)"
##### TEMPORARY WORKAROUNDS needed in case we will be using a fucked CPAN.pm
if ! CPAN_is_sane ; then
# DBD::SQLite reasonably wants DBI at config time
perl -MDBI -e1 &>/dev/null || HARD_DEPS="DBI $HARD_DEPS"
- # this is a fucked CPAN - won't understand configure_requires of
- # various pieces we may run into
- # FIXME - need to get these off metacpan or something instead
- HARD_DEPS="ExtUtils::Depends B::Hooks::OP::Check $HARD_DEPS"
-
- if CPAN_supports_BUILDPL ; then
- # We will invoke a posibly MBT based BUILD-file, but we do not support
- # configure requires. So we not only need to install MBT but its prereqs
- # FIXME This is madness
- HARD_DEPS="$(extract_prereqs Module::Build::Tiny) Module::Build::Tiny $HARD_DEPS"
- else
- # FIXME
- # work around Params::Validate not having a Makefile.PL so really old
- # toolchains can not figure out what the prereqs are ;(
- # Need to do more research before filing a bug requesting Makefile inclusion
- HARD_DEPS="$(extract_prereqs Params::Validate) $HARD_DEPS"
- fi
-
fi
##### END TEMPORARY WORKAROUNDS
else
- parallel_installdeps_notest "$(make listdeps)"
+ parallel_installdeps_notest "$(make listdeps | sort -R)"
fi
exit 1
fi
+if [[ "$CLEANTEST" = "true" ]] && perl -MModule::Build::Tiny -e1 &>/dev/null ; then
+ echo_err "Module::Build::Tiny pulled in during the basic depchain install - this must not happen"
+ exit 1
+fi
# announce what are we running
echo_err "
if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then exit 0 ; fi
run_harness_tests() {
- local -x HARNESS_OPTIONS=c:j$NUMTHREADS
+ local -x HARNESS_OPTIONS=c:j$VCPU_USE
make test 2> >(tee "$TEST_STDERR_LOG")
}
run_or_err "Prepare blib" "make pure_all"
run_harness_tests
else
- PROVECMD="prove -lrswj$NUMTHREADS xt t"
+ PROVECMD="prove -lrswj$VCPU_USE xt t"
# FIXME - temporary, until Package::Stash is fixed
if perl -M5.010 -e 1 &>/dev/null ; then
# this file is executed in a subshell - set up the common stuff
source maint/travis-ci_scripts/common.bash
-if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then exit 0 ; fi
+if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] || [[ "$TRAVIS_PULL_REQUEST" != "false" ]] ; then exit 0 ; fi
-if [[ "$CLEANTEST" != "true" ]] ; then
+# this part needs to run in parallel unconditionally
+export VCPU_USE="$VCPU_AVAILABLE"
+export HARNESS_OPTIONS="j$VCPU_USE"
+
+
+if [[ "$DEVREL_DEPS" == "true" ]] && perl -M5.008003 -e1 &>/dev/null ; then
+ # FIXME - these really need to be installed *with* testing under "allowed failures"
+ # Change when Moose goes away
+ parallel_installdeps_notest Moose
+ 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
+
+
+ # undo some of the pollution (if any) affecting the plain install deps
+ # FIXME - this will go away once we move off Moose, and a new SQLT
+ # with much less recommends ships
+ export DBICTEST_SQLT_DEPLOY=""
+ export DBICTEST_VIA_REPLICATED=""
+
+
+ # 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)"
+
+ # only run a full test cycle on devrel_deps, as they are all marked
+ # as "allow fails" in the travis matrix
+ 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
run_or_err "Installing (without testing) $(echo $MODLIST)" \
"echo \\
\"$MODLIST\" \\
- | xargs -d '\\n' -n 1 -P $NUMTHREADS bash -c \\
+ | xargs -d '\\n' -n 1 -P $VCPU_USE bash -c \\
'OUT=\$(maint/getstatus $TIMEOUT_CMD cpanm --notest \"\$@\" 2>&1 ) || (LASTEXIT=\$?; echo \"\$OUT\"; exit \$LASTEXIT)' \\
'giant space monkey penises'
"
local -x HARNESS_OPTIONS
- HARNESS_OPTIONS="j$NUMTHREADS"
+ HARNESS_OPTIONS="j$VCPU_USE"
if ! run_or_err "Attempting install of $# modules under parallel ($HARNESS_OPTIONS) testing ($MODLIST)" "_dep_inst_with_test $MODLIST" quiet_fail ; then
local errlog="failed after ${DELTA_TIME}s Exit:$LASTEXIT Log:$(/usr/bin/nopaste -q -s Shadowcat -d "Parallel testfail" <<< "$LASTOUT")"
if [[ "$DEVREL_DEPS" == "true" ]] ; then
# --dev is already part of CPANM_OPT
LASTCMD="$TIMEOUT_CMD cpanm $@"
- $LASTCMD 2>&1
+ $LASTCMD 2>&1 || return 1
else
LASTCMD="$TIMEOUT_CMD cpan $@"
- $LASTCMD 2>&1
+ $LASTCMD 2>&1 || return 1
# older perls do not have a CPAN which can exit with error on failed install
for m in "$@"; do
if ! perl -e '
+$ARGV[0] =~ s/-TRIAL\.//;
+
my $mod = (
- $ARGV[0] =~ m{ \/ .*? ([^\/]+) $ }x
+ # abuse backtrack
+ $ARGV[0] =~ m{ / .*? ( [^/]+ ) $ }x
? do { my @p = split (/\-/, $1); pop @p; join "::", @p }
: $ARGV[0]
);
fi
}
+# Idea stolen from
+# https://github.com/kentfredric/Dist-Zilla-Plugin-Prereqs-MatchInstalled-All/blob/master/maint-travis-ci/sterilize_env.pl
+# Only works on 5.12+ (where sitelib was finally properly fixed)
+purge_sitelib() {
+ echo_err "$(tstamp) Sterilizing the Perl installation (cleaning up sitelib)"
+
+ if perl -M5.012 -e1 &>/dev/null ; then
+
+ perl -M5.012 -MConfig -MFile::Find -e '
+ my $sitedirs = {
+ map { $Config{$_} => 1 }
+ grep { $_ =~ /site(lib|arch)exp$/ }
+ keys %Config
+ };
+ find({ bydepth => 1, no_chdir => 1, follow_fast => 1, wanted => sub {
+ ! $sitedirs->{$_} and ( -d _ ? rmdir : unlink )
+ } }, keys %$sitedirs )
+ '
+ else
+
+ cl_fn="/tmp/${TRAVIS_BUILD_ID}_Module_CoreList.pm";
+
+ [[ -s "$cl_fn" ]] || run_or_err \
+ "Downloading latest Module::CoreList" \
+ "curl -s --compress -o '$cl_fn' https://api.metacpan.org/source/Module::CoreList"
+
+ perl -0777 -Ilib -MDBIx::Class::Optional::Dependencies -e '
+
+ # this is horrible, but really all we want is "has this ever been used"
+ # so a grep without a load is quite legit (and horrible)
+ my $mcl_source = <>;
+
+ my @all_possible_never_been_core_modpaths = map
+ { (my $mp = $_ . ".pm" ) =~ s|::|/|g; $mp }
+ grep
+ { $mcl_source !~ / ^ \s+ \x27 $_ \x27 \s* \=\> /mx }
+ (
+ qw(
+ Module::Build::Tiny
+ ),
+ keys %{ DBIx::Class::Optional::Dependencies->modreq_list_for([
+ keys %{ DBIx::Class::Optional::Dependencies->req_group_list }
+ ])}
+ )
+ ;
+
+ # now that we have the list we can go ahead and destroy every single one
+ # of these modules without being concerned about breaking the base ability
+ # to install things
+ for my $mp ( sort { lc($a) cmp lc($b) } @all_possible_never_been_core_modpaths ) {
+ for my $incdir (@INC) {
+ -e "$incdir/$mp"
+ and
+ unlink "$incdir/$mp"
+ and
+ print "Nuking $incdir/$mp\n"
+ }
+ }
+ ' "$cl_fn"
+
+ fi
+}
+
+
CPAN_is_sane() { perl -MCPAN\ 1.94_56 -e 1 &>/dev/null ; }
CPAN_supports_BUILDPL() { perl -MCPAN\ 1.9205 -e1 &>/dev/null; }
use File::Spec;
use Fcntl qw/:DEFAULT :flock/;
use Config;
+use Scope::Guard ();
=head1 NAME
my $schema = shift;
my $args = shift || {};
- local $schema->storage->{debug}
- if ($ENV{TRAVIS}||'') eq 'true';
+ my $guard;
+ if ( ($ENV{TRAVIS}||'') eq 'true' and my $old_dbg = $schema->storage->debug ) {
+ $guard = Scope::Guard->new(sub { $schema->storage->debug($old_dbg) });
+ $schema->storage->debug(0);
+ }
if ($ENV{"DBICTEST_SQLT_DEPLOY"}) {
$schema->deploy($args);
my $self = shift;
my $schema = shift;
- local $schema->storage->{debug}
- if ($ENV{TRAVIS}||'') eq 'true';
+ my $guard;
+ if ( ($ENV{TRAVIS}||'') eq 'true' and my $old_dbg = $schema->storage->debug ) {
+ $guard = Scope::Guard->new(sub { $schema->storage->debug($old_dbg) });
+ $schema->storage->debug(0);
+ }
$schema->populate('Genre', [
[qw/genreid name/],
return (
($ENV{TRAVIS}||'') eq 'true'
and
- ($ENV{TRAVIS_REPO_SLUG}||'') eq 'dbsrgits/dbix-class'
+ ($ENV{TRAVIS_REPO_SLUG}||'') =~ m|\w+/dbix-class$|
)
}