Calliope Travis CI Integration¶
You can also integrate Calliope into your Travis CI pipeline.
Travis CI is very similar to Jenkins, except it's cloud-based and the pipelines require fewer lines of code. It can be integrated into a GitHub, GitLab, BitBucket or Assembla repository. This tutorial was written based on a GitHub repository.
To make use of this feature, you'll first need an account on Travis CI, which you can make here. You can sign up with a GitLab, GitHub, BitBucket or Assembla account. Pick whichever you prefer. Once you have an account, Travis Ci will give you the option to link your some of your repositories. Link any repository that you wish to integrate Calliope into.
If you don't have a repository to get started, feel free to use our Cucumber boilerplate test suite as an example.
Once your repository is set up in Travis CI, you need to add 2 environment variables. You can do this by going to your repository's settings within Travis CI (More options -> Settings) and going to Environment Variables. There you have to set the variables PROFILE_ID and API_KEY, which are your Calliope profile's ID and your Calliope API key respectively.
Once all your required repositories are linked, and the variables have been set, you can start writing the pipeline itself. Go to one of your linked repositories and create a file named .travis.yml. Paste this code into that file and tweak it to your liking:
language: ruby rvm: - 2.7 install: - bundle install script: - bundle exec cucumber -f json -o output.json -f pretty -c || true - curl -X POST -H 'x-api-key:'"$API_KEY"'' -H 'multipart/form-data' -F 'email@example.com' 'https://app.calliope.pro/api/v2/profile/'"$PROFILE_ID"'/import/cucumber?tag=myos&tag=myplatform&tag=mybuild'
The following variables are defined:
API_KEY: Required to import tests to Calliope.pro. Can be found on your Calliope.pro account page
PROFILE_ID: Tests will be imported in one of your profiles on Calliope.pro. You can find the ID in the curl command (see below).
The 'script:' part is the command that is going to run when the job gets triggered.
bundle exec cucumber -f json -o ./results/latest_results.json && trueruns all the Cucumber tests and stores the results in './results/latest_results.json'.
&& truemakes sure the next commands are also executed.
curl -X POST ...will import the tests into the Calliope.pro platform.
It is recommended to add the formatter to the endpoint to obtain the best interpreted results. More information about the recommended formatters here.
This pipeline will be triggered whenever something new is pushed to a specific branch. You can also manually trigger a build by clicking on "More options" and selecting "Trigger build".
If you did everything correctly, the result of your pipeline should show something along the lines of this on your Travis CI console logs: