Bitbucket Pipelines testing Perl projects
The really interesting part is the content of the bitbucket-pipelines.yml file that lists the 3 steps we usually run to prepare a module for testing and then running the tests.
image: perl:5.26 pipelines: default: - step: script: - perl Makefile.PL - make - make test
In the first case I only used standard module in my code. That is, modules that are available in every decent installation of Perl. For the next step I added a module called Path::Tiny that is only available form CPAN.
I've included a use Path::Tiny; in the module and also added Path::Tiny to the list of dependencies we maintain in Makefile.PL. When I pushed the changes out Bitbucket reported that the pipeline failed at the make test stage when we tried to load our module with the missing dependency.
We need to install the dependencies on the Docker image before running our tests.
On our own development machine we would use cpanm --installdeps . and so will we do in the pipeline. We only ned to add that as an entry in the scripts.
image: perl:5.26 pipelines: default: - step: script: - cpanm --installdeps . - perl Makefile.PL - make - make test
After commit this change and pushing it to Bitbucket the pipeline runs fine.
Published on 2021-11-01