Hello everyone, I’m super excited to help you out with installing Travis-CI. You might have some questions before we start!
What in the World is Travis-CI?
Don’t worry! Travis-CI is simply a CI (continuous integration) service to help you build/compile and test your projects. (mainly on github).
Is it hard to set up?
Absolutely not. It’s just a single yml (a data serialization language for configurations) file and some clicking here and there. You only need to set up .travis.yml so travis-ci knows how exactly to test your code, and in what conditions! Although it took me several tries to get my .travis.yml working.. here are some things to note!
Things to take note:
Travis may not work on every sort of android project (you really have to customize the configuration file accordingly… it might take you several tries to set it up as well. The simpliest thing like an image with a different signature type might totally just fail the test.
The travis.yml file that is at the end of this blog post may not be the same as your final intented one, so do make sure to make the appropriate changes to yours!
Let’s get started!
To get started, you’ll need a Travis-CI account, or you can log in via Github. I’ll skip this section and move on to the more important ones!
Next up, make sure you select the repository you want to put this on. I believe it has to be public, but i’m sure you can set it up for members within github organisations only.
Placing your (.travis.yml) file into your root directory of your project (in this case if it’s an android project –> where your build.gradle is (here is a picture of where mine is..)
Now, all you need to do is add a travis.yml file to trigger an inital build and see if it passes, if it doesn’t just check the logs.. It looks like this at the end, (PS, if you can’t trigger the build make sure you enable auto-build for push in your travis-ci project settings!)
or like this…
Although, you can see that Travis tells you the error and you can fix it. If you are working in a team, it helps to be able to self-test every last bit of code in a different environment so that you know your teammate will be getting a working copy, or not… Don’t worry if you get this problem though… just look up and see what’s going on!
Once you’re done, whenever a teammate commits and pushes the code… travis automatically picks up your latest repository version and tests (by reading how from your .travis.yml file!).. and you can see if it succeds or not! (PS: Travis also knows to cancel your tests whenever you update a readme.md file!)
You’re done! Congratulations on setting up your travis-ci project! If you require any help at all please feel free to email me @ brian(at)bchewy.com
My .travis.yml file! : https://raw.githubusercontent.com/bchewy/Project-Fosterships/master/.travis.yml
Useful documentation to customize your .travis.yml file : https://docs.travis-ci.com/user/languages/android/