refactor/main #11

Merged
李衍志523370910113 merged 23 commits from refactor/main into dev 2025-02-27 15:51:32 +08:00
40 changed files with 619 additions and 694 deletions

View File

@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check out repository code - name: Check out repository code
uses: https://gitea.com/BoYanZh/checkout@focs uses: actions/checkout@focs
- name: Display Python3 version - name: Display Python3 version
run: python3 --version run: python3 --version
- name: Install PDM - name: Install PDM

View File

@ -15,16 +15,25 @@
3. Change dir to the repo, `cd JOJ3-config-generator` 3. Change dir to the repo, `cd JOJ3-config-generator`
4. Install deps by `pdm install && pdm run pre-commit install` 4. Install deps by `pdm install && pdm run pre-commit install`
5. Run the cli app by `pdm run app --help` 5. Run the cli app by `pdm run app --help`
6. Check other commands or scripts with `pdm run --list`
## How to use? ## How to use?
- `joj3-config-generator convert` function is now supported, currently support three flags: - `joj3-config-generator convert` function is now supported, currently support one argument as input, it indicates the **convert root**
- default value on the server can be given as `/home/tt/.config/joj`
- **NOTE:** the user should ensure that the ideal `repo.toml` file is in the sub-directory of the **convert root**
- the intended immutable files should be placed at a sub-directory named `immutable_files` at same position as the `repo.toml` file
- `-d/--distribute`: Add it without other input, it indicates script is ready to convert things other than testcases within the project ```shell
- `-c/--conf-root`: This is where you want to put all your 'task.toml' type folders, default choice for your input can be '/home/tt/.config/joj/' [nuvole0217@Nuvole test]$ tree .
- `-r/--repo-root`: This would be where you put your 'repo.toml' file as well as your 'immutable files', they should all be at same place, default choice for your input can be 'immutable_files', which is the folder at the position '/home/tt/.config/joj/' .
|- immutable_files
| |-- push.yaml
| |-- release.yaml
|-- repo.toml
```
- sample command on the server - sample command on the server
```shell ```shell
joj3-config-generator convert -d -c /home/tt/.config/joj/ -r immutable_files joj3-config-generator convert /home/tt/.config/joj
``` ```

View File

@ -22,9 +22,7 @@ from joj3_config_generator.processers.task import (
) )
def convert( def convert(repo_conf: repo.Config, task_conf: task.Config) -> result.Config:
repo_conf: repo.Config, task_conf: task.Config, repo_root: Path
) -> result.Config:
# Create the base ResultConf object # Create the base ResultConf object
result_conf = result.Config( result_conf = result.Config(
name=task_conf.task.name, name=task_conf.task.name,
@ -49,7 +47,7 @@ def convert(
not repo_conf.force_skip_heatlh_check_on_test not repo_conf.force_skip_heatlh_check_on_test
or os.environ.get("PYTEST_CURRENT_TEST") is None or os.environ.get("PYTEST_CURRENT_TEST") is None
): ):
healthcheck_stage = get_healthcheck_config(repo_conf, repo_root) healthcheck_stage = get_healthcheck_config(repo_conf)
result_conf.stage.stages.append(healthcheck_stage) result_conf.stage.stages.append(healthcheck_stage)
stages: List[str] = [] stages: List[str] = []
# Convert each stage in the task configuration # Convert each stage in the task configuration
@ -75,26 +73,3 @@ def convert_joj1(joj1_conf: joj1.Config) -> task.Config:
release=task.Release(deadline=None, begin_time=None), release=task.Release(deadline=None, begin_time=None),
stages=[], stages=[],
) )
def distribute_json(folder_path: str, repo_obj: Any, repo_conf: Path) -> None:
for root, _, files in os.walk(folder_path):
for file in files:
if file.endswith(".toml"): # to pass test here
toml_file_path = os.path.join(root, file)
json_file_path = os.path.join(root, file.replace(".toml", ".json"))
with open(toml_file_path) as toml_file:
task_toml = toml_file.read()
task_obj = rtoml.loads(task_toml)
result_model = convert(
repo.Config(**repo_obj), task.Config(**task_obj), repo_conf
)
result_dict = result_model.model_dump(by_alias=True, exclude_none=True)
with open(json_file_path, "w") as result_file:
json.dump(result_dict, result_file, ensure_ascii=False, indent=4)
result_file.write("\n")
print(f"Successfully convert {toml_file_path} into json!")
assert os.path.exists(
json_file_path
), f"Failed to convert {toml_file_path} into json!"

View File

@ -1,21 +1,37 @@
import json import json
import os
from pathlib import Path from pathlib import Path
from typing import Any, Dict
import inquirer
import rtoml import rtoml
import typer import typer
import yaml import yaml
from typing_extensions import Annotated
from joj3_config_generator.convert import convert as convert_conf from joj3_config_generator.convert import convert as convert_conf
from joj3_config_generator.convert import convert_joj1 as convert_joj1_conf from joj3_config_generator.convert import convert_joj1 as convert_joj1_conf
from joj3_config_generator.convert import distribute_json
from joj3_config_generator.models import joj1, repo, task from joj3_config_generator.models import joj1, repo, task
from joj3_config_generator.utils.logger import logger from joj3_config_generator.utils.logger import logger
app = typer.Typer(add_completion=False) app = typer.Typer(add_completion=False)
@app.command()
def create(toml: typer.FileTextWrite) -> None:
"""
Create a new JOJ3 toml config file
"""
logger.info("Creating")
questions = [
inquirer.List(
"size",
message="What size do you need?",
choices=["Jumbo", "Large", "Standard", "Medium", "Small", "Micro"],
),
]
answers = inquirer.prompt(questions)
logger.info(answers)
@app.command() @app.command()
def convert_joj1(yaml_file: typer.FileText, toml_file: typer.FileTextWrite) -> None: def convert_joj1(yaml_file: typer.FileText, toml_file: typer.FileTextWrite) -> None:
""" """
@ -31,54 +47,39 @@ def convert_joj1(yaml_file: typer.FileText, toml_file: typer.FileTextWrite) -> N
@app.command() @app.command()
def convert( def convert(
root: Path = typer.Option( root: Annotated[
Path("."), Path,
"--conf-root", typer.Argument(
"-c", help="root directory of config files, "
help="This is where you want to put all your 'task.toml' type folders, default choice for your input can be '/home/tt/.config/joj/'", "located at /home/tt/.config/joj in JTC"
), ),
repo_path: Path = typer.Option( ] = Path(".")
Path("."),
"--repo-root",
"-r",
help="This would be where you put your 'repo.toml' file as well as your 'immutable files', they should all be at same place, default choice for your input can be 'immutable_files', which is the folder at the position '/home/tt/.config/joj/'",
),
distribute: bool = typer.Option(
False, "--distribute", "-d", help="This flag determine whether to distribute"
),
) -> None: ) -> None:
"""
Convert given dir of JOJ3 toml config files to JOJ3 json config files
"""
logger.info(f"Converting files in {root.absolute()}") logger.info(f"Converting files in {root.absolute()}")
if distribute is False: root = root.absolute()

