develooper Front page | perl.perl5.porters | Postings from January 2016

git client hook to enforce a smoke test before commit

Thread Next
From:
Jarkko Hietaniemi
Date:
January 29, 2016 22:17
Subject:
git client hook to enforce a smoke test before commit
Message ID:
56ABE4D5.2050603@iki.fi
I've been using this lately, saved me some oopsies, wrote them after 
some embarrassing and rage-inducing incidents.  I'm not that well versed 
in git, very probably enhancements and fixes can be made.

So what this does: before git push, a test build is launched, and only 
if that passes, and one hits 'y' in the keyboard, it gets truly pushed. 
There's special code for handling the "Greer smokes".

(1) The .git/hooks/pre-push is a symlink to the attached 
perl5-git-pre-push.sh

(2) That *.sh calls the attached perl-git-build which I have in my $PATH

(3) The perl-git-build opens $HOME/.perl-git-build.rc, sample below

In my setup my laptop is a little old and tired, but I have a relatively 
beefy and underutilized desktop.  The perl-git-guild ssh:s into it, 
prepares the source tree appropriately (see below) and does the build. 
That is the remote_host in the .rc file, like this:

remote_host=SERVER.NAME.HERE
remote_jobs=8
remote_git_clone_dir=perl5-git/perl
remote_configure_flags=

The perl-git-build can be used also explicitly to do quickie test 
builds.  There are three 'modes': plain, patch, and snapshot.  The 
'plain' mode just does a git clone of blead HEAD (I guess the name 
'plain' is not the best possible).  The 'patch' does git format-patch 
$origin_sha.. of the local head and in the build host applies those 
patches.  The 'snapshot' does git archive of of the local head and 
unpacks that in the remote host.

Enjoy responsibly.






Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About