Skip to content

Instantly share code, notes, and snippets.

@mataprasad
Forked from jsuwo/BankAccount.java
Created September 9, 2018 07:10
Show Gist options
  • Save mataprasad/152f979970b3b9bb44ed116100c45730 to your computer and use it in GitHub Desktop.
Save mataprasad/152f979970b3b9bb44ed116100c45730 to your computer and use it in GitHub Desktop.

Continuous Integration with Jenkins on Amazon EC2

Initial Setup

Fixing Locales in Ubuntu 13.04 on Amazon EC2

sudo apt-get install language-pack-en

Installing Jenkins

wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
echo "deb http://pkg.jenkins-ci.org/debian binary/" | sudo tee -a /etc/apt/sources.list.d/jenkins.list
sudo apt-get update
sudo apt-get install jenkins

Installing and Configuring Apache

Installing Apache

sudo apt-get install apache2
sudo a2enmod proxy
sudo a2enmod proxy_http

/etc/apache2/sites-available/jenkins.conf

<VirtualHost *:80>
	ServerName HOSTNAME
	ProxyRequests Off
	<Proxy *>
		Order deny,allow
		Allow from all
	</Proxy>
	ProxyPreserveHost on
	ProxyPass / http://localhost:8080/
</VirtualHost>

Enabling jenkins.conf

sudo a2ensite jenkins
sudo service apache2 reload

Installing Java / Maven / Git

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer maven git-core
package ca.uwo.csd.cs2212.USERNAME;
public class BankAccount {
private double balance;
public BankAccount(double balance) {
this.balance = balance;
}
public double debit(double amount) {
if (balance < amount) {
amount = balance;
}
balance -= amount;
return amount;
}
}
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>ca.uwo.csd.cs2212.USERNAME</groupId>
<artifactId>USERNAME-lab5</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>7</maven.compiler.source>
<maven.compiler.target>7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
</dependencies>
</project>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.6.4.201312101107</version>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
package ca.uwo.csd.cs2212.USERNAME;
import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
public class TestBankAccount {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment