RoboPeer is a webserver designed to grade your code in a safe environment. It allows you to submit code and have it "graded" without any worries about potential malicious activities.
This project was created using bun init
in bun v1.1.4. Bun is a fast all-in-one JavaScript runtime.
The grading process involves comparing the output of the provided git repository (after compiling it) to a series of tests run with bun:test
. RoboPeer then returns the results of these tests. With an appropriate status code.
RoboPeer can also grade direct code submissions via /evaluate/git
.
200
- All tests passed.408
- Timeout for testing.422
- Skill issue (bad code)500
- RoboPeer failed.
Requires Bun.sh to install dependencies.
To install dependencies:
bun install
To run:
bun run api-get # Fetches Dockers OpenAPI spec
bun run dev
To build:
bun run build # Outputs JS
bun run compile # Outputs a 98~mb binary
To create a new reference project, use the following command:
bun run new < project-name >
Make sure Docker
is installed and running on your machine.
Build the Docker image:
#Git Image runner
docker build -t w2wizard/git ./docker/git
#Single Code runner
docker build -t w2wizard/single ./docker/single
The server by default run on http://localhost:8080. To send a request to it you can use the following curl command:
# For git repositories
curl -XPOST -H "Content-type: application/json" -d '{
"data": {
"repo": "https://github.com/fbescodam/libft.git",
"branch": "master",
"commit": "67dc80a"
}
}' 'http://localhost:3001/evaluate/git/lib'
# For single files
# Note: This example will not work as the code is invalid
# Fork bombs won't work on the server
curl -XPOST -H "Content-type: application/json" -d '{
"data": {
"args": [],
"content": "int main() { while(1) { fork() } }",
"flags": [
"-Wno-implicit-function-declaration"
],
"lang": "c"
}
}' 'http://localhost:3001/evaluate/code'