Alex
Alex

Reputation: 3381

Test travis-ci script without commit on github

Always that I need to test some change on .travis file I need to push my commit to github, and if it fail, it is a problem, I would like to know, if there are any way to test my .travis file before commit it, preferably on travis-ci vm, it means I want to make the process that travis does when I push some commti to github, but without need to commit or push my changes.

Upvotes: 15

Views: 4112

Answers (1)

VonC
VonC

Reputation: 1328152

You can run Travis-CI locally, in a docker image, in order to test your travis-ci.yml configuration file.

See "How to Run TravisCI locally on Docker": you can open a travis bash with:

docker run -it -u travis quay.io/travisci/travis-jvm /bin/bash

That article is about giving that local Travis instance access to your GitHub repo, but in your case, you can make a docker image (based on one of the Travis-CI ones) which would mount the local repo folder you have on your machine, and will be able to do a travis compile in that mounted folder within the container.

If the test passes in your local Travis-CI, then you can push your local commits to your GitHub repo.

Upvotes: 14

Related Questions