---
title: Continuous Integration with Jenkins And GitHub
url: https://www.qatouch.com/blog/continuous-integration-with-jenkins-and-github/
published: 2018-12-19T10:02:00+00:00
modified: 2018-12-19T10:02:00+00:00
author: Swathisri R
post_type: post
categories: [Integration Guides]
featured_image: https://www.qatouch.com/wp-content/uploads/2018/12/Continuous-Integration-with-Jenkins-And-GitHub.webp
word_count: 314
reading_time_minutes: 2
---

# Continuous Integration with Jenkins And GitHub

Jenkins is an open source [Continuous Integration](https://www.qatouch.com/blog/continuous-integration-an-insight/) tool written in Java with plugins built to fasten deployment cycle by continuous testing.

### Workflow of Continuous Integration with Jenkins

The below snapshot shows the workflow of continuous integration with Jenkins.

![CI with Jenkins GitHub](https://www.qatouch.com/wp-content/uploads/2018/12/CI-with-Jenkins-Git.png)

### Creating Simple Jenkins job with Github

For Jenkins Installation and Setup refer [Jenkins documentation](https://jenkins.io/download/).

Before creating a Jenkins job I have created a Git repository and added a sample file to it. Here is my sample file (example.java).

![sample code](https://www.qatouch.com/wp-content/uploads/2018/12/sample-code-1.png)

The snapshot shows the sample repository.

![Git repository](https://www.qatouch.com/wp-content/uploads/2018/12/Git-repository.png)

**Step 1**: Click on ‘**New Item**’ to create a new Jenkins job.

![Jenkins - new job](https://www.qatouch.com/wp-content/uploads/2018/12/Jenkins-new-job.png)

**Step 2:** Enter the name of Jenkins job, Choose ‘**Freestyle Project**’  and Click ‘**OK**’.

![Jenkins -job name and style](https://www.qatouch.com/wp-content/uploads/2018/12/jenkins-job-name-and-style.png)

**Step 3: **Enter Job Description if necessary(Optional).

**Step 4:** Select Source Code Management as ‘**Git**’ and paste the Repository URL of your Git repository.

![Jenkins - Git configuration](https://www.qatouch.com/wp-content/uploads/2018/12/Jenkins-Git-configuration.png)

**Step 5:** Under Build Triggers select ‘**Poll SCM**’ and define the schedule for the trigger.

Note: Here schedule is given as ‘* * * * *’ which means to schedule trigger for every minute. To know more about the schedule description click help.

![Jenkins - scheduling build trigger](https://www.qatouch.com/wp-content/uploads/2018/12/Jenkins-scheduling-build-trigger.png)

Now the Job checks Git repository once every minute for changes and triggers Build if any changes made in the Git repository.

**Step 6:** Under Build, Choose ‘Execute Windows batch command’ if you were running Jenkins in windows environment (or) Choose ‘Execute shell’ if you were running Jenkins in Linux environment.

![Jenkins - Adding Build steps](https://www.qatouch.com/wp-content/uploads/2018/12/Jenkins-Adding-Build-steps.png)

**Step 7:** Enter the commands for the build and click save.

![Jenkins - Build commands](https://www.qatouch.com/wp-content/uploads/2018/12/Jenkins-Build-commands.png)

The Jenkins project is created now.

![Jenkins - Job created](https://www.qatouch.com/wp-content/uploads/2018/12/Jenkins-Job-created.png)

### Continuous Testing Using Jenkins

When code committed into the repository. Here ‘example.java’ file is changed and committed.

![sample code 2](https://www.qatouch.com/wp-content/uploads/2018/12/sample-code-2.png)

Jenkins Build automatically triggered on code commit.

![Jenkins - Build running](https://www.qatouch.com/wp-content/uploads/2018/12/Jenkins-Build-running.png)

&nbsp;

The output is displayed on the console output like below.

![Jenkins - Build output](https://www.qatouch.com/wp-content/uploads/2018/12/Jenkins-Build-output.png)

Hope this blog serves as a good feed for your technology cravings. Bags of interesting stuff are down the pipeline and do stay subscribed to get notified about those.

**References**

[https://jenkins.io/doc/](https://jenkins.io/doc/)

[https://www.edureka.co/blog/jenkins-tutorial/](https://www.edureka.co/blog/jenkins-tutorial/)

[https://www.tutorialspoint.com/jenkins/](https://www.tutorialspoint.com/jenkins/)