GitHub Actions for Perl Development

GitHub Actions for Perl Development

You might remember that I’ve been taking an interest in GitHub Actions for the last year or so (I even wrote a book on the subject). And at the Perl Conference in Toronto last summer I gave a talk called “GitHub Actions for Perl Development” (here are the slides and the video).

During that talk, I mentioned a project I was working on to produce a set of reusable workflows that would make it easier for anyone to start using GitHub Actions in their Perl development. Although (as I said in the talk) things were moving pretty quickly on the project at the time, once I got back to London, several other things became more important and work on this project pretty much stalled. But over the last couple of weeks, I’ve returned to this project and I’ve finally got some of the workflows into a state where I’ve been using them successfully in my GitHub repos and I think they’re now ready for you to start using them in yours. There are three workflows that I’d like you to try:

  • cpan_test: This runs your test suite and reports on the results
  • cpan_coverage: This calculates the coverage of your test suite and reports the results. It also uploads the results to
  • cpan_perlcritic: This runs perlcritic over your code and reports on the results

And using these workflows in your GitHub repos is as simple as creating a new file in the .github/workflows directory which contains something like this:

There are a couple of parameters you can use to change the behaviour of these workflows. In the Toronto talk, I introduced the idea of a matrix of tests, where you can test against three operating systems (Linux, MacOS and Windows) and a list of Perl versions. By default, the cpan-test workflow uses all three operating systems and all production versions of Perl from 5.24 to 5.38. But you can change that by using the perl_version and os parameters. For example, if you only wanted to test on Ubuntu, using the most recent two versions of Perl, you could use this:

Annoyingly, the parameters to a reusable workflow can only be a single scalar value. That’s why we have to use a JSON-encoded string representing an array of values. Maybe this will get better in the future.

The cpan-perlcritic workflow also has a parameter. You can use level to change the level that perlcritic runs at. The default is 5 (the gentlest level) but if you were feeling particularly masochistic, you could do this:

The workflows are, of course, available on GitHub. It would be great to have some people trying them out and reporting back on their experiences. Raising issues and sending pull requests is very much encouraged.

Please let me know how you get on with them.





One response to “GitHub Actions for Perl Development”

  1. Dave Rolsky Avatar

    For providing a range of Perls you could accept a min_perl and max_perl input. You could even make one optional so something could do something like 5.30+ or “up to 5.28”.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.