Connecting GitHub, and TravisCI

Let's implement the real world scenario: every time we push to GitHub we want to run perl critic on Kritika rules and tests with coverage on TravisCI. Then we want to merge these results together in one place to be able to say: yes, this is a good commit (or a pull request)! Connecting all three services is an easy 3-steps process (5mins approximately).


You must have a GitHub account, duh! With it we will login later to Kritika and TravisCI.

Pick a Perl repository

Pick any pick repository, it doesn't have to be even your own one. You can do a fork of a popular repository.

Kritika configuration

Register (or Login) to Kritika using GitHub account:

Import your repository

Click on Import from Github button

And then choose your repository

Create a new Coverage profile

Go back to repository and click Edit

Add profile to the profiles section

That's it! Done configuring Kritika.

TravisCI configuration

Add to the repository travis.yml with the following configuration:

language: perl
    - "5.24"
    - cpanm -n Devel::Cover::Report::Kritika
    - cpanm -n -q --with-recommends --skip-satisfied --installdeps .
    - perl Build.PL && ./Build build && cover -test -report kritika

This will run tests with coverage and report it to the Kritika.

Enable repository in TravisCI configuration

That's it! Done configuring TravisCI.


Now create a new commit and push to your repository.

echo 'my changes' > README
git commit -am 'testing ci'
git push origin master

Viewing results

Now if you go back to Kritika, you can see that a new Snapshot was creating and it was analyzed. After couple minutes when TravisCI will finish running the tests with coverage the Snapshot will receive the report and it will look something likes this (coverage may vary :):

You can view the coverage file by file too:

The GitHub commits will also have a link to the Kritika report:

Have fun testing and reporting! If you have any questions you are more than welcome to ask!


blog comments powered by Disqus