Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
set -ex
git clean -dfx
echo "Setup dependancies"
eval $(perl -Mlocal::lib=support)
wget -q -O - http://cpanmin.us | perl - --notest App::cpanminus
./support/bin/cpanm --notest \
CPAN::Uploader \
Module::Install \
TAP::Formatter::JUnit
./support/bin/cpanm --installdeps --notest .
echo "Setup environment"
export OUTPUT=$WORKSPACE/output
mkdir -p $OUTPUT
export AUTOMATED_TESTING=1
export PERL_MM_USE_DEFAULT=1
export PERL_TEST_HARNESS_DUMP_TAP=$OUTPUT
export HARNESS_PERL_SWITCHES=-MDevel::Cover=-silent,off,-summary,off
export HARNESS_OPTIONS=j5
export TEST_VERBOSE=1
export TEST_POD=1
echo "Build package"
perl Makefile.PL
make
echo "Test package"
prove --merge --shuffle --timer --blib \
--formatter TAP::Formatter::JUnit > $OUTPUT/tests.xml \
|| echo "*** Failed test cases";
EXIT_STATUS=$?
echo "Make coverage"
(cd output; prove --nocolor --exec 'cat' $OUTPUT/t/*.t)
cover -select_re blib/lib -ignore_re '^t\/' -ignore_re '\/support\/'
if [ $EXIT_STATUS -ne 0 ];
then
echo "Exiting with $EXIT_STATUS"
exit $EXIT_STATUS
fi
echo "Make distribution"
make dist
echo "Publish distribution to CPAN"
PACKAGE_NAME=$(perl -MYAML=LoadFile -e "print LoadFile('META.yml')->{name}")
PACKAGE_CLASS=$(echo $PACKAGE_NAME | sed -e 's/-/::/g')
NEW_VERSION=$(perl -MYAML=LoadFile -e "print LoadFile('META.yml')->{version}")
CUR_VERSION=$(wget -q -O - http://cpanmetadb.appspot.com/v1.0/package/$PACKAGE_NAME | \
perl -MYAML=Load -e '$data=join("\n",<>); print Load($data)->{version} if $data')
if [ -n $NEW_VERSION ] && [ -n $CUR_VERSION ] && \
[ $(echo "$NEW_VERSION > $CUR_VERSION" | bc) -eq 1 ];
then
./support/bin/cpan-upload $PACKAGE_NAME-*.tar.gz
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.