@bomingzh can we consder here to make repo_conf.path to store the abosolute value?

@bomingzh can we consder here to make `repo_conf.path` to store the abosolute value?
repo_toml_path = os.path.join(repo_path.absolute(), "basic", "repo.toml") for repo_toml_path in root.glob("**/repo.toml"):
else: repo_path = repo_toml_path.parent
repo_toml_path = os.path.join("/home/tt/.config/joj", repo_path, "repo.toml") repo_obj = rtoml.loads(repo_toml_path.read_text())
repo_toml_path = os.path.join(repo_path, "repo.toml") for task_toml_path in repo_path.glob("**/*.toml"):
with open(repo_toml_path, encoding=None) as repo_file: if repo_toml_path == task_toml_path:
repo_toml = repo_file.read() continue
repo_obj = rtoml.loads(repo_toml) toml_name = task_toml_path.name.removesuffix(".toml")
if distribute is False: result_json_path = task_toml_path.parent / f"{toml_name}.json"
task_toml_path = os.path.join(root.absolute(), "basic", "task.toml") logger.info(
result_json_path = os.path.join(root.absolute(), "basic", "task.json") f"Converting {repo_toml_path} & {task_toml_path} to {result_json_path}"
)
with open(task_toml_path, encoding=None) as task_file: task_obj = rtoml.loads(task_toml_path.read_text())
task_toml = task_file.read() repo_conf = repo.Config(**repo_obj)
repo_conf.root = root

repo_conf.path as absolute

`repo_conf.path` as absolute
task_obj = rtoml.loads(task_toml) repo_conf.path = repo_toml_path.relative_to(root)
result_model = convert_conf( task_conf = task.Config(**task_obj)

task_conf.path as absolute

`task_conf.path` as absolute
repo.Config(**repo_obj), task.Config(**task_obj), repo_path task_conf.root = root
) task_conf.path = task_toml_path.relative_to(root)
result_dict = result_model.model_dump(by_alias=True, exclude_none=True) result_model = convert_conf(repo_conf, task_conf)
result_dict = result_model.model_dump(by_alias=True, exclude_none=True)
with open(result_json_path, "w", encoding=None) as result_file: with result_json_path.open("w") as result_file:
json.dump(result_dict, result_file, ensure_ascii=False, indent=4) json.dump(result_dict, result_file, ensure_ascii=False, indent=4)
result_file.write("\n") result_file.write("\n")
# distribution on json
# need a get folder path function
else:
folder_path = "/home/tt/.config/joj"
folder_path = f"{Path.home()}/Desktop/engr151-joj/home/tt/.config/joj/homework"
folder_path = f"{Path.home()}/Desktop/FOCS/JOJ3-config-generator/tests/convert/"
# to be used in real action
folder_path = f"{root}"
distribute_json(folder_path, repo_obj, repo_path)

View File

@ -1,4 +1,5 @@
from typing import List from pathlib import Path
from typing import List, Optional
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
@ -21,3 +22,5 @@ class Config(BaseModel):
max_total_score: int = Field(100) max_total_score: int = Field(100)
force_skip_heatlh_check_on_test: bool = False force_skip_heatlh_check_on_test: bool = False
groups: Groups = Groups() groups: Groups = Groups()
root: Path = Path(".")
path: Path = Path("repo.toml")

View File

@ -1,7 +1,8 @@
from datetime import datetime from datetime import datetime
from pathlib import Path
from typing import Any, Dict, List, Optional, Type from typing import Any, Dict, List, Optional, Type
from pydantic import BaseModel, Field, model_serializer, model_validator from pydantic import BaseModel, Field, model_validator
class ParserResultDetail(BaseModel): class ParserResultDetail(BaseModel):
@ -107,6 +108,8 @@ class Task(BaseModel):
class Config(BaseModel): class Config(BaseModel):
task: Task root: Optional[Path] = None
release: Release path: Optional[Path] = None
task: Task # Task name (e.g., hw3 ex5)
release: Release # Release configuration
stages: List[Stage] # list of stage configurations stages: List[Stage] # list of stage configurations

View File

