feat: sync Shanhe 2.2 source and add remote package verification
Shanhe source and offline package checks / verify (pull_request) Failing after 5s
Shanhe source and offline package checks / verify (pull_request) Failing after 5s
This commit is contained in:
+5
-3
@@ -1,10 +1,12 @@
|
||||
import pathlib,zipfile,json,hashlib
|
||||
root=pathlib.Path('dist');out=pathlib.Path('artifacts/shanhe-puzzle-xhs.zip')
|
||||
files=sorted(p for p in root.rglob('*') if p.is_file())
|
||||
if len(files)>200:raise SystemExit(f'ZIP文件数量超过200个上限: {len(files)}')
|
||||
with zipfile.ZipFile(out,'w',zipfile.ZIP_DEFLATED,compresslevel=9) as z:
|
||||
for p in sorted(root.rglob('*')):
|
||||
if p.is_file():z.write(p,p.relative_to(root).as_posix())
|
||||
for p in files:z.write(p,p.relative_to(root).as_posix())
|
||||
with zipfile.ZipFile(out) as z:
|
||||
assert 'index.html' in z.namelist()
|
||||
assert z.testzip() is None
|
||||
assert len(z.infolist())<=200
|
||||
print('离线 ZIP:',out.resolve(),' | ',round(out.stat().st_size/1024),'KB')
|
||||
pathlib.Path('artifacts/package-report.json').write_text(json.dumps({'file':str(out),'bytes':out.stat().st_size,'sha256':hashlib.sha256(out.read_bytes()).hexdigest(),'archiveIntegrity':'passed','rootEntry':'index.html'},indent=2))
|
||||
pathlib.Path('artifacts/package-report.json').write_text(json.dumps({'file':str(out),'bytes':out.stat().st_size,'fileCount':len(files),'fileLimit':200,'sha256':hashlib.sha256(out.read_bytes()).hexdigest(),'archiveIntegrity':'passed','rootEntry':'index.html'},indent=2))
|
||||
|
||||
Reference in New Issue
Block a user