Tuesday, November 28, 2017

Review: Is TravisCI my happy place?

This week I am working on Continuous Integration. The goal is to configure a few tests for my GitHub repository.

Finally, I am confident about my "no-stress-success" in this topic. At least I have seen .yml/.yaml files and I think that I am pretty good in writing pipelines using Concourse CI!

Anyway, my journey into a simpler life with Automatic tests started with creating an account with TravisCI. It was fast and simple process of clicking on "Login with GitHub" button.

I would say that interface is user-friendly and all the features you need can be found within a few seconds.

It's really rare that you got something right from the first time you tried it. So didn't happen to me this time. But even though a few of my builds failed, I enjoyed the experience. It was not stressful at all!

I would definitely recommend to use Travis CI for your projects. Spending about an hour to set up everything(including account creation and writing .travis.yml file) to test your code every time you or other contributors commit totally worth it! One hour worth work will save you much more time and brain storming in future!

So let's take a closer look at my .travis.yml file and see what's going on there.

1. language: go
3. go:
4. - master

In the first 4 lines I have configured Golang environment and the version I specified is master. Master is the latest version available.
6. notifications:
7. email: false

On the next few lines I have disabled email notifications. I don't know if they are enabled by default, but I can easily get annoyed by enormous amount of new "junk" emails. So to make sure I am still on the happy side of this experience I included some extra lines there. 

Edit: "The default settings will only email you if the build does not pass. And then you would get one email after it passes, letting you know the build was fixed." (c) Andy Alt 

More good news: there is an option to configure slack notifications! You can find out how to do that in Travis CI docs. I enjoyed their docs! Everything is quite clear and detailed.

8. before_script:
9. - go get -t ./...
10. - go get honnef.co/go/tools/cmd/megacheck

Next step is to install all the packages to build your project and additional testing tools. 

And here goes an actual script and testing process:
11. script:
12. - go test -v ./...
13. - go vet ./...
14. - megacheck ./...
15. - go test -v ./fileInfo

Bonus: a few useful links on for configuring Travis CI for Golang:
To conclude: I will definitely use Travis CI for my school and personal projects. I recommend you to at least try it out. And Travis CI is a happy place, at least for me.

It's only a beginning

What have I learned for the past 8 months of Open Source Programming? I was convinced from the very beginning that this course would be i...