- Java 8
- Java JDK 17
- Maven 3.9
- Git
Run the server
- Clone the repository
git clone https://github.com/joss2002/Continuous_Integration.git- Navigate to the repository and build the project with Maven
mvn clean compile- Run the CI-server
Without commit status notifications:
mvn exec:javaWith commit status notifications:
Bash
To set the status of commits, a github access token with commit status permission is required.
mvn exec:java -Dexec.mainClass=ci_server.Main -Dexec.args="<GITHUB ACCESS TOKEN>"PowerShell
To set the status of commits, a github access token with commit status permission is required.
mvn --% exec:java -Dexec.mainClass=ci_server.Main -Dexec.args="<GITHUB ACCESS TOKEN>"Test the server
Option 1: Use curl
curl http://localhost:8080/Expected output
StatusCode : 200
StatusDescription : OK
Content : CI job done (placeholder)Option 2: Open browser at http://localhost:8080/
Expected output
CI job done (placeholder)
Note: 8080 is the default port number.
- Run the server, see Run the server.
Bash
- Load local
JSONpayload test file
json=$(cat ./src/test/resources/githubPush.json)- Post JSON payload to the CI-server
curl http://localhost:8080/webhook \
-H "Content-Type: application/json" \
-d "$json"Expected output
Client side
HTTP/1.1 200 OK
Content-Length: 25
Date: Tue, 10 Feb 2026 12:27:04 GMT
Server: Jetty(9.4.50.v20221201)
Push received: e5f6g7h8Server side
Received push on branch : main
After SHA : e5f6g7h8
Repository URL : https://github.com/user/repo.git
Pusher name : name
Head commit message : Update READMEPowerShell
- Load local
JSONpayload test file
$json = Get-Content -Raw "./src/test/resources/githubPush.json"- Post JSON payload to the CI-server
Invoke-WebRequest -Uri http://localhost:8080/webhook `
-Method POST `
-Body $json `
-ContentType "application/json"Expected output
Client side
StatusCode : 200
StatusDescription : OK
Content : {80, 117, 115, 104...}
RawContent : HTTP/1.1 200 OK
Content-Length: 25
Date: Tue, 10 Feb 2026 12:27:04 GMT
Server: Jetty(9.4.50.v20221201)
Push received: e5f6g7h8Server side
Received push on branch : main
After SHA : e5f6g7h8
Repository URL : https://github.com/user/repo.git
Pusher name : name
Head commit message : Update READMEBash
Post invalid JSON to the CI-server
curl -X POST http://localhost:8080/webhook \
-H "Content-Type: application/json" \
-d '{Invalid JSON}'Expected output
Invalid payload: Invalid GitHub push payloadPowerShell
Post invalid JSON to the CI-server
Invoke-WebRequest `
-Uri http://localhost:8080/webhook `
-Method POST `
-Body '{Invalid JSON}' `
-ContentType "application/json"Expected output
Invoke-WebRequest : Invalid payload: Invalid GitHub push payload
At line:1 char:1
+ Invoke-WebRequest -Uri http://localhost:8080/webhook -Method POST -Bo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand-
Run the server, see Run the server.
-
In a separate terminal, start ngrok to expose port
8080:
ngrok http 8080-
Copy the forwarding URL (e.g.
https://xxxx.ngrok-free.app) from the ngrok output. -
In your GitHub repository, go to Settings > Webhooks > Add webhook and set:
- Payload URL:
https://xxxx.ngrok-free.app/webhook - Content type:
application/json - Events: Select "Just the push event"
- Payload URL:
-
Push a commit to the repository and observe the compilation output in the server console.
Browsable API documentation is generated using the Maven Javadoc plugin. To generate or update it:
mvn javadoc:javadocThe HTML documentation is output to docs/index.html. Open it in a browser:
open docs/index.html- Build the project with Maven
mvn clean compile- Run the
junitunit tests
mvn testWhen the CI server receives a GitHub push webhook on /webhook, it triggers compilation of the pushed branch. After compilation the Compiler class runs the tests. The Compiler class in se.ciserver.build performs the following steps:
- Creates a temporary directory
- Clones the specific branch using
git clone --branch <branch> --single-branch <url> - Checks out the exact commit SHA with
git checkout <sha> - Runs
mvn clean compilein the cloned project - Captures and prints the build output to the server console
- Runs
mvn testin the cloned project - Captures and prints the test output to the server console
- Cleans up the temporary directory
The compilation result (success/failure) and test result (success/failure) is returned in the HTTP response and shown on the ngrok site.
Compilation is unit-tested in src/test/java/MainTest.java with the following tests:
compilationResultStoresSuccess()— verifies that a successfulCompilationResultstoressuccess=trueand the build output.compilationResultStoresFailure()— verifies that a failedCompilationResultstoressuccess=falseand the build output.compilerHandlesCloneFailure()— subclassesCompilerto overridecreateProcessBuilder()with a failing command, verifying that a clone failure returnssuccess=falsewithout throwing an exception.compilerReturnsSuccessWhenAllStepsPass()— subclassesCompilerto overridecreateProcessBuilder()with a succeeding command, verifying the full pipeline returnssuccess=true.compilerReturnesFailedCompilationForBadInputs- verifies failed compilation results are returned for bad parameters.
To run the tests, see Perform unit tests.
Notifications are implemented by setting the status of commits using github's REST api. A post request containing the status is sent to the url of the push's last commit.
The notification implementation is tested by running a test server and sending the status post request to it instead, which checks that its contents are correct.
The build list url is http://localhost:8080/builds.
By analyzing the team, based on SEMAT standard [p.51-52], following this instance of the project, it could be concluded that currently positioned between "Formed" and "Collaborating". This because some of the checklist items are not met in relation to "Formed" but at the same time some checklist items has been fulfilled related to "Collaborating". The checklist looks as follows;
| State | Checklist |
|---|---|
| Formed |
|
| Collaborating |
|
In relation to the checklist it is of importance to understand why certain checkboxes has not been checked. Regarding the "Formed" state "All team members understand how to perform there work" has been kept unchecked due to all team members not following requested formatting and standards at all times. This could be a result of both miscommunication or that some sort of permanent source of information should have been created. In addition, "Each team member commits to working on the team as defined" was kept unchecked partly in relation to the previous point in terms of applying the standards in practice, but could also be rooted in the amount of initiative from the team regarding expectations.
Moving on, the "Collaborating" state had some unchecked requirements too. Firstly, "The team is working as one cohesive unit" was not checked mainly due to certain lack in providing information as well as actively participating in discussions at times, meaning that some team members will not be up to date on what is going on in the repository. Secondly, "The team members know and trust each other" was mainly left unchecked because lack of communication regarding progress and when certain parts of the work are expected to be done. Here some deadlines might have been useful to lower stress within the team, as well as being clearer on how to communicate details of contributed work and more clearly present what aspects has been tested successfully and how that was accomplished.
| Name | Contribution |
|---|---|
| Josefine "joss2002" Nyholm |
|
| Avid "HotFazz" Fayaz |
|
| Albin "zzimbaa" Blomqvist |
|
| Erik Olsson "erik-ol" |
|
| Pun Chun "MrNoodlez-1227" Chow |
|