-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathci-checks.py
More file actions
70 lines (60 loc) · 1.61 KB
/
ci-checks.py
File metadata and controls
70 lines (60 loc) · 1.61 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import os
import subprocess
print("\n*** flake8 ***\n")
flake = subprocess.call(
["python", "-m", "flake8", "--extend-exclude", ".venv", "--max-line-length=120"]
)
print("\n\n*** pyright ***\n")
right = subprocess.call(["python", "-m", "pyright", "--project", "pyrightconfig.json"])
print("\n\n*** pydocstyle ***\n")
docstyle = subprocess.call(
[
"python",
"-m",
"pydocstyle",
"--add-ignore=D100",
"--add-select=D212",
"./datasim",
]
)
print("\n\n*** pytest ***\n")
test = subprocess.call(
["python", "-m", "pytest", "--cov-config=.coveragerc", "--cov=datasim/"]
)
docs = -100
if test == 0:
print("\n\n*** sphinx ***\n")
os.chdir("docs")
docs = subprocess.call(["python", "-m", "sphinx", "-M", "html", "source", "build"])
print("\n\nSummary\n=======\n")
if flake == 0:
print("✔️ flake8 Success")
else:
print("❌ flake8 Failed")
if right == 0:
print("✔️ pyright Success")
else:
print("❌ pyright Failed")
if docstyle == 0:
print("✔️ pydocstyle Success")
else:
print("❌ pydocstyle Failed")
if test == 0:
print("✔️ pytest Success")
else:
print("❌ pytest Failed")
if docs == 0:
print("✔️ sphinx Success")
elif docs == -100:
print(".. sphinx Skipped")
else:
print("❌ sphinx Failed")
total = (
(1 if flake == 0 else 0)
+ (1 if right == 0 else 0)
+ (1 if docstyle == 0 else 0)
+ (1 if test == 0 else 0)
+ (1 if docs == 0 else 0)
)
print(f"\n{total}/5 passed.")
print("Ready to push!" if total == 5 else "Work to do...")