docs: detailed workflow explanation
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
张泊明518370910136 2024-03-31 02:03:51 -04:00
parent 9d15b0038f
commit 6348a0807b
GPG Key ID: D47306D7062CDA9D

View File

@ -2,7 +2,11 @@
## Quick Start ## Quick Start
To register the sandbox executor, you need to run go-judge before running this program. To register the sandbox executor, you need to run [go-judge](https://github.com/criyle/go-judge) before running this program.
**Hint for `go-judge`:** `go build -o ./tmp/go-judge ./cmd/go-judge && ./tmp/go-judge -enable-grpc -enable-debug -enable-metrics`
Then you can check the functions of `joj3` with the `make test`. The cases used here are in `/examples`.
```bash ```bash
$ make test $ make test
@ -49,13 +53,12 @@ pre-commit installed at .git/hooks/pre-commit
``` ```
## Models ## Models
The program parses the TOML file to run multiple stages.
Each stage contains an executor and parser. The program parses the configuration file to run multiple stages. It can create an issue on Gitea to report the result of each stage after all stages are done.
Executor takes a `Cmd` and returns an `ExecutorResult`. Each stage contains an executor and parser. An executor just executes a command and returns the original result (stdout, stderr, output files). We can limit the time and memory used by each command in the executor. We run all kinds of commands in executors of different stages, including code formatting, static check, compilation, and execution. A parser takes the result and the configuration of the stage to parse the result and return the score and comment. e.g. If in the current stage, the executor runs a `clang-tidy` command, then we can use the clang-tidy parser in the configuration file to parse the stdout of the executor result and check whether some of the rules are followed. We can deduct the score and add some comments based on the result, and return the score and comment as the output of this stage. This stage ends here and the next stage starts.
Parser takes an `ExecutorResult` and its conf and returns a `ParserResult` and `bool` to indicate whether we should skip the rest stages. In codes, an executor takes a `Cmd` and returns an `ExecutorResult`, while a parser takes an `ExecutorResult` and its conf and returns a `ParserResult` and `bool` to indicate whether we should skip the rest stages.
### `Cmd` ### `Cmd`