Continuous integration and Continuous delivery or CI/CD is not a new name anymore in DevOps namespace and it is an imperative DevOps tool. There are many IT companies that are currently providing CI/CD services like Jenkins, CircleCI, Travis CI, etc.
This is a very basic article and in this tutorial, we will create a Travis CI account with GitHub (GH) and build our first successful project.
What is Travis CI?
Travis CI is a Germany-based company that helps customer to build and test their apps through their continuous integration platform. Travis CI is free for Open Source and provides paid plans for private code. It also has “Travis CI Enterprise” for customer who wants to run test their code securely on their premises.
Travis CI is written in Ruby and was founded in 2011. If you want to know more about the source code of Travis CI, you can look at their GitHub repo.
How to Create Travis CI Account?
Creating an account in Travis CI is the simplest thing you will do. You just have to click on the ‘Sign up‘ button and it will automatically create your account if you are logged in to your GitHub account or will ask you to log in first.
Once your GitHub account is connected with Travis CI, you will see the below screen. Now you just have to give Travis CI access to your GitHub repository, so that it can test and build from there.
At this step just click on “Activate all repositories using GitHub Apps“, which you will take you to the GitHub screen and there you can choose if you want to give access to all the repositories or only a few.
Now once you have authorized and installed Travis CI, it will show all your repository in the dashboard once you sign in again with your GitHub account.
Testing your Code and Building on Travis CI
Once you have your Travis CI dashboard ready, just create a new repository on GitHub if you have not created one already for testing your code.
For creating a new repository, go to your GitHub account and click on the ‘plus‘ sign (it will be on the top-right side) as shown below and create your new repo.
Now once your new public repository is created on GitHub, just got to Travis CI and click on “sync account” under my account tab. This should show your newly created repository. If you are not able to see, do let us know through comments.
Now, its time to add .travis.yml file to your repository, so that Travis can test and build your application.
We can start by just creating .travis.yml with a very simple configuration.
So for the first test, we just created a simple .travis.yml file with the below content and knew it will fail.
language: ruby rvm: - 2.2 - jruby
The build got failed as we didn’t provide other supporting commands.
Now, let’s take one fully working “Go language example” from here and test it.
Now once we have cloned this example and pushed it to our repository, Travis CI automatically detected the change and started testing and building the application.
So, this is how you test and build your application using continuous integration.
In this tutorial, you learned “how to create a free account at Travis CI, create a new repository on GitHub and run your first successful project“. Please do try other examples and also try to test and build your own software using this platform. If you want to see any other tutorial on Travis CI, do let us know through your comments.
If you like this article, please share it with your friends and colleague and if you want to see more articles on CI/CD, please subscribe to Storage Tutorials by Email.