You Get a Message from GitHub…

Continuous integration can help catch bugs by running your tests automatically. Merge your code with confidence using one of our continuous integration providers.

Travis CI

Travis CI is a automatic test and deploy tool. Travis CI helps make sure your code runs against all versions of your favorite language (supporting over 20 different languages) without breaking a sweat, giving your team the best tool to build all of their applications with confidence.

Supports your workflow like: Imgur

Getting started with Travid CI

#1. On GitHub, fork the example PHP repository.

#2. Sign in to Travis CI with your GitHub account, accepting the GitHub access permissions confirmation.

#3. 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 travis-broken-example repository.

Imgur

#4.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.php with phpunit against PHP versions 5.5, 5.4 and HHVM.

#5. Edit the empty NewUser.txt file 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

Wait for Travis CI to run a build on your fork of the travis-broken-example repository, check the build status and notice that the build fails. (Travis CI sends you an email when this happens)

#6. Fix the code by making sure that 2=1+1 in 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.

Problems I Met

If you try to git commit --amend to amend last commit, and try to git push --force to let your forked repository be forced updated. You will see the Travis CI build error under your forked repository like this: Imgur

The commit of Testing Travis CI: fixing the build should fix the build error, and it is not expected to see the build has errors.

Job logs says that: Imgur

Since you force push the branch that the Travis CI is not able to reference the last commit.

I do not know how to fix this, however, this would not be a problem with pushing a pull request (PR) to the primordial repository (the repository that you have forked). Seeing like this: Imgur

Slack Notifications

On Slack, set up a new Travis CI integration. Select a channel, and you’ll find the details to paste into your .travis.yml.

Just copy and paste the settings, which already include the proper token, into your .travis.yml, and you’re good to go.

Imgur

Dish of the day

Imgur #homemade

Reference

Travis CI
Travis CI Getting started
Travis CI for Complete Beginners