#!/bin/sh # # Use this as Jenkins Build "Execute shell" script # # Pedro Melo ## Die on any errors set -ex export OUTPUT=$WORKSPACE/logs rm -rf $OUTPUT mkdir -p $OUTPUT ## Perl setup: one local::lib per workspace + plus reuse the system wide version echo echo "**** Setup perl" eval $( perl -Mlocal::lib=$HOME/.perl5/current/local ) OLD_PERL5LIB=$PERL5LIB eval $( perl -Mlocal::lib=$WORKSPACE/local ) export PERL5LIB=$PERL5LIB:$OLD_PERL5LIB export PATH=~/.perl5/current/core/bin:$PATH echo PERL5LIB echo $PERL5LIB | perl -pe 's/:/\n /g; print " $_\n"' echo PATH echo $PATH | perl -pe 's/:/\n /g; print " $_\n"' ## Install dependencies echo echo "**** Install dependencies" cpanm --installdeps . ## TAP setup export PERL_TEST_HARNESS_DUMP_TAP=$OUTPUT/tap export TEST_VERBOSE=1 ## Cleanup old runs rm -rf Makefile Makefile.old blib *.tar.gz $PERL_TEST_HARNESS_DUMP_TAP cover_db mkdir -p $PERL_TEST_HARNESS_DUMP_TAP ## Prepare out distro echo echo "**** Prepare module" unset PERL_MM_OPT if [ -e Makefile.PL ] ; then perl Makefile.PL PREFIX=$WORKSPACE/install_root make fi ## Run the tests echo echo "**** Run tests" #prove -vbl -MDevel::Cover=-silent,off,-summary,off >&1 | tee -a $OUTPUT/tests.tap prove -vbl >&1 | tee -a $OUTPUT/tests.tap ## Prepare JUnit stuff echo echo "**** Convert to JUnit" ~/releases/bin/tap-to-junit-xml --input=$OUTPUT/tests.tap --output=$OUTPUT/tests.xml