Code Monkey home page Code Monkey logo

smallest-java-ci's Introduction

Acime

Acime, the "Awesome CI server" is a small HTTP-server which builds Gradle projects and interacts with Github as a continuous integration server.

Documentation

The system is documented in this README and should have fairly complete Javadoc strings. To build the documentation use:

gradle javadoc

The resulting documentation will be available in build/docs/javadoc/ as HTML files.

Dependencies

All dependencies are defined in the file build.gradle and will be automatically downloaded when built. The project uses JUnit for testing and Jetty as a HTTP server.

Installing and running

Ensure that Gradle (>= 5.1.1) and OpenJDK (>= 1.8) are installed and run the following instructions in your favourite terminal:

git clone
cd smallest-java-ci
gradle build

To start the server run

gradle run

and the server will be available at port 8080!

Structure and contributing

If you want to implement a new feature you probably want to add a new route. To do this alter the code in ContinuousIntegrationServer#handle similar to the way that the current code is.

We expect you to at least supply unit tests to any substantial changes to the codebase.

The structure of what you should do for a new feature looks like this:

  1. Make a new issue on Github
  2. Assign yourself to it
  3. Make a branch such as feat_issuenumber_shortdescription
  4. Commit your code with a message mentioning the issue number
  5. Open a pull request referencing the issue number
  6. Await code-review

Contributions

Johan Sjölén

  • Set up Gradle, JUnit, Jetty, Servlets
  • Wrote the HTTP routing
  • Wrote the Gradle communication interface
  • Wrote some JSON parsing and extraction (uses the Jetty JSON parser :-))
  • Wrote the file system writer class
  • Wrote some basic HTML generation for the indexes (to show a list of builds)
  • Did some debugging of others code
  • Did some code reviews
  • Wrote this README (except the contributions)
  • Write some HTTP requests (along with basic Github POSt request)

Nikhil Modak

  • Wrote Git Communication Interface
  • Wrote most of Webhook Handler method which invokes the Git + Gradle interfaces
  • Troubleshot + Debugged outstanding issues
  • Did Code Reviews

Jagan Moorthy

  • GitHub Status(notification)
  • Mail module(Currently dead code, as GitHub status works)

Tom Axblad

  • Wrote the file system reader class
  • Wrote connection between HTML generation and file system reader
  • Did code reviews

smallest-java-ci's People

Contributors

aronstrandberg avatar mangoglass avatar modnikhil avatar monperrus avatar seven2four83 avatar

Watchers

 avatar  avatar

smallest-java-ci's Issues

Parse PullRequest event

A PullRequest event has a relatively small number of fields which are of interest to us.

In this issue I'll be specifying which these are and code will be provided which extract them into some data class (probably).

Read logs

Read logs previously saved on disk.

Fix htmlPostamble initialization

In ContinuousIntegrationServer.java, the htmlPostamble variable is initialized with the value </html></body>.

It should be changed to </body></html>.

Run Git + Gradle commands upon Webhook

Standalone Git and Gradle functionality is present. It's time to utilize them in ContinuousIntegrationServer.java.

TODOs:

  • Collect clone_url + commit sha from payload (Partially Done in #13 )
  • Call cloneRepo(clone_url)
  • Call checkoutCommit(repoDir, commitHash)
  • Call buildAt(repoDir)
  • Call testAt(repoDir)
  • Pipe build + test outputs to [TBD]

Set-up main routing system

Set-up the routing as defined here:

/webhook - Github's webhook route, POST requests from Github to here.
/build - Present last 100 builds (indexed by hash)
/test - Present last 100 tests (indexed by hash)
/build/$someHashHere - Present build at $someHashHere if available
/test/$someHashHere - Present test at $someHashHere if available

The routing will only be a skeleton so far with placeholder values.

Fix the Gradle tests

Currently the gradle tests are run by running gradle test/build etc. on our own repo. This means that an infinite recursion is prone to occur! Fix this by adding a file to the directory before continuing.

MAIN FEATURES (P1, P2, P3): Compile and test on PullRequestEvent

Many sub-issues can be created from this feature, please create such sub-issues and reference this main issue. This is meant to be a more formalized version of the features described in the assignment.

We should utilize the X-GitHub-Event parameter to dispatch on the type of event the webhook will handle.

This feature represents our support for the pull_request event type.

When such an event is received the server should:

  1. Parse the JSON body
  2. Check if the action == "opened"
  3. If so pull out the merge_commit_sha SHA
  4. Do a git checkout of the hash

4a. Do a gradle compileJava of the checked out hash
5a. Save results of build to disk
6a. Post comment of results to the pull request page.

4b. Do a gradle test of the checked out hash
5b. Save results of build to disk
6b. Post comment of results to the pull request page.

References:
https://developer.github.com/v3/activity/events/types/#pullrequestevent
https://developer.github.com/webhooks/
https://developer.github.com/v3/issues/comments/#create-a-comment

Save logs

Save logs in folder buildresults/hash+date.log

Git Clone + Checkout functionality on server

When our server receives a POST request from a GitHub webhook, our serve should pull the newest updates from the remote repository, and checkout the branch which had changes made to it. Both repo name and commit SHA should be visible in the webhook payload

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.