From: Graham Knop Date: Sun, 23 Feb 2014 23:55:12 +0000 (-0500) Subject: travis testing X-Git-Tag: v1.003003~26 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=865241eaef200bde69624eba01d4a6246c756f62;p=gitmo%2FRole-Tiny.git travis testing --- diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..5610ec1 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,42 @@ +language: perl +perl: + - "5.8.1" + - "5.8.4" + - "5.8" + - "5.10" + - "5.12" + - "5.14" + - "5.16" + - "5.18" +matrix: + include: + - perl: 5.18 + env: COVERAGE=1 +before_install: + - source maint/travis-perlbrew + - perlbrew install-cpanm -f + - perl -V +install: + - maint/travis-install ExtUtils::MakeMaker + - maint/travis-install --deps + - "[ -n \"$COVERAGE\" ] && maint/travis-install Devel::Cover Devel::Cover::Report::Coveralls || true" + - "[ -n \"$COVERAGE\" ] && cover -delete -silent || true" + - "[ -n \"$COVERAGE\" ] && export HARNESS_PERL_SWITCHES='-MDevel::Cover=-ignore,^x?t/,-blib,0' || true" +script: + - prove -lv +after_success: + - "[ -n \"$COVERAGE\" ] && cover -report coveralls || true" +branches: + except: + - /^wip\// + - /^blocked/ +notifications: + email: false + irc: + channels: + - "irc.perl.org#moo-smoke" + template: + - "%{branch}#%{build_number} by %{author}: %{message} (%{build_url})" + on_success: change + on_failure: always + skip_join: true diff --git a/maint/travis-install b/maint/travis-install new file mode 100755 index 0000000..2016e0f --- /dev/null +++ b/maint/travis-install @@ -0,0 +1,55 @@ +#!/bin/bash + +function clean_up { + kill $PROG + wait 2>/dev/null +} + +export PERL_CPANM_OPT="--mirror http://www.cpan.org/" + +function cpanm_install { + local dep="$1" + printf "Installing (without testing) $dep ..." + ( + while true; do + sleep 3 + printf '.' + done + ) & + local PROG=$! + trap "clean_up $PROG; exit 1" SIGHUP SIGINT SIGTERM + local OUT=$(cpanm --verbose --no-interactive --no-man-pages --notest $dep 2>&1 ) + local STATUS=$? + kill $PROG + wait $PROG 2>/dev/null + trap - SIGHUP SIGINT SIGTERM + if [ $STATUS != 0 ]; then + echo ' Failed!' + echo "$OUT" + exit $? + fi + echo ' Done' +} + +for arg; do + case $arg in + --deps) + AUTHOR_OPTS='' + if [ -z "$AUTHOR_TESTING" ] || [ "$AUTHOR_TESTING" -ne 0 ]; then + AUTHOR_OPTS='--with-recommends' + fi + DEPS="$DEPS $(cpanm --showdeps -q . --with-develop $AUTHOR_OPTS)" + for dep in $DEPS; do + case $dep in + perl*) ;; + *) + cpanm_install $dep + ;; + esac + done + ;; + *) + cpanm_install $arg + ;; + esac +done diff --git a/maint/travis-perlbrew b/maint/travis-perlbrew new file mode 100644 index 0000000..5c687d1 --- /dev/null +++ b/maint/travis-perlbrew @@ -0,0 +1,16 @@ +BREWVER=${TRAVIS_PERL_VERSION/_*/} +BREWOPTS= +[[ "${TRAVIS_PERL_VERSION}_" =~ '_thr_' ]] && BREWOPTS="$BREWOPTS -Duseithreads" +[[ "$(sed -n -E -e's/^5\.([0-9]+).*/\1/p' <<< $TRAVIS_PERL_VERSION)" -ge 14 ]] && BREWOPTS="$BREWOPTS -j 2" + +if ! perlbrew use | grep -q "Currently using $TRAVIS_PERL_VERSION"; then + echo "Building perl $TRAVIS_PERL_VERSION..." + PERLBUILD=$(perlbrew install --as $TRAVIS_PERL_VERSION --notest --noman --verbose $BREWOPTS $BREWVER 2>&1) + perlbrew use $TRAVIS_PERL_VERSION + if ! perlbrew use | grep -q "Currently using $TRAVIS_PERL_VERSION"; then + echo "Unable to switch to $TRAVIS_PERL_VERSION - compilation failed...?" 1>&2 + echo "$PERLBUILD" 1>&2 + exit 1 + fi +fi +perlbrew install-cpanm -f