From acbcda95650b7dd506d21b8a70a58e04ec1a7752 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Sun, 9 Feb 2025 13:26:19 -0500 Subject: [PATCH 01/20] ci: only use runs-on --- .gitea/workflows/build.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index d4d0dcf..f7d281d 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -4,8 +4,7 @@ on: - pull_request jobs: build: - container: - image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:ubuntu-latest + runs-on: ubuntu-latest steps: - name: Check out repository code uses: https://gitea.com/BoYanZh/checkout@focs -- 2.30.2 From 2bf1a225b68f1a57083c95d75f24efe3c6e69240 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Mon, 24 Feb 2025 20:53:09 -0500 Subject: [PATCH 02/20] docs(README): list pdm run --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7590674..e3b98db 100644 --- a/README.md +++ b/README.md @@ -15,3 +15,4 @@ 3. Change dir to the repo, `cd JOJ3-config-generator` 4. Install deps by `pdm install && pdm run pre-commit install` 5. Run the cli app by `pdm run app --help` +6. Check other commands or scripts with `pdm run --list` -- 2.30.2 From bddb67decfeaf4b1c3a952883c748d984af880bc Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Mon, 24 Feb 2025 22:36:08 -0500 Subject: [PATCH 03/20] test: allow non-exist toml file input --- tests/convert/utils.py | 26 ++++++++++++-------------- tests/convert_joj1/utils.py | 18 +++++++----------- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/tests/convert/utils.py b/tests/convert/utils.py index 5875138..046f715 100644 --- a/tests/convert/utils.py +++ b/tests/convert/utils.py @@ -1,5 +1,5 @@ import json -import os +from pathlib import Path from typing import Any, Dict, Tuple import rtoml @@ -11,19 +11,17 @@ from joj3_config_generator.models import repo, task def read_convert_files( case_name: str, ) -> Tuple[repo.Config, task.Config, Dict[str, Any]]: - root = os.path.dirname(os.path.realpath(__file__)) - repo_toml_path = os.path.join(root, case_name, "repo.toml") - with open(repo_toml_path) as f: - repo_toml = f.read() - task_toml_path = os.path.join(root, case_name, "task.toml") - with open(task_toml_path) as f: - task_toml = f.read() - result_json_path = os.path.join(root, case_name, "task.json") - with open(result_json_path) as f: - result: Dict[str, Any] = json.load(f) - repo_obj = rtoml.loads(repo_toml) - task_obj = rtoml.loads(task_toml) - return repo.Config(**repo_obj), task.Config(**task_obj), result + root = Path(__file__).resolve().parent + repo_toml_path = root / case_name / "repo.toml" + repo_toml = repo_toml_path.read_text() if repo_toml_path.exists() else "" + task_toml_path = root / case_name / "task.toml" + task_toml = task_toml_path.read_text() if task_toml_path.exists() else "" + result = json.loads((root / case_name / "task.json").read_text()) + return ( + repo.Config(**rtoml.loads(repo_toml)), + task.Config(**rtoml.loads(task_toml)), + result, + ) def load_case(case_name: str) -> None: diff --git a/tests/convert_joj1/utils.py b/tests/convert_joj1/utils.py index 36f6108..7732511 100644 --- a/tests/convert_joj1/utils.py +++ b/tests/convert_joj1/utils.py @@ -1,4 +1,4 @@ -import os +from pathlib import Path from typing import Any, Dict, Tuple import rtoml @@ -9,16 +9,12 @@ from joj3_config_generator.models import joj1 def read_convert_joj1_files(case_name: str) -> Tuple[joj1.Config, Dict[str, Any]]: - root = os.path.dirname(os.path.realpath(__file__)) - task_yaml_path = os.path.join(root, case_name, "task.yaml") - with open(task_yaml_path) as f: - task_yaml = f.read() - task_toml_path = os.path.join(root, case_name, "task.toml") - with open(task_toml_path) as f: - task_toml = f.read() - joj1_obj = yaml.safe_load(task_yaml) - task_obj = rtoml.loads(task_toml) - return joj1.Config(**joj1_obj), task_obj + root = Path(__file__).resolve().parent + task_yaml_path = root / case_name / "task.yaml" + task_yaml = task_yaml_path.read_text() + task_toml_path = root / case_name / "task.toml" + task_toml = task_toml_path.read_text() + return joj1.Config(**yaml.safe_load(task_yaml)), rtoml.loads(task_toml) def load_case(case_name: str) -> None: -- 2.30.2 From 73f2581a316ad2603cc3514a5b97129d600780c6 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Tue, 25 Feb 2025 03:12:25 -0500 Subject: [PATCH 04/20] ci: use local checkout --- .gitea/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index f7d281d..2ff3fc6 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository code - uses: https://gitea.com/BoYanZh/checkout@focs + uses: actions/checkout@focs - name: Display Python3 version run: python3 --version - name: Install PDM -- 2.30.2 From 68628c0eae83f2cc52aff57fda0fb149e500e0dd Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Tue, 25 Feb 2025 03:47:50 -0500 Subject: [PATCH 05/20] feat: convert toml files recursively --- joj3_config_generator/main.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/joj3_config_generator/main.py b/joj3_config_generator/main.py index d556071..6847a00 100644 --- a/joj3_config_generator/main.py +++ b/joj3_config_generator/main.py @@ -1,5 +1,4 @@ import json -import os from pathlib import Path import inquirer @@ -51,18 +50,19 @@ def convert(root: Path = Path(".")) -> None: Convert given dir of JOJ3 toml config files to JOJ3 json config files """ logger.info(f"Converting files in {root.absolute()}") - repo_toml_path = os.path.join(root, "repo.toml") - # TODO: loop through all dirs to find all task.toml - task_toml_path = os.path.join(root, "task.toml") - result_json_path = os.path.join(root, "task.json") - with open(repo_toml_path) as repo_file: - repo_toml = repo_file.read() - with open(task_toml_path) as task_file: - task_toml = task_file.read() - repo_obj = rtoml.loads(repo_toml) - task_obj = rtoml.loads(task_toml) - result_model = convert_conf(repo.Config(**repo_obj), task.Config(**task_obj)) - result_dict = result_model.model_dump(by_alias=True) - with open(result_json_path, "w") as result_file: - json.dump(result_dict, result_file, ensure_ascii=False, indent=4) - result_file.write("\n") + repo_toml_path = root / "repo.toml" + repo_obj = rtoml.loads( + repo_toml_path.read_text() if repo_toml_path.exists() else "" + ) + for task_toml_path in root.glob("**/*.toml"): + toml_name = task_toml_path.name.removesuffix(".toml") + if toml_name == "repo": + continue + result_json_path = task_toml_path.parent / f"{toml_name}.json" + logger.info(f"Converting {task_toml_path} to {result_json_path}") + task_obj = rtoml.loads(task_toml_path.read_text()) + result_model = convert_conf(repo.Config(**repo_obj), task.Config(**task_obj)) + result_dict = result_model.model_dump(by_alias=True) + with result_json_path.open("w") as result_file: + json.dump(result_dict, result_file, ensure_ascii=False, indent=4) + result_file.write("\n") -- 2.30.2 From 67d2fcc4e45e5da331f5c0b65b1bebd2e89d7908 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Tue, 25 Feb 2025 04:15:05 -0500 Subject: [PATCH 06/20] feat: dump with exclude_none --- joj3_config_generator/main.py | 13 +++++++++++-- tests/convert/basic/task.json | 26 -------------------------- tests/convert/utils.py | 4 +++- tests/convert_joj1/utils.py | 2 +- 4 files changed, 15 insertions(+), 30 deletions(-) diff --git a/joj3_config_generator/main.py b/joj3_config_generator/main.py index 6847a00..9d57dfe 100644 --- a/joj3_config_generator/main.py +++ b/joj3_config_generator/main.py @@ -5,6 +5,7 @@ import inquirer import rtoml import typer import yaml +from typing_extensions import Annotated from joj3_config_generator.convert import convert as convert_conf from joj3_config_generator.convert import convert_joj1 as convert_joj1_conf @@ -45,7 +46,15 @@ def convert_joj1(yaml_file: typer.FileText, toml_file: typer.FileTextWrite) -> N @app.command() -def convert(root: Path = Path(".")) -> None: +def convert( + root: Annotated[ + Path, + typer.Argument( + help="root directory of config files, " + "located at /home/tt/.config/joj in JTC" + ), + ] = Path(".") +) -> None: """ Convert given dir of JOJ3 toml config files to JOJ3 json config files """ @@ -62,7 +71,7 @@ def convert(root: Path = Path(".")) -> None: logger.info(f"Converting {task_toml_path} to {result_json_path}") task_obj = rtoml.loads(task_toml_path.read_text()) result_model = convert_conf(repo.Config(**repo_obj), task.Config(**task_obj)) - result_dict = result_model.model_dump(by_alias=True) + result_dict = result_model.model_dump(by_alias=True, exclude_none=True) with result_json_path.open("w") as result_file: json.dump(result_dict, result_file, ensure_ascii=False, indent=4) result_file.write("\n") diff --git a/tests/convert/basic/task.json b/tests/convert/basic/task.json index 294d15c..ca0a8fc 100644 --- a/tests/convert/basic/task.json +++ b/tests/convert/basic/task.json @@ -19,9 +19,6 @@ "./h3/ex5.m" ], "env": [], - "stdin": null, - "stdout": null, - "stderr": null, "cpuLimit": 0, "realCpuLimit": 0, "clockLimit": 0, @@ -33,22 +30,12 @@ "copyIn": { "tools/matlab-joj": { "src": "tools/matlab-joj", - "content": null, - "fileId": null, - "name": null, - "max": null, - "symlink": null, "streamIn": false, "streamOut": false, "pipe": false }, "tools/matlab_formatter.py": { "src": "tools/matlab_formatter.py", - "content": null, - "fileId": null, - "name": null, - "max": null, - "symlink": null, "streamIn": false, "streamOut": false, "pipe": false @@ -99,9 +86,6 @@ "./h3/ex5.m" ], "env": [], - "stdin": null, - "stdout": null, - "stderr": null, "cpuLimit": 0, "realCpuLimit": 0, "clockLimit": 0, @@ -113,22 +97,12 @@ "copyIn": { "tools/matlab-joj": { "src": "tools/matlab-joj", - "content": null, - "fileId": null, - "name": null, - "max": null, - "symlink": null, "streamIn": false, "streamOut": false, "pipe": false }, "tools/matlab_formatter.py": { "src": "tools/matlab_formatter.py", - "content": null, - "fileId": null, - "name": null, - "max": null, - "symlink": null, "streamIn": false, "streamOut": false, "pipe": false diff --git a/tests/convert/utils.py b/tests/convert/utils.py index 046f715..f51f073 100644 --- a/tests/convert/utils.py +++ b/tests/convert/utils.py @@ -26,5 +26,7 @@ def read_convert_files( def load_case(case_name: str) -> None: repo, task, expected_result = read_convert_files(case_name) - result = convert(repo, task).model_dump(mode="json", by_alias=True) + result = convert(repo, task).model_dump( + mode="json", by_alias=True, exclude_none=True + ) assert result == expected_result diff --git a/tests/convert_joj1/utils.py b/tests/convert_joj1/utils.py index 7732511..74aa1b5 100644 --- a/tests/convert_joj1/utils.py +++ b/tests/convert_joj1/utils.py @@ -19,5 +19,5 @@ def read_convert_joj1_files(case_name: str) -> Tuple[joj1.Config, Dict[str, Any] def load_case(case_name: str) -> None: joj1, expected_result = read_convert_joj1_files(case_name) - result = convert_joj1(joj1).model_dump(by_alias=True) + result = convert_joj1(joj1).model_dump(by_alias=True, exclude_none=True) assert result == expected_result -- 2.30.2 From ab5bfc6cfeed697467de3a2000ff4e3f62bac2a6 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Tue, 25 Feb 2025 14:05:00 -0500 Subject: [PATCH 07/20] fix: find repo.toml recursively --- joj3_config_generator/main.py | 37 ++++++++++++++++------------ joj3_config_generator/models/repo.py | 2 ++ joj3_config_generator/models/task.py | 2 ++ 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/joj3_config_generator/main.py b/joj3_config_generator/main.py index 9d57dfe..91d879a 100644 --- a/joj3_config_generator/main.py +++ b/joj3_config_generator/main.py @@ -59,19 +59,24 @@ def convert( Convert given dir of JOJ3 toml config files to JOJ3 json config files """ logger.info(f"Converting files in {root.absolute()}") - repo_toml_path = root / "repo.toml" - repo_obj = rtoml.loads( - repo_toml_path.read_text() if repo_toml_path.exists() else "" - ) - for task_toml_path in root.glob("**/*.toml"): - toml_name = task_toml_path.name.removesuffix(".toml") - if toml_name == "repo": - continue - result_json_path = task_toml_path.parent / f"{toml_name}.json" - logger.info(f"Converting {task_toml_path} to {result_json_path}") - task_obj = rtoml.loads(task_toml_path.read_text()) - result_model = convert_conf(repo.Config(**repo_obj), task.Config(**task_obj)) - result_dict = result_model.model_dump(by_alias=True, exclude_none=True) - with result_json_path.open("w") as result_file: - json.dump(result_dict, result_file, ensure_ascii=False, indent=4) - result_file.write("\n") + for repo_toml_path in root.glob("**/repo.toml"): + repo_path = repo_toml_path.parent + repo_obj = rtoml.loads(repo_toml_path.read_text()) + for task_toml_path in repo_path.glob("**/*.toml"): + if repo_toml_path == task_toml_path: + continue + toml_name = task_toml_path.name.removesuffix(".toml") + result_json_path = task_toml_path.parent / f"{toml_name}.json" + logger.info( + f"Converting {repo_toml_path} & {task_toml_path} to {result_json_path}" + ) + task_obj = rtoml.loads(task_toml_path.read_text()) + repo_conf = repo.Config(**repo_obj) + repo_conf.path = repo_toml_path + task_conf = task.Config(**task_obj) + task_conf.path = task_toml_path + result_model = convert_conf(repo_conf, task_conf) + result_dict = result_model.model_dump(by_alias=True, exclude_none=True) + with result_json_path.open("w") as result_file: + json.dump(result_dict, result_file, ensure_ascii=False, indent=4) + result_file.write("\n") diff --git a/joj3_config_generator/models/repo.py b/joj3_config_generator/models/repo.py index 4befab6..288096f 100644 --- a/joj3_config_generator/models/repo.py +++ b/joj3_config_generator/models/repo.py @@ -1,3 +1,4 @@ +from pathlib import Path from typing import List, Optional from pydantic import BaseModel, Field @@ -11,6 +12,7 @@ class Files(BaseModel): class Config(BaseModel): + path: Path = Path(".") teaching_team: List[str] max_size: float = Field(..., ge=0) release_tags: List[str] diff --git a/joj3_config_generator/models/task.py b/joj3_config_generator/models/task.py index 09a37fc..ab15bf7 100644 --- a/joj3_config_generator/models/task.py +++ b/joj3_config_generator/models/task.py @@ -1,4 +1,5 @@ from datetime import datetime +from pathlib import Path from typing import List, Optional from pydantic import BaseModel, Field @@ -32,6 +33,7 @@ class Release(BaseModel): class Config(BaseModel): + path: Path = Path(".") task: str # Task name (e.g., hw3 ex5) release: Release # Release configuration stages: List[Stage] # list of stage configurations -- 2.30.2 From 2a2387fff21f612e9368e19d37dffd972f046d60 Mon Sep 17 00:00:00 2001 From: jon-lee Date: Thu, 27 Feb 2025 09:58:19 +0800 Subject: [PATCH 08/20] refactor(convert): remove distribute json --- joj3_config_generator/convert.py | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/joj3_config_generator/convert.py b/joj3_config_generator/convert.py index b8defb5..c683ddc 100644 --- a/joj3_config_generator/convert.py +++ b/joj3_config_generator/convert.py @@ -73,24 +73,3 @@ def convert_joj1(joj1_conf: joj1.Config) -> task.Config: release=task.Release(deadline=None, begin_time=None), 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)) - 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!" -- 2.30.2 From 789137d498e806a83f43f89ad7ac15fa1f544be8 Mon Sep 17 00:00:00 2001 From: jon-lee Date: Thu, 27 Feb 2025 10:07:17 +0800 Subject: [PATCH 09/20] docs: update README --- README.md | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f91bd7c..3e2cc4c 100644 --- a/README.md +++ b/README.md @@ -15,20 +15,16 @@ 3. Change dir to the repo, `cd JOJ3-config-generator` 4. Install deps by `pdm install && pdm run pre-commit install` 5. Run the cli app by `pdm run app --help` -<<<<<<< HEAD +6. Check other commands or scripts with `pdm run --list` ## How to use? -- `joj3-config-generator convert` function is now supported, currently support three flags: - - - `-d/--distribute`: Add it without other input, it indicates script is ready to convert things other than testcases within the project - - `-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/' - - `-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/' +- `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 same position as the `repo.toml` file - sample command on the server ```shell -joj3-config-generator convert -d -c /home/tt/.config/joj/ -r immutable_files +joj3-config-generator convert /home/tt/.config/joj ``` -======= -6. Check other commands or scripts with `pdm run --list` ->>>>>>> master -- 2.30.2 From b5c43eacb3c5dc733281fcfca3c3f5dbddc86936 Mon Sep 17 00:00:00 2001 From: jon-lee Date: Thu, 27 Feb 2025 10:11:43 +0800 Subject: [PATCH 10/20] docs: update README --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e2cc4c..8ad7169 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,16 @@ - `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 same position as the `repo.toml` file + - the intended immutable files should be placed at a sub-directory named `immutable_files` at same position as the `repo.toml` file + +```shell +[nuvole0217@Nuvole test]$ tree . +. +|- immutable_files +| |-- push.yaml +| |-- release.yaml +|-- repo.toml +``` - sample command on the server ```shell -- 2.30.2 From 4adda6e716de22e8eeeaeeee5e244cc7086c9561 Mon Sep 17 00:00:00 2001 From: jon-lee Date: Thu, 27 Feb 2025 11:29:01 +0800 Subject: [PATCH 11/20] chore: restructure immutable files --- .../basic/immutable_files}/.gitattributes | 0 .../basic/immutable_files}/.gitignore | 0 .../basic/immutable_files}/push.yaml | 0 .../basic/immutable_files}/release.yaml | 0 .../clang-tidy/immutable_files/.gitattributes | 33 +++++++++++++++++++ .../clang-tidy/immutable_files/.gitignore | 23 +++++++++++++ .../clang-tidy/immutable_files/push.yaml | 19 +++++++++++ .../clang-tidy/immutable_files/release.yaml | 21 ++++++++++++ .../cppcheck/immutable_files/.gitattributes | 33 +++++++++++++++++++ .../cppcheck/immutable_files/.gitignore | 23 +++++++++++++ .../cppcheck/immutable_files/push.yaml | 19 +++++++++++ .../cppcheck/immutable_files/release.yaml | 21 ++++++++++++ .../cpplint/immutable_files/.gitattributes | 33 +++++++++++++++++++ .../cpplint/immutable_files/.gitignore | 23 +++++++++++++ .../convert/cpplint/immutable_files/push.yaml | 19 +++++++++++ .../cpplint/immutable_files/release.yaml | 21 ++++++++++++ .../diff/immutable_files/.gitattributes | 33 +++++++++++++++++++ tests/convert/diff/immutable_files/.gitignore | 23 +++++++++++++ tests/convert/diff/immutable_files/push.yaml | 19 +++++++++++ .../convert/diff/immutable_files/release.yaml | 21 ++++++++++++ .../keyword/immutable_files/.gitattributes | 33 +++++++++++++++++++ .../keyword/immutable_files/.gitignore | 23 +++++++++++++ .../convert/keyword/immutable_files/push.yaml | 19 +++++++++++ .../keyword/immutable_files/release.yaml | 21 ++++++++++++ 24 files changed, 480 insertions(+) rename tests/{immutable_file => convert/basic/immutable_files}/.gitattributes (100%) rename tests/{immutable_file => convert/basic/immutable_files}/.gitignore (100%) rename tests/{immutable_file => convert/basic/immutable_files}/push.yaml (100%) rename tests/{immutable_file => convert/basic/immutable_files}/release.yaml (100%) create mode 100644 tests/convert/clang-tidy/immutable_files/.gitattributes create mode 100644 tests/convert/clang-tidy/immutable_files/.gitignore create mode 100644 tests/convert/clang-tidy/immutable_files/push.yaml create mode 100644 tests/convert/clang-tidy/immutable_files/release.yaml create mode 100644 tests/convert/cppcheck/immutable_files/.gitattributes create mode 100644 tests/convert/cppcheck/immutable_files/.gitignore create mode 100644 tests/convert/cppcheck/immutable_files/push.yaml create mode 100644 tests/convert/cppcheck/immutable_files/release.yaml create mode 100644 tests/convert/cpplint/immutable_files/.gitattributes create mode 100644 tests/convert/cpplint/immutable_files/.gitignore create mode 100644 tests/convert/cpplint/immutable_files/push.yaml create mode 100644 tests/convert/cpplint/immutable_files/release.yaml create mode 100644 tests/convert/diff/immutable_files/.gitattributes create mode 100644 tests/convert/diff/immutable_files/.gitignore create mode 100644 tests/convert/diff/immutable_files/push.yaml create mode 100644 tests/convert/diff/immutable_files/release.yaml create mode 100644 tests/convert/keyword/immutable_files/.gitattributes create mode 100644 tests/convert/keyword/immutable_files/.gitignore create mode 100644 tests/convert/keyword/immutable_files/push.yaml create mode 100644 tests/convert/keyword/immutable_files/release.yaml diff --git a/tests/immutable_file/.gitattributes b/tests/convert/basic/immutable_files/.gitattributes similarity index 100% rename from tests/immutable_file/.gitattributes rename to tests/convert/basic/immutable_files/.gitattributes diff --git a/tests/immutable_file/.gitignore b/tests/convert/basic/immutable_files/.gitignore similarity index 100% rename from tests/immutable_file/.gitignore rename to tests/convert/basic/immutable_files/.gitignore diff --git a/tests/immutable_file/push.yaml b/tests/convert/basic/immutable_files/push.yaml similarity index 100% rename from tests/immutable_file/push.yaml rename to tests/convert/basic/immutable_files/push.yaml diff --git a/tests/immutable_file/release.yaml b/tests/convert/basic/immutable_files/release.yaml similarity index 100% rename from tests/immutable_file/release.yaml rename to tests/convert/basic/immutable_files/release.yaml diff --git a/tests/convert/clang-tidy/immutable_files/.gitattributes b/tests/convert/clang-tidy/immutable_files/.gitattributes new file mode 100644 index 0000000..b910c4a --- /dev/null +++ b/tests/convert/clang-tidy/immutable_files/.gitattributes @@ -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 diff --git a/tests/convert/clang-tidy/immutable_files/.gitignore b/tests/convert/clang-tidy/immutable_files/.gitignore new file mode 100644 index 0000000..754f776 --- /dev/null +++ b/tests/convert/clang-tidy/immutable_files/.gitignore @@ -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 diff --git a/tests/convert/clang-tidy/immutable_files/push.yaml b/tests/convert/clang-tidy/immutable_files/push.yaml new file mode 100644 index 0000000..664f371 --- /dev/null +++ b/tests/convert/clang-tidy/immutable_files/push.yaml @@ -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 diff --git a/tests/convert/clang-tidy/immutable_files/release.yaml b/tests/convert/clang-tidy/immutable_files/release.yaml new file mode 100644 index 0000000..e740403 --- /dev/null +++ b/tests/convert/clang-tidy/immutable_files/release.yaml @@ -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 }}" diff --git a/tests/convert/cppcheck/immutable_files/.gitattributes b/tests/convert/cppcheck/immutable_files/.gitattributes new file mode 100644 index 0000000..b910c4a --- /dev/null +++ b/tests/convert/cppcheck/immutable_files/.gitattributes @@ -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 diff --git a/tests/convert/cppcheck/immutable_files/.gitignore b/tests/convert/cppcheck/immutable_files/.gitignore new file mode 100644 index 0000000..754f776 --- /dev/null +++ b/tests/convert/cppcheck/immutable_files/.gitignore @@ -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 diff --git a/tests/convert/cppcheck/immutable_files/push.yaml b/tests/convert/cppcheck/immutable_files/push.yaml new file mode 100644 index 0000000..664f371 --- /dev/null +++ b/tests/convert/cppcheck/immutable_files/push.yaml @@ -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 diff --git a/tests/convert/cppcheck/immutable_files/release.yaml b/tests/convert/cppcheck/immutable_files/release.yaml new file mode 100644 index 0000000..e740403 --- /dev/null +++ b/tests/convert/cppcheck/immutable_files/release.yaml @@ -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 }}" diff --git a/tests/convert/cpplint/immutable_files/.gitattributes b/tests/convert/cpplint/immutable_files/.gitattributes new file mode 100644 index 0000000..b910c4a --- /dev/null +++ b/tests/convert/cpplint/immutable_files/.gitattributes @@ -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 diff --git a/tests/convert/cpplint/immutable_files/.gitignore b/tests/convert/cpplint/immutable_files/.gitignore new file mode 100644 index 0000000..754f776 --- /dev/null +++ b/tests/convert/cpplint/immutable_files/.gitignore @@ -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 diff --git a/tests/convert/cpplint/immutable_files/push.yaml b/tests/convert/cpplint/immutable_files/push.yaml new file mode 100644 index 0000000..664f371 --- /dev/null +++ b/tests/convert/cpplint/immutable_files/push.yaml @@ -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 diff --git a/tests/convert/cpplint/immutable_files/release.yaml b/tests/convert/cpplint/immutable_files/release.yaml new file mode 100644 index 0000000..e740403 --- /dev/null +++ b/tests/convert/cpplint/immutable_files/release.yaml @@ -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 }}" diff --git a/tests/convert/diff/immutable_files/.gitattributes b/tests/convert/diff/immutable_files/.gitattributes new file mode 100644 index 0000000..b910c4a --- /dev/null +++ b/tests/convert/diff/immutable_files/.gitattributes @@ -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 diff --git a/tests/convert/diff/immutable_files/.gitignore b/tests/convert/diff/immutable_files/.gitignore new file mode 100644 index 0000000..754f776 --- /dev/null +++ b/tests/convert/diff/immutable_files/.gitignore @@ -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 diff --git a/tests/convert/diff/immutable_files/push.yaml b/tests/convert/diff/immutable_files/push.yaml new file mode 100644 index 0000000..664f371 --- /dev/null +++ b/tests/convert/diff/immutable_files/push.yaml @@ -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 diff --git a/tests/convert/diff/immutable_files/release.yaml b/tests/convert/diff/immutable_files/release.yaml new file mode 100644 index 0000000..e740403 --- /dev/null +++ b/tests/convert/diff/immutable_files/release.yaml @@ -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 }}" diff --git a/tests/convert/keyword/immutable_files/.gitattributes b/tests/convert/keyword/immutable_files/.gitattributes new file mode 100644 index 0000000..b910c4a --- /dev/null +++ b/tests/convert/keyword/immutable_files/.gitattributes @@ -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 diff --git a/tests/convert/keyword/immutable_files/.gitignore b/tests/convert/keyword/immutable_files/.gitignore new file mode 100644 index 0000000..754f776 --- /dev/null +++ b/tests/convert/keyword/immutable_files/.gitignore @@ -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 diff --git a/tests/convert/keyword/immutable_files/push.yaml b/tests/convert/keyword/immutable_files/push.yaml new file mode 100644 index 0000000..664f371 --- /dev/null +++ b/tests/convert/keyword/immutable_files/push.yaml @@ -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 diff --git a/tests/convert/keyword/immutable_files/release.yaml b/tests/convert/keyword/immutable_files/release.yaml new file mode 100644 index 0000000..e740403 --- /dev/null +++ b/tests/convert/keyword/immutable_files/release.yaml @@ -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 }}" -- 2.30.2 From 99ccbbd113a0bb3ab88b31c6fd4a127be646a3a8 Mon Sep 17 00:00:00 2001 From: jon-lee Date: Thu, 27 Feb 2025 11:29:57 +0800 Subject: [PATCH 12/20] fix: absolute path & immutable files feature --- joj3_config_generator/main.py | 5 +++-- joj3_config_generator/processers/repo.py | 19 +++++++------------ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/joj3_config_generator/main.py b/joj3_config_generator/main.py index 91d879a..fb7b912 100644 --- a/joj3_config_generator/main.py +++ b/joj3_config_generator/main.py @@ -59,6 +59,7 @@ def convert( Convert given dir of JOJ3 toml config files to JOJ3 json config files """ logger.info(f"Converting files in {root.absolute()}") + root = root.absolute() for repo_toml_path in root.glob("**/repo.toml"): repo_path = repo_toml_path.parent repo_obj = rtoml.loads(repo_toml_path.read_text()) @@ -72,9 +73,9 @@ def convert( ) task_obj = rtoml.loads(task_toml_path.read_text()) repo_conf = repo.Config(**repo_obj) - repo_conf.path = repo_toml_path + repo_conf.path = (root / repo_toml_path.relative_to(root)).resolve() task_conf = task.Config(**task_obj) - task_conf.path = task_toml_path + task_conf.path = (root / task_toml_path.relative_to(root)).resolve() result_model = convert_conf(repo_conf, task_conf) result_dict = result_model.model_dump(by_alias=True, exclude_none=True) with result_json_path.open("w") as result_file: diff --git a/joj3_config_generator/processers/repo.py b/joj3_config_generator/processers/repo.py index 8d31e69..06b571f 100644 --- a/joj3_config_generator/processers/repo.py +++ b/joj3_config_generator/processers/repo.py @@ -111,7 +111,7 @@ def get_healthcheck_config(repo_conf: repo.Config) -> result.StageDetail: return healthcheck_stage -def calc_sha256sum(file_path: str) -> str: +def calc_sha256sum(file_path: Path) -> str: sha256_hash = hashlib.sha256() with open(file_path, "rb") as f: for byte_block in iter(lambda: f.read(65536 * 2), b""): @@ -122,20 +122,15 @@ def calc_sha256sum(file_path: str) -> str: def get_hash( immutable_files: list[str], repo_conf: repo.Config ) -> str: # input should be a list - # FIXME: should be finalized when get into the server - current_file_path = Path(__file__).resolve() - 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 = repo_conf.path + repo_path = repo_conf.path.parent + file_path = Path(f"{repo_path}/immutable_files") immutable_hash = [] + 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): - immutable_hash.append(calc_sha256sum(file)) + for i, file_ in enumerate(immutable_files_): + immutable_hash.append(calc_sha256sum(file_)) hash_check = "-checkFileSumList=" -- 2.30.2 From c4639aef767269e1fff6ced63500dcca1bd2f8de Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Thu, 27 Feb 2025 00:24:37 -0500 Subject: [PATCH 13/20] fix: store relative path to root --- joj3_config_generator/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/joj3_config_generator/main.py b/joj3_config_generator/main.py index 91d879a..271954f 100644 --- a/joj3_config_generator/main.py +++ b/joj3_config_generator/main.py @@ -72,9 +72,9 @@ def convert( ) task_obj = rtoml.loads(task_toml_path.read_text()) repo_conf = repo.Config(**repo_obj) - repo_conf.path = repo_toml_path + repo_conf.path = repo_toml_path.relative_to(root) task_conf = task.Config(**task_obj) - task_conf.path = task_toml_path + task_conf.path = task_toml_path.relative_to(root) result_model = convert_conf(repo_conf, task_conf) result_dict = result_model.model_dump(by_alias=True, exclude_none=True) with result_json_path.open("w") as result_file: -- 2.30.2 From 4c12bf9a342231658b9274053279568cc40c5436 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Thu, 27 Feb 2025 01:14:40 -0500 Subject: [PATCH 14/20] fix: store root path --- joj3_config_generator/main.py | 2 +- joj3_config_generator/models/repo.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/joj3_config_generator/main.py b/joj3_config_generator/main.py index 271954f..eaf9c04 100644 --- a/joj3_config_generator/main.py +++ b/joj3_config_generator/main.py @@ -72,9 +72,9 @@ def convert( ) task_obj = rtoml.loads(task_toml_path.read_text()) repo_conf = repo.Config(**repo_obj) + repo_conf.root = root repo_conf.path = repo_toml_path.relative_to(root) task_conf = task.Config(**task_obj) - task_conf.path = task_toml_path.relative_to(root) result_model = convert_conf(repo_conf, task_conf) result_dict = result_model.model_dump(by_alias=True, exclude_none=True) with result_json_path.open("w") as result_file: diff --git a/joj3_config_generator/models/repo.py b/joj3_config_generator/models/repo.py index 288096f..5149e18 100644 --- a/joj3_config_generator/models/repo.py +++ b/joj3_config_generator/models/repo.py @@ -12,7 +12,8 @@ class Files(BaseModel): class Config(BaseModel): - path: Path = Path(".") + root: Path = Path(".") + path: Path = Path("repo.toml") teaching_team: List[str] max_size: float = Field(..., ge=0) release_tags: List[str] -- 2.30.2 From 723705b94fc8c8006c6c1ca73181efdf70850033 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Thu, 27 Feb 2025 01:17:14 -0500 Subject: [PATCH 15/20] fix: store path for both conf objs --- joj3_config_generator/main.py | 2 ++ joj3_config_generator/models/task.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/joj3_config_generator/main.py b/joj3_config_generator/main.py index eaf9c04..cf522c9 100644 --- a/joj3_config_generator/main.py +++ b/joj3_config_generator/main.py @@ -75,6 +75,8 @@ def convert( repo_conf.root = root repo_conf.path = repo_toml_path.relative_to(root) task_conf = task.Config(**task_obj) + task_conf.root = root + task_conf.path = task_toml_path.relative_to(root) result_model = convert_conf(repo_conf, task_conf) result_dict = result_model.model_dump(by_alias=True, exclude_none=True) with result_json_path.open("w") as result_file: diff --git a/joj3_config_generator/models/task.py b/joj3_config_generator/models/task.py index ab15bf7..6672d02 100644 --- a/joj3_config_generator/models/task.py +++ b/joj3_config_generator/models/task.py @@ -33,7 +33,8 @@ class Release(BaseModel): class Config(BaseModel): - path: Path = Path(".") + root: Path = Path(".") + path: Path = Path("conf.toml") task: str # Task name (e.g., hw3 ex5) release: Release # Release configuration stages: List[Stage] # list of stage configurations -- 2.30.2 From 870f20dde98d1fe32076ff9129ab76cb5237aeb8 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Thu, 27 Feb 2025 01:25:56 -0500 Subject: [PATCH 16/20] chore: remove unused utils --- tests/utils.py | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 tests/utils.py diff --git a/tests/utils.py b/tests/utils.py deleted file mode 100644 index 7eda07e..0000000 --- a/tests/utils.py +++ /dev/null @@ -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]) -- 2.30.2 From ae77fa23b5cf395743317e3744edff7af405c6f2 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Thu, 27 Feb 2025 01:26:21 -0500 Subject: [PATCH 17/20] fix: default path for tests --- joj3_config_generator/models/task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/joj3_config_generator/models/task.py b/joj3_config_generator/models/task.py index 6672d02..a09a069 100644 --- a/joj3_config_generator/models/task.py +++ b/joj3_config_generator/models/task.py @@ -34,7 +34,7 @@ class Release(BaseModel): class Config(BaseModel): root: Path = Path(".") - path: Path = Path("conf.toml") + path: Path = Path("task.toml") task: str # Task name (e.g., hw3 ex5) release: Release # Release configuration stages: List[Stage] # list of stage configurations -- 2.30.2 From aee123601f809bda0216f27aad893dd0e86e9197 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Thu, 27 Feb 2025 01:28:43 -0500 Subject: [PATCH 18/20] fix: root path for tests --- tests/convert/utils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/convert/utils.py b/tests/convert/utils.py index f51f073..0a458a1 100644 --- a/tests/convert/utils.py +++ b/tests/convert/utils.py @@ -11,15 +11,15 @@ from joj3_config_generator.models import repo, task def read_convert_files( case_name: str, ) -> Tuple[repo.Config, task.Config, Dict[str, Any]]: - root = Path(__file__).resolve().parent - repo_toml_path = root / case_name / "repo.toml" + root = Path(__file__).resolve().parent / case_name + repo_toml_path = root / "repo.toml" repo_toml = repo_toml_path.read_text() if repo_toml_path.exists() else "" - task_toml_path = root / case_name / "task.toml" + task_toml_path = root / "task.toml" task_toml = task_toml_path.read_text() if task_toml_path.exists() else "" - result = json.loads((root / case_name / "task.json").read_text()) + result = json.loads((root / "task.json").read_text()) return ( - repo.Config(**rtoml.loads(repo_toml)), - task.Config(**rtoml.loads(task_toml)), + repo.Config(root=root, **rtoml.loads(repo_toml)), + task.Config(root=root, **rtoml.loads(task_toml)), result, ) -- 2.30.2 From 1f0ee639dd6c225ef1b65846b9a8d90793901d94 Mon Sep 17 00:00:00 2001 From: jon-lee Date: Thu, 27 Feb 2025 15:31:08 +0800 Subject: [PATCH 19/20] fix: pass pytest --- joj3_config_generator/main.py | 2 +- joj3_config_generator/models/task.py | 4 +- joj3_config_generator/processers/repo.py | 2 +- tests/convert/clang-tidy/task.json | 105 ----------------------- tests/convert/cppcheck/task.json | 105 ----------------------- tests/convert/cpplint/task.json | 105 ----------------------- tests/convert/diff/task.json | 105 ----------------------- tests/convert/keyword/task.json | 105 ----------------------- tests/convert_joj1/utils.py | 4 +- 9 files changed, 6 insertions(+), 531 deletions(-) diff --git a/joj3_config_generator/main.py b/joj3_config_generator/main.py index 53884c7..027a716 100644 --- a/joj3_config_generator/main.py +++ b/joj3_config_generator/main.py @@ -41,7 +41,7 @@ def convert_joj1(yaml_file: typer.FileText, toml_file: typer.FileTextWrite) -> N joj1_obj = yaml.safe_load(yaml_file.read()) joj1_model = joj1.Config(**joj1_obj) task_model = convert_joj1_conf(joj1_model) - result_dict = task_model.model_dump(by_alias=True) + result_dict = task_model.model_dump(by_alias=True, exclude_none=True) toml_file.write(rtoml.dumps(result_dict)) diff --git a/joj3_config_generator/models/task.py b/joj3_config_generator/models/task.py index 708d36e..bcc59c7 100644 --- a/joj3_config_generator/models/task.py +++ b/joj3_config_generator/models/task.py @@ -108,8 +108,8 @@ class Task(BaseModel): class Config(BaseModel): - root: Path = Path(".") - path: Path = Path("task.toml") + root: Optional[Path] = None + path: Optional[Path] = None task: Task # Task name (e.g., hw3 ex5) release: Release # Release configuration stages: List[Stage] # list of stage configurations diff --git a/joj3_config_generator/processers/repo.py b/joj3_config_generator/processers/repo.py index 06b571f..b6b74c7 100644 --- a/joj3_config_generator/processers/repo.py +++ b/joj3_config_generator/processers/repo.py @@ -122,7 +122,7 @@ def calc_sha256sum(file_path: Path) -> str: def get_hash( immutable_files: list[str], repo_conf: repo.Config ) -> str: # input should be a list - repo_path = repo_conf.path.parent + repo_path = (repo_conf.root / repo_conf.path).parent file_path = Path(f"{repo_path}/immutable_files") immutable_hash = [] immutable_files_ = [] diff --git a/tests/convert/clang-tidy/task.json b/tests/convert/clang-tidy/task.json index 8c8ed9f..5c68e1b 100644 --- a/tests/convert/clang-tidy/task.json +++ b/tests/convert/clang-tidy/task.json @@ -10,111 +10,6 @@ "sandboxToken": "", "outputPath": "/tmp/joj3_result.json", "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=10", - "-checkFileSumList=-checkFileNameList=" - ], - "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", - "=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", "group": "cq", diff --git a/tests/convert/cppcheck/task.json b/tests/convert/cppcheck/task.json index dab704d..f88faff 100644 --- a/tests/convert/cppcheck/task.json +++ b/tests/convert/cppcheck/task.json @@ -10,111 +10,6 @@ "sandboxToken": "", "outputPath": "/tmp/joj3_result.json", "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=10", - "-checkFileSumList=-checkFileNameList=" - ], - "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", - "=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", "group": "cq", diff --git a/tests/convert/cpplint/task.json b/tests/convert/cpplint/task.json index b032a61..59fffc3 100644 --- a/tests/convert/cpplint/task.json +++ b/tests/convert/cpplint/task.json @@ -10,111 +10,6 @@ "sandboxToken": "", "outputPath": "/tmp/joj3_result.json", "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=10", - "-checkFileSumList=-checkFileNameList=" - ], - "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", - "=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", "group": "cq", diff --git a/tests/convert/diff/task.json b/tests/convert/diff/task.json index fe010ce..d5d5773 100644 --- a/tests/convert/diff/task.json +++ b/tests/convert/diff/task.json @@ -10,111 +10,6 @@ "sandboxToken": "", "outputPath": "/tmp/joj3_result.json", "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=10", - "-checkFileSumList=-checkFileNameList=" - ], - "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", - "=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", "group": "joj", diff --git a/tests/convert/keyword/task.json b/tests/convert/keyword/task.json index c2e2fcb..3ba8c53 100644 --- a/tests/convert/keyword/task.json +++ b/tests/convert/keyword/task.json @@ -10,111 +10,6 @@ "sandboxToken": "", "outputPath": "/tmp/joj3_result.json", "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=10", - "-checkFileSumList=-checkFileNameList=" - ], - "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", - "=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", "group": "cq", diff --git a/tests/convert_joj1/utils.py b/tests/convert_joj1/utils.py index 74aa1b5..947c5c2 100644 --- a/tests/convert_joj1/utils.py +++ b/tests/convert_joj1/utils.py @@ -18,6 +18,6 @@ def read_convert_joj1_files(case_name: str) -> Tuple[joj1.Config, Dict[str, Any] def load_case(case_name: str) -> None: - joj1, expected_result = read_convert_joj1_files(case_name) - result = convert_joj1(joj1).model_dump(by_alias=True, exclude_none=True) + joj1_, expected_result = read_convert_joj1_files(case_name) + result = convert_joj1(joj1_).model_dump(by_alias=True, exclude_none=True) assert result == expected_result -- 2.30.2 From 05207037f53035bc8de92c5140be99aa14198c88 Mon Sep 17 00:00:00 2001 From: jon-lee Date: Thu, 27 Feb 2025 15:45:25 +0800 Subject: [PATCH 20/20] fix(diff): get cases path --- joj3_config_generator/processers/task.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/joj3_config_generator/processers/task.py b/joj3_config_generator/processers/task.py index 7248394..b2894b4 100644 --- a/joj3_config_generator/processers/task.py +++ b/joj3_config_generator/processers/task.py @@ -276,7 +276,13 @@ def fix_diff( stage_cases.append( result.OptionalCmd( 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), cpu_limit=cpu_limit, @@ -299,7 +305,16 @@ def fix_diff( { "score": diff_output.score, "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, "alwaysHide": diff_output.hide, "compareSpace": not diff_output.ignorespaces, -- 2.30.2