First of all, what is CI?
Continuous Integration (CI) is a merging of all developers’ committed code to a repository several times a day. Each commit triggered the automation build script to compile the solution. Moreover, deployment of the committed code to the host server can be performed automatically.
Compilation result can be sent as email notification.
- This enables early detection of errors in the code.
- Allow for automatic deployment to host server.
- Prevent long and tense integrations of code.
This tutorial will help you in linking your GitHub Repository and your Travis CI.
You need to first have a GitHub account. If not, go to GitHub and click on the Sign Up button.
Already have your account? Cool, let’s proceed to the next step.
After login to your GitHub account, make sure you have at least one repository available. Also, you need to have .travis.yml file so that to enable compilation of your code.
The .travis.yml is a script that defines the programming language being used for your code and your solution name, hence allowing Travis CI to know what type of compiler is required to build your solution.
Go to Travis Documentation and select your programming language you are using. This will help you to create your .travis.yml file.
For me, since it is C#, my .travis.yml looks like this:
Place the .travis.yml file to the root of your solution.
Go to Travis CI and create an account with GitHub.
After you have all your accounts in place, on Travis CI, hover on your username on top right corner and click on account. Travis CI will then fetch the repositories from GitHub
Toggle the button of the repository you want to link with Travis CI and click on the Travis CI logo to go back to your dashboard. There you’ll find your repository.
Now your code for the repository that you have linked with Travis CI will be compiled after each commit you made on your GitHub Repository. After each compilation, you’ll receive an email to about the compilation result.