Gitea actions based, 3rd generation of joint online judge. https://github.com/joint-online-judge/JOJ3
Go to file
张佳澈520370910044 82c0146866
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is failing
fix(internal/executors/clang_tidy): Removing unused clang-tidy executors
2024-05-05 14:30:33 +08:00
cmd fix(cmd/joj3/main_test.go,-examples/clang-tidy,-internal/parsers/clang_tidy): Switched clang-tidy's executor to sandbox 2024-05-05 14:24:15 +08:00
examples fix(cmd/joj3/main_test.go,-examples/clang-tidy,-internal/parsers/clang_tidy): Switched clang-tidy's executor to sandbox 2024-05-05 14:24:15 +08:00
internal fix(internal/executors/clang_tidy): Removing unused clang-tidy executors 2024-05-05 14:30:33 +08:00
pkg feat: add dummy error example 2024-03-12 16:38:55 -04:00
.drone.yml ci: more prepare steps 2024-03-25 03:38:34 -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 chore: add gofumpt to pre-commit 2024-03-15 22:07:18 -04:00
.pre-commit-config.yaml chore: remove checkmake for windows support 2024-03-20 02:00:03 +08: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 chore: generate coverage report 2024-03-25 16:33:39 -04:00
README.md docs(README.md): Added link to go-judge Github repo 2024-03-29 14:57:46 +08:00

JOJ3

Quick Start

To register the sandbox executor, you need to run go-judge before running this program. Install go-judge and start it with go-judge -enable-grpc

$ make test
go test -v ./...
?       focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/cmd/dummy [no test files]
?       focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/executors        [no test files]
?       focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/executors/dummy  [no test files]
?       focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers/dummy    [no test files]
?       focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers  [no test files]
?       focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers/diff     [no test files]
?       focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/executors/sandbox        [no test files]
?       focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers/resultstatus     [no test files]
?       focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/stage    [no test files]
?       focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/pkg/dummy [no test files]
?       focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/pkg/healthcheck   [no test files]
=== RUN   TestMain
=== RUN   TestMain/success
    main_test.go:96: stageResults: [{Name:compile Results:[{Score:0 Comment:}]} {Name:run Results:[{Score:100 Comment:executor status: run time: 1910200 ns, memory: 13529088 bytes} {Score:100 Comment:executor status: run time: 1703000 ns, memory: 15536128 bytes}]}]
=== RUN   TestMain/compile_error
    main_test.go:96: stageResults: [{Name:compile Results:[{Score:0 Comment:Unexpected executor status: Nonzero Exit Status.}]}]
=== RUN   TestMain/dummy
    main_test.go:96: stageResults: [{Name:dummy Results:[{Score:110 Comment:dummy comment + comment from toml conf}]}]
=== RUN   TestMain/dummy_error
    main_test.go:96: stageResults: [{Name:dummy Results:[{Score:0 Comment:Unexpected executor status: Nonzero Exit Status.
        Stderr: dummy negative score: -1}]}]
--- PASS: TestMain (0.29s)
    --- PASS: TestMain/success (0.27s)
    --- PASS: TestMain/compile_error (0.01s)
    --- PASS: TestMain/dummy (0.01s)
    --- PASS: TestMain/dummy_error (0.01s)
PASS
ok      focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/cmd/joj3  0.295s

For developers

Install pre-commit, golangci-lint, goimports, gofumpt.

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 parses the TOML file to run multiple stages.

Each stage contains an executor and parser.

Executor takes a Cmd and returns an ExecutorResult.

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

Cmd

Check Cmd at 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 the sandbox, value: file name used in CopyOutCached.
  • LocalFile: now supports the relative path

ExecutorResult

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

ParserResult

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