feat: new immutable dir (#25)
This commit is contained in:
parent
fd7d09e7b2
commit
8d52febbc5
|
@ -70,6 +70,10 @@ class Config(BaseModel):
|
||||||
0, validation_alias=AliasChoices("health-check-score", "health_check_score")
|
0, validation_alias=AliasChoices("health-check-score", "health_check_score")
|
||||||
)
|
)
|
||||||
issue: Issue = Issue()
|
issue: Issue = Issue()
|
||||||
|
immutable_path: Path = Field(
|
||||||
|
Path("immutable_files"),
|
||||||
|
validation_alias=AliasChoices("immutable-path", "immutable_path"),
|
||||||
|
)
|
||||||
|
|
||||||
@model_validator(mode="after")
|
@model_validator(mode="after")
|
||||||
def set_grading_repo_name_from_cwd(self) -> "Config":
|
def set_grading_repo_name_from_cwd(self) -> "Config":
|
||||||
|
|
|
@ -99,6 +99,19 @@ def get_check_lists(repo_conf: repo.Config) -> Tuple[List[str], List[str]]:
|
||||||
immutable_files.append(file_path)
|
immutable_files.append(file_path)
|
||||||
file_sums.append(calc_sha256sum(file_path))
|
file_sums.append(calc_sha256sum(file_path))
|
||||||
file_names.append(file)
|
file_names.append(file)
|
||||||
|
immutable_dir = (repo_conf.root / repo_conf.path).parent / repo_conf.immutable_path
|
||||||
|
if not immutable_dir.exists():
|
||||||
|
return file_sums, file_names
|
||||||
|
file_sums = []
|
||||||
|
file_names = []
|
||||||
|
for file_path in immutable_dir.glob("**/*"):
|
||||||
|
if file_path.is_dir():
|
||||||
|
continue
|
||||||
|
if not file_path.exists():
|
||||||
|
logger.warning(f"Immutable file not found: {file_path}")
|
||||||
|
continue
|
||||||
|
file_sums.append(calc_sha256sum(file_path))
|
||||||
|
file_names.append(file_path.relative_to(immutable_dir).as_posix())
|
||||||
return file_sums, file_names
|
return file_sums, file_names
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ sandbox-token = "test"
|
||||||
max-total-score = 1000
|
max-total-score = 1000
|
||||||
max-size = 50.5
|
max-size = 50.5
|
||||||
|
|
||||||
|
immutable_path = "immutable"
|
||||||
|
|
||||||
# for tests
|
# for tests
|
||||||
[groups]
|
[groups]
|
||||||
name = ["joj", "run"]
|
name = ["joj", "run"]
|
||||||
|
|
|
@ -64,8 +64,8 @@
|
||||||
"-repoSize=50.5",
|
"-repoSize=50.5",
|
||||||
"-meta=README.md",
|
"-meta=README.md",
|
||||||
"-meta=Changelog.md",
|
"-meta=Changelog.md",
|
||||||
"-checkFileSumList=a5b63323a692d3d8b952442969649b4f823d58dae26429494f613df160710dfc,b1bbad25b830db0a77b15a033f9ca1b7ab44c1d2d05056412bd3e4421645f0bf,2ba059f3977e2e3dee6cacbfbf0ba2578baa1b8e04b4977aec400868b6e49856,3db23f7fb2ca9814617e767ddc41b77073180b3b0b73e87b5f2a6d3129f88f3a",
|
"-checkFileSumList=b1bbad25b830db0a77b15a033f9ca1b7ab44c1d2d05056412bd3e4421645f0bf,a5b63323a692d3d8b952442969649b4f823d58dae26429494f613df160710dfc,2ba059f3977e2e3dee6cacbfbf0ba2578baa1b8e04b4977aec400868b6e49856,3db23f7fb2ca9814617e767ddc41b77073180b3b0b73e87b5f2a6d3129f88f3a",
|
||||||
"-checkFileNameList=.gitignore,.gitattributes,.gitea/workflows/push.yaml,.gitea/workflows/release.yaml"
|
"-checkFileNameList=.gitattributes,.gitignore,.gitea/workflows/push.yaml,.gitea/workflows/release.yaml"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user