@ -37,7 +37,7 @@ def get_teapot_stage(repo_conf: repo.Config) -> result.StageDetail:
return stage_conf return stage_conf
def get_healthcheck_args(repo_conf: repo.Config, repo_root: Path) -> str: def get_healthcheck_args(repo_conf: repo.Config) -> str:
repoSize = repo_conf.max_size repoSize = repo_conf.max_size
immutable = repo_conf.files.immutable immutable = repo_conf.files.immutable
repo_size = f"-repoSize={str(repoSize)} " repo_size = f"-repoSize={str(repoSize)} "
@ -59,7 +59,7 @@ def get_healthcheck_args(repo_conf: repo.Config, repo_root: Path) -> str:
for meta in required_files: for meta in required_files:
args = args + meta args = args + meta
args = args + get_hash(immutable, repo_root) args = args + get_hash(immutable, repo_conf)
args = args + immutable_files args = args + immutable_files
@ -84,9 +84,7 @@ def get_debug_args(repo_conf: repo.Config) -> str:
return args return args
def get_healthcheck_config( def get_healthcheck_config(repo_conf: repo.Config) -> result.StageDetail:
repo_conf: repo.Config, repo_root: Path
) -> result.StageDetail:
healthcheck_stage = result.StageDetail( healthcheck_stage = result.StageDetail(
name="healthcheck", name="healthcheck",
group="", group="",
@ -96,7 +94,7 @@ def get_healthcheck_config(
default=result.Cmd(), default=result.Cmd(),
cases=[ cases=[
result.OptionalCmd( result.OptionalCmd(
args=shlex.split(get_healthcheck_args(repo_conf, repo_root)), args=shlex.split(get_healthcheck_args(repo_conf)),
), ),
result.OptionalCmd( result.OptionalCmd(
args=shlex.split(get_debug_args(repo_conf)), args=shlex.split(get_debug_args(repo_conf)),
@ -113,7 +111,7 @@ def get_healthcheck_config(
return healthcheck_stage return healthcheck_stage
def calc_sha256sum(file_path: str) -> str: def calc_sha256sum(file_path: Path) -> str:
sha256_hash = hashlib.sha256() sha256_hash = hashlib.sha256()
with open(file_path, "rb") as f: with open(file_path, "rb") as f:
for byte_block in iter(lambda: f.read(65536 * 2), b""): for byte_block in iter(lambda: f.read(65536 * 2), b""):
@ -122,22 +120,17 @@ def calc_sha256sum(file_path: str) -> str:
def get_hash( def get_hash(
immutable_files: list[str], repo_root: Path immutable_files: list[str], repo_conf: repo.Config
) -> str: # input should be a list ) -> str: # input should be a list
# FIXME: should be finalized when get into the server repo_path = (repo_conf.root / repo_conf.path).parent
current_file_path = Path(__file__).resolve() file_path = Path(f"{repo_path}/immutable_files")
project_root = current_file_path.parents[2]
# FIXME: givin the path
file_path = f"{project_root}/tests/immutable_file/"
# file_path = "{Path.home()}/.cache/immutable"
# to be use
# file_path = f"/home/tt/.config/joj/{repo_root}/"
immutable_hash = [] immutable_hash = []
immutable_files_ = []
for i, file in enumerate(immutable_files): for i, file in enumerate(immutable_files):
immutable_files[i] = file_path + file.rsplit("/", 1)[-1] immutable_files_.append(file_path.joinpath(file.rsplit("/", 1)[-1]))
for i, file in enumerate(immutable_files): for i, file_ in enumerate(immutable_files_):
immutable_hash.append(calc_sha256sum(file)) immutable_hash.append(calc_sha256sum(file_))
hash_check = "-checkFileSumList=" hash_check = "-checkFileSumList="

View File

@ -276,7 +276,13 @@ def fix_diff(
stage_cases.append( stage_cases.append(
result.OptionalCmd( result.OptionalCmd(
stdin=result.CmdFile( stdin=result.CmdFile(
src=f"/home/tt/.config/joj/{task_conf.task.type_}/{stdin}" src=(
(task_conf.root / task_conf.path)
.parent.joinpath(stdin)
.name
if task_conf.root is not None and task_conf.path is not None
else f"/home/tt/.config/joj/{task_conf.task.type_}/{stdin}"
)
), ),
args=(shlex.split(command) if command is not None else None), args=(shlex.split(command) if command is not None else None),
cpu_limit=cpu_limit, cpu_limit=cpu_limit,
@ -299,7 +305,16 @@ def fix_diff(
{ {
"score": diff_output.score, "score": diff_output.score,
"fileName": "stdout", "fileName": "stdout",
"answerPath": f"/home/tt/.config/joj/{task_conf.task.type_}/{stdout}", "answerPath": (
(task_conf.root / task_conf.path)
.parent.joinpath(stdout)
.name
if (
task_conf.root is not None
and task_conf.path is not None
)
else f"/home/tt/.config/joj/{task_conf.task.type_}/{stdout}"
),
"forceQuitOnDiff": diff_output.forcequit, "forceQuitOnDiff": diff_output.forcequit,
"alwaysHide": diff_output.hide, "alwaysHide": diff_output.hide,
"compareSpace": not diff_output.ignorespaces, "compareSpace": not diff_output.ignorespaces,

View File

@ -0,0 +1,33 @@
*.avi filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.djvu filter=lfs diff=lfs merge=lfs -text
*.doc filter=lfs diff=lfs merge=lfs -text
*.docx filter=lfs diff=lfs merge=lfs -text
*.epub filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.ipynb filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.JPEG filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.JPG filter=lfs diff=lfs merge=lfs -text
*.mkv filter=lfs diff=lfs merge=lfs -text
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.ods filter=lfs diff=lfs merge=lfs -text
*.odt filter=lfs diff=lfs merge=lfs -text
*.otf filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.PDF filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.PNG filter=lfs diff=lfs merge=lfs -text
*.ppt filter=lfs diff=lfs merge=lfs -text
*.pptx filter=lfs diff=lfs merge=lfs -text
*.ps filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.webm filter=lfs diff=lfs merge=lfs -text
*.xls filter=lfs diff=lfs merge=lfs -text
*.xlsx filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,23 @@
################################
## White list based gitignore ##
################################
# forbidden
*
.*
# allowed
!.gitignore
!.gitattributes
!.gitea/
!.gitea/issue_template/
!.gitea/workflows/
!*.yaml
!Makefile
!CMakeLists.txt
!h[0-8]/
!*.m
!*.c
!*.cpp
!*.h
!*.md

View File

@ -0,0 +1,19 @@
name: Run JOJ3 on Push
on: [push]
jobs:
run:
container:
image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:focs-ubuntu-latest-slim
volumes:
- /home/tt/.config:/home/tt/.config
- /home/tt/.cache:/home/tt/.cache
- /home/tt/.ssh:/home/tt/.ssh
steps:
- name: Check out repository code
uses: https://gitea.com/BoYanZh/checkout@focs
with:
fetch-depth: 0
- name: run joj3
run: |
sudo -E -u tt joj3 -conf-root /home/tt/.config/joj/tests/homework

View File

@ -0,0 +1,21 @@
name: Run JOJ3 on Release
on:
release:
types: [published]
jobs:
run:
container:
image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:focs-ubuntu-latest-slim
volumes:
- /home/tt/.config:/home/tt/.config
- /home/tt/.cache:/home/tt/.cache
- /home/tt/.ssh:/home/tt/.ssh
steps:
- name: Check out repository code
uses: https://gitea.com/BoYanZh/checkout@focs
with:
fetch-depth: 0
- name: run joj3
run: |
sudo -E -u tt joj3 -conf-root "/home/tt/.config/joj/tests/homework" -conf-name "conf-release.json" -tag "${{ github.ref_name }}"

View File

@ -7,117 +7,9 @@
"maxTotalScore": 100, "maxTotalScore": 100,
"stage": { "stage": {
"sandboxExecServer": "172.17.0.1:5051", "sandboxExecServer": "172.17.0.1:5051",
"sandboxToken": "test", "sandboxToken": "",
"outputPath": "/tmp/joj3_result.json", "outputPath": "/tmp/joj3_result.json",
"stages": [ "stages": [
{
"name": "healthcheck",
"group": "",
"executor": {
"name": "local",
"with": {
"default": {
"env": [
"PATH=/usr/bin:/bin:/usr/local/bin"
],
"stdin": {
"content": "",
"max": 419430400
},
"stdout": {
"name": "stdout",
"max": 4096
},
"stderr": {
"name": "stderr",
"max": 4096
},
"cpuLimit": 4000000000000,
"realCpuLimit": 0,
"clockLimit": 8000000000000,
"memoryLimit": 838860800,
"stackLimit": 0,
"procLimit": 50,
"cpuRateLimit": 0,
"cpuSetLimit": "",
"copyIn": {},
"copyInCached": {},
"copyInDir": ".",
"copyOut": [
"stdout",
"stderr"
],
"copyOutCached": [],
"copyOutMax": 0,
"copyOutDir": "",
"tty": false,
"strictMemoryLimit": false,
"dataSegmentLimit": false,
"addressSpaceLimit": false
},
"cases": [
{
"args": [
"/usr/local/bin/repo-health-checker",
"-root=.",
"-repoSize=50.5",
"-meta=README.md",
"-meta=Changelog.md",
"-checkFileSumList=a5b63323a692d3d8b952442969649b4f823d58dae26429494f613df160710dfc,b1bbad25b830db0a77b15a033f9ca1b7ab44c1d2d05056412bd3e4421645f0bf,f6740081487ca34963a005209e2e9adfdf6f3561719af082d40fe80145e0cceb,bbeca1491c2f8364821a328a6677c0c5d59ccd60250abac3cec0887eeb9bde3e",
"-checkFileNameList=.gitignore,.gitattributes,.gitea/workflows/push.yaml,.gitea/workflows/release.yaml"
],
"env": [
"PATH=/usr/bin:/bin:/usr/local/bin"
],
"cpuLimit": 4000000000000,
"clockLimit": 8000000000000,
"memoryLimit": 838860800,
"procLimit": 50,
"copyOut": [
"stdout",
"stderr"
]
},
{
"args": [
"/usr/local/bin/joint-teapot",
"joj3-check-env",
"/home/tt/.config/teapot/teapot.env",
"--grading-repo-name",
"ece280-joj",
"--group-config",
"joj=1000:24,run=1000:24,=100:24"
],
"env": [
"LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log"
],
"cpuLimit": 4000000000000,
"clockLimit": 8000000000000,
"memoryLimit": 838860800,
"procLimit": 50,
"copyOut": [
"stdout",
"stderr"
]
}
]
}
},
"parsers": [
{
"name": "healthcheck",
"with": {
"score": 1
}
},
{
"name": "debug",
"with": {
"score": 0
}
}
]
},
{ {
"name": "[cq] Clang-tidy", "name": "[cq] Clang-tidy",
"group": "cq", "group": "cq",
@ -159,11 +51,11 @@
"cpuSetLimit": "", "cpuSetLimit": "",
"copyIn": { "copyIn": {
"tests/homework/h7/.clang-tidy": { "tests/homework/h7/.clang-tidy": {
"src": "/home/tt/.config/joj/tools/tests/homework/h7/.clang-tidy", "src": "/home/tt/.config/joj/tests/homework/h7/.clang-tidy",
"max": 419430400 "max": 419430400
}, },
"h7/build/compile_commands.json": { "h7/build/compile_commands.json": {
"src": "/home/tt/.config/joj/tools/h7/build/compile_commands.json", "src": "/home/tt/.config/joj/h7/build/compile_commands.json",
"max": 419430400 "max": 419430400
} }
}, },

View File

@ -0,0 +1,33 @@
*.avi filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.djvu filter=lfs diff=lfs merge=lfs -text
*.doc filter=lfs diff=lfs merge=lfs -text
*.docx filter=lfs diff=lfs merge=lfs -text
*.epub filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.ipynb filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.JPEG filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.JPG filter=lfs diff=lfs merge=lfs -text
*.mkv filter=lfs diff=lfs merge=lfs -text
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.ods filter=lfs diff=lfs merge=lfs -text
*.odt filter=lfs diff=lfs merge=lfs -text
*.otf filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.PDF filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.PNG filter=lfs diff=lfs merge=lfs -text
*.ppt filter=lfs diff=lfs merge=lfs -text
*.pptx filter=lfs diff=lfs merge=lfs -text
*.ps filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.webm filter=lfs diff=lfs merge=lfs -text
*.xls filter=lfs diff=lfs merge=lfs -text
*.xlsx filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,23 @@
################################
## White list based gitignore ##
################################
# forbidden
*
.*
# allowed
!.gitignore
!.gitattributes
!.gitea/
!.gitea/issue_template/
!.gitea/workflows/
!*.yaml
!Makefile
!CMakeLists.txt
!h[0-8]/
!*.m
!*.c
!*.cpp
!*.h
!*.md

View File

@ -0,0 +1,19 @@
name: Run JOJ3 on Push
on: [push]
jobs:
run:
container:
image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:focs-ubuntu-latest-slim
volumes:
- /home/tt/.config:/home/tt/.config
- /home/tt/.cache:/home/tt/.cache
- /home/tt/.ssh:/home/tt/.ssh
steps:
- name: Check out repository code
uses: https://gitea.com/BoYanZh/checkout@focs
with:
fetch-depth: 0
- name: run joj3
run: |
sudo -E -u tt joj3 -conf-root /home/tt/.config/joj/tests/homework

View File

@ -0,0 +1,21 @@
name: Run JOJ3 on Release
on:
release:
types: [published]
jobs:
run:
container:
image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:focs-ubuntu-latest-slim
volumes:
- /home/tt/.config:/home/tt/.config
- /home/tt/.cache:/home/tt/.cache
- /home/tt/.ssh:/home/tt/.ssh
steps:
- name: Check out repository code
uses: https://gitea.com/BoYanZh/checkout@focs
with:
fetch-depth: 0
- name: run joj3
run: |
sudo -E -u tt joj3 -conf-root "/home/tt/.config/joj/tests/homework" -conf-name "conf-release.json" -tag "${{ github.ref_name }}"

View File

@ -7,117 +7,9 @@
"maxTotalScore": 100, "maxTotalScore": 100,
"stage": { "stage": {
"sandboxExecServer": "172.17.0.1:5051", "sandboxExecServer": "172.17.0.1:5051",
"sandboxToken": "test", "sandboxToken": "",
"outputPath": "/tmp/joj3_result.json", "outputPath": "/tmp/joj3_result.json",
"stages": [ "stages": [
{
"name": "healthcheck",
"group": "",
"executor": {
"name": "local",
"with": {
"default": {
"env": [
"PATH=/usr/bin:/bin:/usr/local/bin"
],
"stdin": {
"content": "",
"max": 419430400
},
"stdout": {
"name": "stdout",
"max": 4096
},
"stderr": {
"name": "stderr",
"max": 4096
},
"cpuLimit": 4000000000000,
"realCpuLimit": 0,
"clockLimit": 8000000000000,
"memoryLimit": 838860800,
"stackLimit": 0,
"procLimit": 50,
"cpuRateLimit": 0,
"cpuSetLimit": "",
"copyIn": {},
"copyInCached": {},
"copyInDir": ".",
"copyOut": [
"stdout",
"stderr"
],
"copyOutCached": [],
"copyOutMax": 0,
"copyOutDir": "",
"tty": false,
"strictMemoryLimit": false,
"dataSegmentLimit": false,
"addressSpaceLimit": false
},
"cases": [
{
"args": [
"/usr/local/bin/repo-health-checker",
"-root=.",
"-repoSize=50.5",
"-meta=README.md",
"-meta=Changelog.md",
"-checkFileSumList=a5b63323a692d3d8b952442969649b4f823d58dae26429494f613df160710dfc,b1bbad25b830db0a77b15a033f9ca1b7ab44c1d2d05056412bd3e4421645f0bf,f6740081487ca34963a005209e2e9adfdf6f3561719af082d40fe80145e0cceb,bbeca1491c2f8364821a328a6677c0c5d59ccd60250abac3cec0887eeb9bde3e",
"-checkFileNameList=.gitignore,.gitattributes,.gitea/workflows/push.yaml,.gitea/workflows/release.yaml"
],
"env": [
"PATH=/usr/bin:/bin:/usr/local/bin"
],
"cpuLimit": 4000000000000,
"clockLimit": 8000000000000,
"memoryLimit": 838860800,
"procLimit": 50,
"copyOut": [
"stdout",
"stderr"
]
},
{
"args": [
"/usr/local/bin/joint-teapot",
"joj3-check-env",
"/home/tt/.config/teapot/teapot.env",
"--grading-repo-name",
"ece280-joj",
"--group-config",
"joj=1000:24,run=1000:24,=100:24"
],
"env": [
"LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log"
],
"cpuLimit": 4000000000000,
"clockLimit": 8000000000000,
"memoryLimit": 838860800,
"procLimit": 50,
"copyOut": [
"stdout",
"stderr"
]
}
]
}
},
"parsers": [
{
"name": "healthcheck",
"with": {
"score": 1
}
},
{
"name": "debug",
"with": {
"score": 0
}
}
]
},
{ {
"name": "[cq] Cppcheck", "name": "[cq] Cppcheck",
"group": "cq", "group": "cq",

View File

@ -0,0 +1,33 @@
*.avi filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.djvu filter=lfs diff=lfs merge=lfs -text
*.doc filter=lfs diff=lfs merge=lfs -text
*.docx filter=lfs diff=lfs merge=lfs -text
*.epub filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.ipynb filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.JPEG filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.JPG filter=lfs diff=lfs merge=lfs -text
*.mkv filter=lfs diff=lfs merge=lfs -text
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.ods filter=lfs diff=lfs merge=lfs -text
*.odt filter=lfs diff=lfs merge=lfs -text
*.otf filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.PDF filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.PNG filter=lfs diff=lfs merge=lfs -text
*.ppt filter=lfs diff=lfs merge=lfs -text
*.pptx filter=lfs diff=lfs merge=lfs -text
*.ps filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.webm filter=lfs diff=lfs merge=lfs -text
*.xls filter=lfs diff=lfs merge=lfs -text
*.xlsx filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,23 @@
################################
## White list based gitignore ##
################################
# forbidden
*
.*
# allowed
!.gitignore
!.gitattributes
!.gitea/
!.gitea/issue_template/
!.gitea/workflows/
!*.yaml
!Makefile
!CMakeLists.txt
!h[0-8]/
!*.m
!*.c
!*.cpp
!*.h
!*.md

View File

@ -0,0 +1,19 @@
name: Run JOJ3 on Push
on: [push]
jobs:
run:
container:
image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:focs-ubuntu-latest-slim
volumes:
- /home/tt/.config:/home/tt/.config
- /home/tt/.cache:/home/tt/.cache
- /home/tt/.ssh:/home/tt/.ssh
steps:
- name: Check out repository code
uses: https://gitea.com/BoYanZh/checkout@focs
with:
fetch-depth: 0
- name: run joj3
run: |
sudo -E -u tt joj3 -conf-root /home/tt/.config/joj/tests/homework

View File

@ -0,0 +1,21 @@
name: Run JOJ3 on Release
on:
release:
types: [published]
jobs:
run:
container:
image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:focs-ubuntu-latest-slim
volumes:
- /home/tt/.config:/home/tt/.config
- /home/tt/.cache:/home/tt/.cache
- /home/tt/.ssh:/home/tt/.ssh
steps:
- name: Check out repository code
uses: https://gitea.com/BoYanZh/checkout@focs
with:
fetch-depth: 0
- name: run joj3
run: |
sudo -E -u tt joj3 -conf-root "/home/tt/.config/joj/tests/homework" -conf-name "conf-release.json" -tag "${{ github.ref_name }}"

View File

@ -7,117 +7,9 @@
"maxTotalScore": 100, "maxTotalScore": 100,
"stage": { "stage": {
"sandboxExecServer": "172.17.0.1:5051", "sandboxExecServer": "172.17.0.1:5051",
"sandboxToken": "test", "sandboxToken": "",
"outputPath": "/tmp/joj3_result.json", "outputPath": "/tmp/joj3_result.json",
"stages": [ "stages": [
{
"name": "healthcheck",
"group": "",
"executor": {
"name": "local",
"with": {
"default": {
"env": [
"PATH=/usr/bin:/bin:/usr/local/bin"
],
"stdin": {
"content": "",
"max": 419430400
},
"stdout": {
"name": "stdout",
"max": 4096
},
"stderr": {
"name": "stderr",
"max": 4096
},
"cpuLimit": 4000000000000,
"realCpuLimit": 0,
"clockLimit": 8000000000000,
"memoryLimit": 838860800,
"stackLimit": 0,
"procLimit": 50,
"cpuRateLimit": 0,
"cpuSetLimit": "",
"copyIn": {},
"copyInCached": {},
"copyInDir": ".",
"copyOut": [
"stdout",
"stderr"
],
"copyOutCached": [],
"copyOutMax": 0,
"copyOutDir": "",
"tty": false,
"strictMemoryLimit": false,
"dataSegmentLimit": false,
"addressSpaceLimit": false
},
"cases": [
{
"args": [
"/usr/local/bin/repo-health-checker",
"-root=.",
"-repoSize=50.5",
"-meta=README.md",
"-meta=Changelog.md",
"-checkFileSumList=a5b63323a692d3d8b952442969649b4f823d58dae26429494f613df160710dfc,b1bbad25b830db0a77b15a033f9ca1b7ab44c1d2d05056412bd3e4421645f0bf,f6740081487ca34963a005209e2e9adfdf6f3561719af082d40fe80145e0cceb,bbeca1491c2f8364821a328a6677c0c5d59ccd60250abac3cec0887eeb9bde3e",
"-checkFileNameList=.gitignore,.gitattributes,.gitea/workflows/push.yaml,.gitea/workflows/release.yaml"
],
"env": [
"PATH=/usr/bin:/bin:/usr/local/bin"
],
"cpuLimit": 4000000000000,
"clockLimit": 8000000000000,
"memoryLimit": 838860800,
"procLimit": 50,
"copyOut": [
"stdout",
"stderr"
]
},
{
"args": [
"/usr/local/bin/joint-teapot",
"joj3-check-env",
"/home/tt/.config/teapot/teapot.env",
"--grading-repo-name",
"ece280-joj",
"--group-config",
"joj=1000:24,run=1000:24,=100:24"
],
"env": [
"LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log"
],
"cpuLimit": 4000000000000,
"clockLimit": 8000000000000,
"memoryLimit": 838860800,
"procLimit": 50,
"copyOut": [
"stdout",
"stderr"
]
}
]
}
},
"parsers": [
{
"name": "healthcheck",
"with": {
"score": 1
}
},
{
"name": "debug",
"with": {
"score": 0
}
}
]
},
{ {
"name": "[cq] Cpplint", "name": "[cq] Cpplint",
"group": "cq", "group": "cq",

View File

@ -0,0 +1,33 @@
*.avi filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.djvu filter=lfs diff=lfs merge=lfs -text
*.doc filter=lfs diff=lfs merge=lfs -text
*.docx filter=lfs diff=lfs merge=lfs -text
*.epub filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.ipynb filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.JPEG filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.JPG filter=lfs diff=lfs merge=lfs -text
*.mkv filter=lfs diff=lfs merge=lfs -text
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.ods filter=lfs diff=lfs merge=lfs -text
*.odt filter=lfs diff=lfs merge=lfs -text
*.otf filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.PDF filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.PNG filter=lfs diff=lfs merge=lfs -text
*.ppt filter=lfs diff=lfs merge=lfs -text
*.pptx filter=lfs diff=lfs merge=lfs -text
*.ps filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.webm filter=lfs diff=lfs merge=lfs -text
*.xls filter=lfs diff=lfs merge=lfs -text
*.xlsx filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,23 @@
################################
## White list based gitignore ##
################################
# forbidden
*
.*
# allowed
!.gitignore
!.gitattributes
!.gitea/
!.gitea/issue_template/
!.gitea/workflows/
!*.yaml
!Makefile
!CMakeLists.txt
!h[0-8]/
!*.m
!*.c
!*.cpp
!*.h
!*.md

View File

@ -0,0 +1,19 @@
name: Run JOJ3 on Push
on: [push]
jobs:
run:
container:
image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:focs-ubuntu-latest-slim
volumes:
- /home/tt/.config:/home/tt/.config
- /home/tt/.cache:/home/tt/.cache
- /home/tt/.ssh:/home/tt/.ssh
steps:
- name: Check out repository code
uses: https://gitea.com/BoYanZh/checkout@focs
with:
fetch-depth: 0
- name: run joj3
run: |
sudo -E -u tt joj3 -conf-root /home/tt/.config/joj/tests/homework

View File

@ -0,0 +1,21 @@
name: Run JOJ3 on Release
on:
release:
types: [published]
jobs:
run:
container:
image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:focs-ubuntu-latest-slim
volumes:
- /home/tt/.config:/home/tt/.config
- /home/tt/.cache:/home/tt/.cache
- /home/tt/.ssh:/home/tt/.ssh
steps:
- name: Check out repository code
uses: https://gitea.com/BoYanZh/checkout@focs
with:
fetch-depth: 0
- name: run joj3
run: |
sudo -E -u tt joj3 -conf-root "/home/tt/.config/joj/tests/homework" -conf-name "conf-release.json" -tag "${{ github.ref_name }}"

View File

@ -7,117 +7,9 @@
"maxTotalScore": 100, "maxTotalScore": 100,
"stage": { "stage": {
"sandboxExecServer": "172.17.0.1:5051", "sandboxExecServer": "172.17.0.1:5051",
"sandboxToken": "test", "sandboxToken": "",
"outputPath": "/tmp/joj3_result.json", "outputPath": "/tmp/joj3_result.json",
"stages": [ "stages": [
{
"name": "healthcheck",
"group": "",
"executor": {
"name": "local",
"with": {
"default": {
"env": [
"PATH=/usr/bin:/bin:/usr/local/bin"
],
"stdin": {
"content": "",
"max": 419430400
},
"stdout": {
"name": "stdout",
"max": 4096
},
"stderr": {
"name": "stderr",
"max": 4096
},
"cpuLimit": 4000000000000,
"realCpuLimit": 0,
"clockLimit": 8000000000000,
"memoryLimit": 838860800,
"stackLimit": 0,
"procLimit": 50,
"cpuRateLimit": 0,
"cpuSetLimit": "",
"copyIn": {},
"copyInCached": {},
"copyInDir": ".",
"copyOut": [
"stdout",
"stderr"
],
"copyOutCached": [],
"copyOutMax": 0,
"copyOutDir": "",
"tty": false,
"strictMemoryLimit": false,
"dataSegmentLimit": false,
"addressSpaceLimit": false
},
"cases": [
{
"args": [
"/usr/local/bin/repo-health-checker",
"-root=.",
"-repoSize=50.5",
"-meta=README.md",
"-meta=Changelog.md",
"-checkFileSumList=a5b63323a692d3d8b952442969649b4f823d58dae26429494f613df160710dfc,b1bbad25b830db0a77b15a033f9ca1b7ab44c1d2d05056412bd3e4421645f0bf,f6740081487ca34963a005209e2e9adfdf6f3561719af082d40fe80145e0cceb,bbeca1491c2f8364821a328a6677c0c5d59ccd60250abac3cec0887eeb9bde3e",
"-checkFileNameList=.gitignore,.gitattributes,.gitea/workflows/push.yaml,.gitea/workflows/release.yaml"
],
"env": [
"PATH=/usr/bin:/bin:/usr/local/bin"
],
"cpuLimit": 4000000000000,
"clockLimit": 8000000000000,
"memoryLimit": 838860800,
"procLimit": 50,
"copyOut": [
"stdout",
"stderr"
]
},
{
"args": [
"/usr/local/bin/joint-teapot",
"joj3-check-env",
"/home/tt/.config/teapot/teapot.env",
"--grading-repo-name",
"ece280-joj",
"--group-config",
"joj=1000:24,run=1000:24,=100:24"
],
"env": [
"LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log"
],
"cpuLimit": 4000000000000,
"clockLimit": 8000000000000,
"memoryLimit": 838860800,
"procLimit": 50,
"copyOut": [
"stdout",
"stderr"
]
}
]
}
},
"parsers": [
{
"name": "healthcheck",
"with": {
"score": 1
}
},
{
"name": "debug",
"with": {
"score": 0
}
}
]
},
{ {
"name": "[joj] ex2-asan", "name": "[joj] ex2-asan",
"group": "joj", "group": "joj",
@ -150,7 +42,7 @@
"cpuSetLimit": "", "cpuSetLimit": "",
"copyIn": { "copyIn": {
"h7/build/ex2-asan": { "h7/build/ex2-asan": {
"src": "/home/tt/.config/joj/tools/h7/build/ex2-asan", "src": "/home/tt/.config/joj/h7/build/ex2-asan",
"max": 419430400 "max": 419430400
} }
}, },

View File

@ -0,0 +1,33 @@
*.avi filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.djvu filter=lfs diff=lfs merge=lfs -text
*.doc filter=lfs diff=lfs merge=lfs -text
*.docx filter=lfs diff=lfs merge=lfs -text
*.epub filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.ipynb filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.JPEG filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.JPG filter=lfs diff=lfs merge=lfs -text
*.mkv filter=lfs diff=lfs merge=lfs -text
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.ods filter=lfs diff=lfs merge=lfs -text
*.odt filter=lfs diff=lfs merge=lfs -text
*.otf filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.PDF filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.PNG filter=lfs diff=lfs merge=lfs -text
*.ppt filter=lfs diff=lfs merge=lfs -text
*.pptx filter=lfs diff=lfs merge=lfs -text
*.ps filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.webm filter=lfs diff=lfs merge=lfs -text
*.xls filter=lfs diff=lfs merge=lfs -text
*.xlsx filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,23 @@
################################
## White list based gitignore ##
################################
# forbidden
*
.*
# allowed
!.gitignore
!.gitattributes
!.gitea/
!.gitea/issue_template/
!.gitea/workflows/
!*.yaml
!Makefile
!CMakeLists.txt
!h[0-8]/
!*.m
!*.c
!*.cpp
!*.h
!*.md

View File

@ -0,0 +1,19 @@
name: Run JOJ3 on Push
on: [push]
jobs:
run:
container:
image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:focs-ubuntu-latest-slim
volumes:
- /home/tt/.config:/home/tt/.config
- /home/tt/.cache:/home/tt/.cache
- /home/tt/.ssh:/home/tt/.ssh
steps:
- name: Check out repository code
uses: https://gitea.com/BoYanZh/checkout@focs
with:
fetch-depth: 0
- name: run joj3
run: |
sudo -E -u tt joj3 -conf-root /home/tt/.config/joj/tests/homework

View File

@ -0,0 +1,21 @@
name: Run JOJ3 on Release
on:
release:
types: [published]
jobs:
run:
container:
image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:focs-ubuntu-latest-slim
volumes:
- /home/tt/.config:/home/tt/.config
- /home/tt/.cache:/home/tt/.cache
- /home/tt/.ssh:/home/tt/.ssh
steps:
- name: Check out repository code
uses: https://gitea.com/BoYanZh/checkout@focs
with:
fetch-depth: 0
- name: run joj3
run: |
sudo -E -u tt joj3 -conf-root "/home/tt/.config/joj/tests/homework" -conf-name "conf-release.json" -tag "${{ github.ref_name }}"

View File

@ -7,117 +7,9 @@
"maxTotalScore": 100, "maxTotalScore": 100,
"stage": { "stage": {
"sandboxExecServer": "172.17.0.1:5051", "sandboxExecServer": "172.17.0.1:5051",
"sandboxToken": "test", "sandboxToken": "",
"outputPath": "/tmp/joj3_result.json", "outputPath": "/tmp/joj3_result.json",
"stages": [ "stages": [
{
"name": "healthcheck",
"group": "",
"executor": {
"name": "local",
"with": {
"default": {
"env": [
"PATH=/usr/bin:/bin:/usr/local/bin"
],
"stdin": {
"content": "",
"max": 419430400
},
"stdout": {
"name": "stdout",
"max": 4096
},
"stderr": {
"name": "stderr",
"max": 4096
},
"cpuLimit": 4000000000000,
"realCpuLimit": 0,
"clockLimit": 8000000000000,
"memoryLimit": 838860800,
"stackLimit": 0,
"procLimit": 50,
"cpuRateLimit": 0,
"cpuSetLimit": "",
"copyIn": {},
"copyInCached": {},
"copyInDir": ".",
"copyOut": [
"stdout",
"stderr"
],
"copyOutCached": [],
"copyOutMax": 0,
"copyOutDir": "",
"tty": false,
"strictMemoryLimit": false,
"dataSegmentLimit": false,
"addressSpaceLimit": false
},
"cases": [
{
"args": [
"/usr/local/bin/repo-health-checker",
"-root=.",
"-repoSize=50.5",
"-meta=README.md",
"-meta=Changelog.md",
"-checkFileSumList=a5b63323a692d3d8b952442969649b4f823d58dae26429494f613df160710dfc,b1bbad25b830db0a77b15a033f9ca1b7ab44c1d2d05056412bd3e4421645f0bf,f6740081487ca34963a005209e2e9adfdf6f3561719af082d40fe80145e0cceb,bbeca1491c2f8364821a328a6677c0c5d59ccd60250abac3cec0887eeb9bde3e",
"-checkFileNameList=.gitignore,.gitattributes,.gitea/workflows/push.yaml,.gitea/workflows/release.yaml"
],
"env": [
"PATH=/usr/bin:/bin:/usr/local/bin"
],
"cpuLimit": 4000000000000,
"clockLimit": 8000000000000,
"memoryLimit": 838860800,
"procLimit": 50,
"copyOut": [
"stdout",
"stderr"
]
},
{
"args": [
"/usr/local/bin/joint-teapot",
"joj3-check-env",
"/home/tt/.config/teapot/teapot.env",
"--grading-repo-name",
"ece280-joj",
"--group-config",
"joj=1000:24,run=1000:24,=100:24"
],
"env": [
"LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log"
],
"cpuLimit": 4000000000000,
"clockLimit": 8000000000000,
"memoryLimit": 838860800,
"procLimit": 50,
"copyOut": [
"stdout",
"stderr"
]
}
]
}
},
"parsers": [
{
"name": "healthcheck",
"with": {
"score": 1
}
},
{
"name": "debug",
"with": {
"score": 0
}
}
]
},
{ {
"name": "[cq] Filelength", "name": "[cq] Filelength",
"group": "cq", "group": "cq",
@ -157,7 +49,7 @@
"cpuSetLimit": "", "cpuSetLimit": "",
"copyIn": { "copyIn": {
"tools/filelength": { "tools/filelength": {
"src": "/home/tt/.config/joj/tools/tools/filelength", "src": "/home/tt/.config/joj/tools/filelength",
"max": 419430400 "max": 419430400
} }
}, },

View File

@ -1,5 +1,4 @@
import json import json
import os
from pathlib import Path from pathlib import Path
from typing import Any, Dict, Tuple from typing import Any, Dict, Tuple
@ -12,24 +11,22 @@ from joj3_config_generator.models import repo, task
def read_convert_files( def read_convert_files(
case_name: str, case_name: str,
) -> Tuple[repo.Config, task.Config, Dict[str, Any]]: ) -> Tuple[repo.Config, task.Config, Dict[str, Any]]:
root = os.path.dirname(os.path.realpath(__file__)) root = Path(__file__).resolve().parent / case_name
repo_toml_path = os.path.join(root, case_name, "repo.toml") repo_toml_path = root / "repo.toml"
with open(repo_toml_path) as f: repo_toml = repo_toml_path.read_text() if repo_toml_path.exists() else ""
repo_toml = f.read() task_toml_path = root / "task.toml"
task_toml_path = os.path.join(root, case_name, "task.toml") task_toml = task_toml_path.read_text() if task_toml_path.exists() else ""
with open(task_toml_path) as f: result = json.loads((root / "task.json").read_text())
task_toml = f.read() return (
result_json_path = os.path.join(root, case_name, "task.json") repo.Config(root=root, **rtoml.loads(repo_toml)),
with open(result_json_path) as f: task.Config(root=root, **rtoml.loads(task_toml)),
result: Dict[str, Any] = json.load(f) result,
repo_obj = rtoml.loads(repo_toml) )
task_obj = rtoml.loads(task_toml)
return repo.Config(**repo_obj), task.Config(**task_obj), result
def load_case(case_name: str) -> None: def load_case(case_name: str) -> None:
repo, task, expected_result = read_convert_files(case_name) repo, task, expected_result = read_convert_files(case_name)
result = convert(repo, task, repo_root=Path(".")).model_dump( result = convert(repo, task).model_dump(
mode="json", by_alias=True, exclude_none=True mode="json", by_alias=True, exclude_none=True
) )
assert result == expected_result assert result == expected_result

View File

@ -1,4 +1,4 @@
import os from pathlib import Path
from typing import Any, Dict, Tuple from typing import Any, Dict, Tuple
import rtoml import rtoml
@ -9,19 +9,15 @@ from joj3_config_generator.models import joj1
def read_convert_joj1_files(case_name: str) -> Tuple[joj1.Config, Dict[str, Any]]: def read_convert_joj1_files(case_name: str) -> Tuple[joj1.Config, Dict[str, Any]]:
root = os.path.dirname(os.path.realpath(__file__)) root = Path(__file__).resolve().parent
task_yaml_path = os.path.join(root, case_name, "task.yaml") task_yaml_path = root / case_name / "task.yaml"
with open(task_yaml_path) as f: task_yaml = task_yaml_path.read_text()
task_yaml = f.read() task_toml_path = root / case_name / "task.toml"
task_toml_path = os.path.join(root, case_name, "task.toml") task_toml = task_toml_path.read_text()
with open(task_toml_path) as f: return joj1.Config(**yaml.safe_load(task_yaml)), rtoml.loads(task_toml)
task_toml = f.read()
joj1_obj = yaml.safe_load(task_yaml)
task_obj = rtoml.loads(task_toml)
return joj1.Config(**joj1_obj), task_obj
def load_case(case_name: str) -> None: def load_case(case_name: str) -> None:
joj1, expected_result = read_convert_joj1_files(case_name) joj1_, expected_result = read_convert_joj1_files(case_name)
result = convert_joj1(joj1).model_dump(by_alias=True, exclude_none=True) result = convert_joj1(joj1_).model_dump(by_alias=True, exclude_none=True)
assert result == expected_result assert result == expected_result

View File

@ -1,7 +0,0 @@
from typing import Any
def safe_id(x: Any) -> str:
if not x or not isinstance(x, (tuple, list)) or len(x) == 0:
return "no_test_cases"
return str(x[0])