Coveralls and Travis support for Loklak APIs

Today I will be talking about Coveralls and Travis integration into Loklak APIs.

Travis CI

Wikipedia defines it as:

Travis CI is a hosted, distributed continuous integration service used to build and test software projects hosted at GitHub.

Travis takes care of the tests and deployment of apps. Travis integration is really easy when you have your tests ready. It was a basic three step process:

  1. Registering the API repos with Travis.
  2. Adding .travis.yml to the API github repository. e.g. For loklak_php_api , the file looks like this.
    language and php versions are specified for which the API is to be tested.  We added phpunit Tests in script since we wanted Travis to execute the tests.
  3. Trigger the first build with a git push

And the first build is up.



Coveralls is a presentation of the coverage of test suite you pass to Travis to build. In layman language, Coveralls helps you find the lines in your code which were not tested by your Test Suite.

Coveralls integration is also simple, but might involve some googling if you are working on PHP. I will take the example of loklak_php_api here.

  1. Registering the API repo with Coveralls.
  2. Modifying the .travis.yml to this
  3. Creating a .coveralls.yml file to specify the paths required to send the coverage to Coveralls
  4. Since testing of only loklak.php was required, so a phpunit.xml file was added to exclude Tests and Requests directories from test suite.

After configuring the environment, there we have it. Coveralls result showing the code coverage of our test suite on loklak.php!

Coveralls and Travis support for Loklak APIs