17 November 2018
Using Travis CI with Android
If you have been following my instagram then you know I have been looking into Continuous Integration/Continous Development, also known as CI/CD. Why am I doing this now? I think CI/CD can really speed up one’s development. From a business perspective it is great to have the computer manually build things for me on a certain schedule so that I don’t have to remember to do it. A great example of this would be for my company, Backpack Media, where I try to use 2 week development cycles. Instead of me having to wait so long to build what I’ve been working on for a given period of time, I can just let a serperate service build my code every 2 weeks so that I can just deliver the file to the client (I’m sure I can automate this as well).
I have worked with clients that use Circle CI before, but when I was looking for the best tool for Andorid I found mix reviews. That being said I’m going to be using Travis, Jenkins, and Circl CI for different projects and will let you know how that goes through these post and hopefully some videos (tba).
Why Travis for this project? (Pros & Cons)
Well Travis is a tool I was introduced to earlier this year at the Codeland Conference. I was able to use it in a python environment and I thought it was cool. So what was stopping me from jumping in then? Let’s discuss…
Con 1: Pricing structure
I know it might not always seem like it but I’m broke. Like college level broke. I’m in a transition period and there is just no way I have any more funds (personal or business) for a monthly sub to anything. I mean the price isn’t too steep so if you have the funds go be great.
Con 2: File Setup
It took so much googling to find the right things to put in my file. I also know this github repo was setup a bit differently so it took me awhile to figure out I needed to point travis to a folder within the repo.
Con 3: No Suppport
I was looking for answers to specific things/errors and couldn’t find what I was looking for. It was really frustrating, but I wonder if it’s due to the travis community or the fact that people actively try to avoid Android. Either way I’d love to see more post/videos on walking thru how to set up travis in a repo or even locally (if people do that sort of thing).
Pro 1: Pricing Structure
LOL you probably hate me now after I just complained about price. I’m sorry about that but I had to be honest. The pro of the pricing structure is that Travis is free for Open Source (OSS) Projects. OSS are public projects that anyone can make additions to make it better.
Pro 2: Easy to use
The interface for Travis is really simple. I feel like I didn’t spend a bunch of time setting up which project to pull from and such oppose to Jenkins. I spent more time on the actual coding of the
Pro 3: Documentation
I could really tell that the Travis team put effort in having quality docs. I appreciate it. Granted they cover more of the “I have test cases” type of situations but there were some really good explainations on what is already built in for every coding language in the event you are using a special package within your project.
The following code is my
.travis.yml file for my OSS that can be found here. This file basically tells travis what language my project is in and then it says “Hey fam! Before you start go to the ‘Ledger’ folder, make gradlew executable, and then build my code with the tools I specified in components.” Now this took me 19 commits to get right. The difference between what I have and the demo (from my understanding) is that I am just asking travis to make sure my project builds fine. I don’t actually have any built in test for it to run.
language: android sudo: required android: components: - platform-tools - build-tools-28.0.3 - android-28 - extra-google-m2repository - extra-android-m2repository script: - ./gradlew build before_install: - cd Ledger - chmod +x gradlew
I’d like to add in UI and unit test within my app to see how that works with Travis.
I would like to see if you can run builds for ios & andorid at the same time from different folders (I doubt it tbh). I do want to make the iOS version of this app and think it would be cool it I could keep both apps in one place (for now).
Try using travis with an open source project of another language such as node, python, or react native
Want to look up what all this means in depth? check out the docs hereBy: Keheira If you would like to donate to keep the content coming or just as a thank you, you can buy me a coffee or use cashapp.
tags: Travis CI - Travis - Continuous Integration/Continuous Development - CI/CD