Skip to content

Instantly share code, notes, and snippets.

@mbohun
Last active August 29, 2015 14:11
Show Gist options
  • Save mbohun/335253723b545be471db to your computer and use it in GitHub Desktop.
Save mbohun/335253723b545be471db to your computer and use it in GitHub Desktop.
Add travis support to a project

###Prerequirements

  • github token, hereafter refered to as $GITHUB_TOKEN
  • ruby/gem to install the travis client: sudo gem install travis

###Adding travis-ci support 1. git clone the project/repository you want to add travis support to, and cd into the clone
2. what type of project is it? Choose the appropriate .travis.yml template and copy it into the root of your git repo/project

3. add the .travis.yml file to your git repo/project:

git add .travis.yml

4. Use the travis client to login:

travis login --github-token $GITHUB_TOKEN

5. Enable travis-ci.org support for this github repo/project

travis enable --org --no-interactive

6. OPTIONAL step, configure/customize some of the travis-ci.org settings:

travis settings builds_only_with_travis_yml --enable --no-interactive
travis settings build_pull_requests --disable --no-interactive

7. ENCRYPT and add to .travis.yml all the encrypted env vars your git project uses/requires to build/test on travis-ci.org:

travis encrypt -a -p "TRAVIS_DEPLOY_USERNAME=deployment"
travis encrypt -a -p "SOME_OTHER_VAR=some-other-value-here"
...

8. Add your changes to git

git add .travis.yml

9. Add travis-ci build status badge to your README.md file, and add it to the git ($repo is your github repo/project name):

echo "### $repo   [![Build Status](https://travis-ci.org/AtlasOfLivingAustralia/$repo.svg?branch=master)](https://travis-ci.org/AtlasOfLivingAustralia/$repo)"

git add README.md

10. for grails application and grails plugin projects you need to add the release/publisher plugin to your grails project settings:

  • for grails < 2.3 add plugins.maven-publisher=0.8.1 to your application.properties, and git add application.properties
  • for grails >=2.3 add build ":release:3.0.1" to your grails-app/conf/BuildConfig.groovy, and git add grails-app/conf/BuildConfig.groovy

11. finally commit and push your changes to git/github

git commit -m "added travis-ci.org support"
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment