Interlude 2, in which I write more about the release pipeline

The author tests in my module publication pipeline are only one part of the task. The other tasks are actually running the checks, making sure that my public Github repositories are updated with each release and actually pushing the distribution file out onto CPAN. Of course, I have these steps automated.

The baseline for the automation is the release script as distributed with Module::Release. My version control system is Git, so I've also installed Module::Release::Git. I customized the CPAN upload part to use CPAN::Uploader back when the FTP upload was shut down. On reviewing, I've seen that Module::Release now switched to using Mojolicious for talking to the outside world. Until I have to upgrade my installation, I won't change my approach to the new world though.

My version of release also runs the author tests as stored in the xt/ directory of my distributions. These tests are run right before the real test suite is run, as some of my test suites take annoyingly long to run. When I'm at the stage of releasing a module, I mostly care about getting the distribution files in a consistent state, so the author tests are more important as the module tests are supposed to be passing anyway.

The steps for a release from my Debian box are as follows:

First, a fresh checkout from the repository is made. This is under the assumption that the repository is the ground truth and nothing will be released that is not also available in the repository.

if [ -d .git ]; then
    git checkout -f

Then, old release artifacts are cleaned up. These should be ignored anyway in MANIFEST.SKIP and .gitignore, but it doesn't hurt to wipe them out as well.

rm *.tar.gz
rm *.tar

For the upcoming run of the test suite, all prerequisite modules are installed. For my Windows-specific modules, this forces me to be honest here and have the Makefile.PL handle the case of not being able to install the module.

cpanm --installdeps .

With all the preparations made, Module::Release gets a try at running the test suite. Prerequisites are not explicitly checked, and I don't play the kwalitee game either.

~/bin/release-corion -k -p -C

if [[ $? -ne 0 ]]; then
    echo "Some error, not pushing ($?)"

Now the fresh distribution has been uploaded to CPAN. All that remains now is to update my Github repositories with the release.

if [[ -d .git ]]; then
    for REMOTE in $(git remote); do
        git push $REMOTE --tags && git push $REMOTE --all

So far, I have been too lazy to install Gitprep on my webserver. Using Gitprep would be a nice fallback for the case when Github goes the way of Sourceforce. There is no immediate need to do so though, as I don't really use the UI of Github much and retargeting the remote repositories is quickly done with git.

For releasing from the Windows machine, the first step is to push the repository to the Debian machine. From then on, I kick off the release on the Debian machine.

Leave a comment

About Max Maischein

user-pic I'm the Treasurer for the Frankfurt Perlmongers e.V. . I have organized Perl events including 9 German Perl Workshops and one YAPC::Europe.