-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci.py
33 lines (32 loc) · 1.01 KB
/
ci.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from verify import check
from pathlib import Path
from termcolor import cprint
if __name__ == "__main__":
failed = False
files = 0
paths = list(Path(".").glob("*/chall.yaml"))
paths.extend(Path(".").glob("*/chall.yml"))
for path in paths:
files += 1
try:
errors, warnings = check(path)
except Exception as e:
cprint(f"{path}: Fatal error", "red", attrs=["bold"])
print(e)
failed = True
print("")
continue
if len(errors) > 0:
cprint(f"{path}: {len(errors)} error(s)", "red", attrs=["bold"])
for error in errors:
print(error)
failed = True
if len(warnings) > 0:
cprint(f"{path}: {len(warnings)} warning(s)", "yellow", attrs=["bold"])
for warning in warnings:
print(warning)
if len(errors) > 0 or len(warnings) > 0:
print("")
print(f"Checked {files} files.")
if failed:
exit(1)