Gitea actions based, 3rd generation of joint online judge. https://github.com/joint-online-judge/JOJ3
Go to file
张泊明518370910136 dcb56b9e4f
All checks were successful
continuous-integration/drone/push Build is passing
chore: upgrade go to 1.22.1
2024-03-12 03:57:32 -04:00
cmd/joj3 style: setup pre-commit 2024-03-12 03:55:32 -04:00
examples chore: move /_example to /examples 2024-03-08 18:48:13 -05:00
internal feat: submit to gitea after stages done 2024-03-06 02:29:00 -05:00
pkg/healthcheck refactor: move healthcheck to /pkg 2024-03-03 03:20:48 -05:00
.drone.yml style: setup pre-commit 2024-03-12 03:55:32 -04:00
.editorconfig feat: cgroups v1 runner 2024-03-01 01:38:09 -05:00
.gitignore chore: update .gitignore for macos & win 2024-03-08 18:39:08 -05:00
.golangci.yml style: setup pre-commit 2024-03-12 03:55:32 -04:00
.pre-commit-config.yaml style: setup pre-commit 2024-03-12 03:55:32 -04:00
go.mod chore: upgrade go to 1.22.1 2024-03-12 03:57:32 -04:00
go.sum style: setup pre-commit 2024-03-12 03:55:32 -04:00
Makefile style: setup pre-commit 2024-03-12 03:55:32 -04:00
README.md style: setup pre-commit 2024-03-12 03:55:32 -04:00

JOJ3

Quick Start

In order to register the sandbox executor, you need to run go-judge before running this program.

$ export CONF_GITEATOKEN="<YOUR_TOKEN>" && make clean && make && ./examples/success/run.sh && ./examples/compile_error/run.sh
rm -rf ./build/*
rm -rf *.out
go build -o ./build/joj3 ./cmd/joj3
++ dirname -- ./examples/success/run.sh
+ DIRNAME=./examples/success
+ cd ./examples/success
+ ./../../build/joj3
+ cat ./joj3_result.json
[{"Name":"compile","Results":[{"Score":0,"Comment":""}]},{"Name":"run","Results":[{"Score":100,"Comment":"executor status: run time: 2811900 ns, memory: 16658432 bytes"},{"Score":100,"Comment":"executor status: run time: 2578200 ns, memory: 13094912 bytes"}]}]
+ rm -f ./joj3_result.json
+ cd -
++ dirname -- ./examples/compile_error/run.sh
+ DIRNAME=./examples/compile_error
+ cd ./examples/compile_error
+ ./../../build/joj3
+ cat ./joj3_result.json
[{"Name":"compile","Results":[{"Score":0,"Comment":"Unexpected executor status: Nonzero Exit Status."}]}]
+ rm -f ./joj3_result.json
+ cd -

For developers

Install pre-commit, golangci-lint, goimports.

Then install the pre-commit hooks. It will run some checks before you commit.

$ pre-commit install
pre-commit installed at .git/hooks/pre-commit

Models

The program parse the TOML file to run multiple stages.

Each stage contains a executor and parser.

Executor takes a Cmd and returns a ExecutorResult.

Parser takes a ExecutorResult and its config and returns a ParserResult and bool to indicate whether we should skip the rest stages.

Cmd

Check Cmd in https://github.com/criyle/go-judge#rest-api-interface.

Some difference:

  • CopyInCwd bool: set to true to add everything in the current working directory to CopyIn.
  • CopyInCached map[string]string: key: file name in sandbox, value: file name used in CopyOutCached.
  • LocalFile: now support relative path

ExecutorResult

Check Result in https://github.com/criyle/go-judge#rest-api-interface.

ParserResult

  • Score int: score of the stage.
  • Comment string: comment of the stage.