Skip to content

Commit

Permalink
Merge branch 'master' of github.com:zakariamaaraki/RemoteCodeCompiler
Browse files Browse the repository at this point in the history
  • Loading branch information
zakariamaaraki committed Dec 29, 2023
2 parents dff7e0d + ecfa068 commit a17e102
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/badges/jacoco.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions .github/workflows/build-PR.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build and Test (PR)

on:
pull_request:
branches: [master]

jobs:

build:
name: Build and Test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Set up JDK 11
uses: actions/setup-java@v1

with:
java-version: 1.11

- name: Maven Package
run: mvn clean install -Dmaven.test.skip=true

test-coverage:
needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 11

- run: ./environment/build.sh && mvn clean && sudo mvn -B verify -P coverage --no-transfer-progress

- name: jacoco-badge-generator
uses: cicirello/[email protected]
with:
generate-coverage-badge: true

- name: Log coverage percentage
run: |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}"
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}"
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
name: Build and Test
name: Build and Test (Merge to Master)

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:

build:
name: Build and Test
runs-on: ubuntu-18.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
Expand All @@ -34,7 +32,7 @@ jobs:
with:
java-version: 11

- run: cd environment && ./build.sh && cd .. && mvn clean && sudo mvn -B verify -P coverage --no-transfer-progress
- run: ./environment/build.sh && mvn clean && sudo mvn -B verify -P coverage --no-transfer-progress

- name: jacoco-badge-generator
uses: cicirello/[email protected]
Expand Down
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build and Test](https://github.com/zakariamaaraki/RemoteCodeCompiler/actions/workflows/build.yaml/badge.svg)](https://github.com/zakariamaaraki/RemoteCodeCompiler/actions/workflows/build.yaml) [![Docker](https://badgen.net/badge/icon/docker?icon=docker&label)](https://https://docker.com/) [![Test Coverage](https://github.com/zakariamaaraki/RemoteCodeCompiler/blob/master/.github/badges/jacoco.svg)](https://github.com/zakariamaaraki/RemoteCodeCompiler/actions/workflows/build.yaml)
[![Build and Test](https://github.com/zakariamaaraki/RemoteCodeCompiler/actions/workflows/build-master.yaml/badge.svg)](https://github.com/zakariamaaraki/RemoteCodeCompiler/actions/workflows/build.yaml) [![Docker](https://badgen.net/badge/icon/docker?icon=docker&label)](https://https://docker.com/) [![Test Coverage](https://github.com/zakariamaaraki/RemoteCodeCompiler/blob/master/.github/badges/jacoco.svg)](https://github.com/zakariamaaraki/RemoteCodeCompiler/actions/workflows/build.yaml)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)

# Remote Code Compiler
Expand Down Expand Up @@ -36,7 +36,7 @@ Supports **Rest Calls (Long Polling and [Push Notification](https://en.wikipedia

**Example of an ouput**

The compiler cleans up your output, so having extra spaces or line breaks does not affect the status of the response.
The compiler cleans up your output, which means having extra spaces or line breaks does not affect the status of the response.

```json
{
Expand Down Expand Up @@ -110,11 +110,11 @@ docker container run -p 8080:8082 -v /var/run/docker.sock:/var/run/docker.sock -

### Push Notifications
You may want to get the response later and to avoid http timeouts, you can use push notifications,
to do so you must pass two header values (**url** where you want to get the response and set **preferPush** to prefer-push)
to do so you should pass two header values (**url** where you want to get the response and set **preferPush** to prefer-push)

![push-notifications.png](images/webhooks.png)

To enable push notifications you must set **ENABLE_PUSH_NOTIFICATION** to true
To enable push notifications you should set the environment variable **ENABLE_PUSH_NOTIFICATION** to true

## Local Run (for dev environment only)
See the documentation in the [local](https://github.com/zakariamaaraki/RemoteCodeCompiler/tree/master/local) folder, a docker-compose is provided.
Expand Down Expand Up @@ -157,6 +157,8 @@ For the documentation visit the swagger page at the following url : http://<IP:P

### Verdicts

Here is a list of Verdicts that can be returned by the compiler:

:tada: **Accepted**
```json
{
Expand Down Expand Up @@ -351,7 +353,7 @@ It is also possible to visualize information about the images and docker contain
![remote code compiler kafka mode](images/kafka-streams.png?raw=true "Compiler Kafka Mode")

You can use the compiler with an event driven architecture.
To enable kafka mode you must pass to the container the following env variables :
To enable kafka mode you should pass to the container the following env variables :
* **ENABLE_KAFKA_MODE** : True or False
* **KAFKA_INPUT_TOPIC** : Input topic, json request
* **KAFKA_OUTPUT_TOPIC** : Output topic, json response
Expand All @@ -361,7 +363,8 @@ To enable kafka mode you must pass to the container the following env variables
* **CLUSTER_API_SECRET** : API Secret
* **KAFKA_THROTTLING_DURATION** : Throttling duration, by default set to 10000ms (when number of docker containers running reach MAX_REQUESTS, this value is used to do not lose the request and retry after this duration)

**More partitions => More Parallelism => Better performance**
> Note:
> Having More partitions => More Parallelism => Better performance
```shell
docker container run -p 8080:8082 -v /var/run/docker.sock:/var/run/docker.sock -e DELETE_DOCKER_IMAGE=true -e EXECUTION_MEMORY_MAX=10000 -e EXECUTION_MEMORY_MIN=0 -e EXECUTION_TIME_MAX=15 -e EXECUTION_TIME_MIN=0 -e ENABLE_KAFKA_MODE=true -e KAFKA_INPUT_TOPIC=topic.input -e KAFKA_OUTPUT_TOPIC=topic.output -e KAFKA_CONSUMER_GROUP_ID=compilerId -e KAFKA_HOSTS=ip_broker1,ip_broker2,ip_broker3 -e API_KEY=YOUR_API_KEY -e API_SECRET=YOUR_API_SECRET -t compiler
Expand All @@ -371,7 +374,7 @@ docker container run -p 8080:8082 -v /var/run/docker.sock:/var/run/docker.sock -

![remote code compiler rabbitMq mode](images/rabbitMq.png?raw=true "Compiler rabbitMq Mode")

To enable Rabbit MQ mode you must pass to the container the following env variables :
To enable Rabbit MQ mode you should pass to the container the following env variables :
* **ENABLE_RABBITMQ_MODE** : True or False
* **RABBIT_QUEUE_INPUT** : Input queue, json request
* **RABBIT_QUEUE_OUTPUT** : Output queue, json response
Expand Down

0 comments on commit a17e102

Please sign in to comment.