fix: merge master
Some checks failed
build / build (push) Failing after 2m28s
build / build (pull_request) Failing after 2m29s

This commit is contained in:
李衍志523370910113 2025-02-27 14:28:21 +08:00
commit 1a1ed96c23
4 changed files with 12 additions and 8 deletions

View File

@ -73,9 +73,11 @@ def convert(
) )
task_obj = rtoml.loads(task_toml_path.read_text()) task_obj = rtoml.loads(task_toml_path.read_text())
repo_conf = repo.Config(**repo_obj) repo_conf = repo.Config(**repo_obj)
repo_conf.path = (root / repo_toml_path.relative_to(root)).resolve() repo_conf.root = root
repo_conf.path = repo_toml_path.relative_to(root)
task_conf = task.Config(**task_obj) task_conf = task.Config(**task_obj)
task_conf.path = (root / task_toml_path.relative_to(root)).resolve() task_conf.root = root
task_conf.path = task_toml_path.relative_to(root)
result_model = convert_conf(repo_conf, task_conf) result_model = convert_conf(repo_conf, task_conf)
result_dict = result_model.model_dump(by_alias=True, exclude_none=True) result_dict = result_model.model_dump(by_alias=True, exclude_none=True)
with result_json_path.open("w") as result_file: with result_json_path.open("w") as result_file:

View File

@ -22,4 +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()
path: Path = Path(".") root: Path = Path(".")
path: Path = Path("repo.toml")

View File

@ -108,7 +108,8 @@ class Task(BaseModel):
class Config(BaseModel): class Config(BaseModel):
root: Path = Path(".")
path: Path = Path("conf.toml")
task: Task task: Task
release: Release release: Release # Release configuration
path: Path = Path(".")
stages: List[Stage] # list of stage configurations stages: List[Stage] # list of stage configurations

View File

@ -12,11 +12,11 @@ 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 = Path(__file__).resolve().parent root = Path(__file__).resolve().parent
repo_toml_path = root / case_name / "repo.toml" repo_toml_path = root.absolute() / case_name / "repo.toml"
repo_toml = repo_toml_path.read_text() if repo_toml_path.exists() else "" 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.absolute() / case_name / "task.toml"
task_toml = task_toml_path.read_text() if task_toml_path.exists() else "" 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.absolute() / case_name / "task.json").read_text())
return ( return (
repo.Config(**rtoml.loads(repo_toml)), repo.Config(**rtoml.loads(repo_toml)),
task.Config(**rtoml.loads(task_toml)), task.Config(**rtoml.loads(task_toml)),