Create a new configurable cron job with travis

Currently, Travis can only run cron job from a prefined branch. This is useful up to a certain point, for example, building the git hub page from gh-pages branch.

However, we would like to see having this feature a bit more useful. For example, for each PR we don’t want to run all the tests per se. To be specific, suppose a project has unit, integration and end-to-end tests and we only to trigger the unit and integration tests on each pull request. And we want to run the end-to-end each day as an example.

There is no way to configure such case with Travis as is.

A typical example of such projects having unit, integration and end-to-end tests can be found here: https://github.com/orrsella/scala-e2e-testing#running-the-tests

test for running unit tests
it:test for running integration tests
e2e:test for running end-to-end tests

This environment variable maybe works for you:

  • TRAVIS_EVENT_TYPE :
    Indicates how the build was triggered. One of push , pull_request , api , cron

Conditionals on how the build was triggered can run different tests. That is how I’m managing it.

2 Likes