Here is a CI server that supports continuous integration for Gradle projects. At each push to the project repo, the server is called as a webhook by Github. Then the server builds the project, runs all tests and sets the commit status.
The code is commented using JavaDoc-style comments.
To compile a browsable HTML file using:
Intellij:
- In the toolbar choose Tools->Generate JavaDoc
- Choose a directory to save it to and click generate
command line
- run
./gradlew javadocto generate JavaDocs, the files are saved in the directory build/docs/javadoc
The CI server can only be used by Gradle Java projects, specifically gradle-7.5.1 using JUnit5.
Make sure to include the following dependencies in build.gradle.
implementation 'org.junit.jupiter:junit-jupiter:5.8.1' testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1' testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
Store the access token in file oauthtoken.secret. The access token should be stored in plain text without quotes. The token must have access to the repo:status scope.
To build and test the server locally, clone this repository.
Intellij:
- reload build.gradle
- to run all tests run
testinbuild.gradle - run main program in
ContinuousIntegrationServerTest.java.
command line
- run
./gradlew buildto build project and run all tests - run
./gradlew runto launch server
In order for the project to use the CI, check the documentation.
Add http://188.150.30.242:8090/ in the Payload URL field, only select push events.
To retrieve older builds, browse the link http://188.150.30.242:8090/builds.html, which will show a list with links to all older builds. There you can choose to click on the link to a specific build to get more information. To implement this we have a database in JSON format in the "database" directory where all the build history is saved. Once a new build is made the build history is updated.
The compilation and test execution was implemented through using Gradle Tooling API.
The BuildLauncher builds the projects and runs specified tasks, defined in build.gradle.
For the CI server to be able to run all tests, the project should include the following in build.gradle.
This functionality has been tested by cloning a dummy repo with 2 separate branches.
One branch contains true tests, and one branch contains failed tests.
test {
useJUnitPlatform()
}
The branch assessment was created to test if the CI server is working correctly.
Server sets the commit status as per this documentation. The POST request sent to set the status must include a header containing an authorization token, generated in GitHub.
NOTE: Make sure to enable permission for the token to set commit statuses.
- Implement CI server running tests in project, in collaboration with Frida Grönberg.
- Commit status, in collaboration with the rest of the team.
- Put everything together, in collaboration with everyone else.
- Implement CI server running tests in project, in collaboration with Glacier Ali.
- Commit status, in collaboration with the rest of the team.
- Put everything together, in collaboration with everyone else.
- Clone repository function, in collaboration with Gustaf Bergmark.
- Commit status, in collaboration with the rest of the team.
- Put everything together, in collaboration with everyone else.
- Clone repository function, in collaboration with Adam Jama.
- Retrieve older builds in collaboration with Carl Peterson.
- Put everything together, in collaboration with everyone else.
- Set up server.
- Set up webhooks for the CI server
- Commit status, in collaboration with the rest of the team.
- Parsing of incoming HTTP request and its payload.
- Retrieve older builds in collaboration with Gustaf Bergmark
- Put everything together, in collaboration with everyone else.
- Commit status, in collaboration with the rest of the team.