/ docker

Configuring Travis CI with My Go Projects

Travis CI is a CI(Continuous Integration) tool which can help you build your applications. We are currently using Jenkins at work but I thought of giving Travis CI a spin since it is FREE for open source projects! It also has seamless integration with GitHub where most open source projects are hosted.

Using Travis CI is pretty straightforward if your project is hosted in GitHub. All you need to do is register at travis-ci.org using your GitHub account and you're ready. Once you've logged into Travis CI, it will show you this page. What's neat is it initially syncs your projects in GitHub.


Just select the GitHub project you want to build. It will automatically configure a webhook to build your project everytime you push new code to your project.

I am learning Go so I thought of using it to build the source of the GoLang applications I've been doing. Here is the repo I used.


Before Travis CI can build your project, you need to create a .travis.yml configuration which it will use.

[Reference] https://docs.travis-ci.com/user/languages/go/

Here is the configuration I used. https://github.com/donvito/learngo/blob/master/.travis.yml


    - language: go
      go: 1.9.x

    - [email protected]

I haven't really digged deeper but this configuration traverses the project and compiles all the .go source it can find. Very neat, huh! :)

Once you've created the .travis.yml file in the root folder of your project, Travis CI will automatically build the project without any manual triggering.



To add the build status in your README, click on the status "build|passing" in the job page. In my case, it is https://travis-ci.org/donvito/learngo


It will open this modal. Take the link and add to your project's README.md in GitHub.


That's it! Travis CI is free for all open-source projects so if you are building one, it would be cost-effective to setup rather than installing Jenkins.

Melvin Vivas

Melvin Vivas

Father of 2 wonderful kids, loves programming, wannabee gopher, currently working at an international bank. Bloggin' about Golang, Docker, and Kubernetes.

Read More