Travis CI for Complete Beginners
If you’re not familiar with continuous integration and don’t already have a repository that you want to build, this guide will show you what it is all about.
You need to sign up for a GitHub account if you do not already have one.
To get started with Travis CI:
On GitHub, fork the example PHP repository.
Once you’re signed in, and we’ve synchronized your repositories from GitHub, go to your profile page and enable Travis CI builds for your fork of the
Note: You can only enable Travis CI builds for repositories you have admin access to.
Take a look at
.travis.yml, the file which tells Travis CI what to do:
language: php php: - 5.5 - 5.4 - hhvm script: phpunit Test.php
This file tells Travis CI that this project is written in PHP, and to test
Test.phpwith phpunit against PHP versions 5.5, 5.4 and HHVM.
Edit the empty
NewUser.txtfile by adding your name to the empty file. Add the file to git, commit and push, to trigger a Travis CI build:
$ git add -A $ git commit -m 'Testing Travis CI' $ git push
Note: Travis only runs a build on the commits you push after adding the repository to Travis.
Wait for Travis CI to run a build on your fork of the
travis-broken-examplerepository, check the build status and notice that the build fails. (Travis CI sends you an email when this happens)
Fix the code by making sure that
Test.php, commit and push to GitHub. This time, the build does not fail.
$ git add -A $ git commit -m 'Testing Travis CI: fixing the build' $ git push
Congratulations, you have added a GitHub repository to Travis and learnt the basics of configuring builds and testing code.
Note there is no need to make a pull request to the original repository, the build is run on your fork.