Skip to content

Commit 5c3926d

Browse files
authored
Merge pull request #230 from ISISComputingGroup/add_extra_jobs
Add new jenkins jobs to job summary check
2 parents 7272a57 + 9c7e871 commit 5c3926d

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

developer_support_script/check_build_stability.py

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
ERROR_THRESHOLD_PERCENTAGE = 50
1313

1414

15-
def request_json(url: str) -> Any:
15+
def request_json(url: str) -> dict | None:
1616
"""
1717
Utility function to get Json data from Jenkins.
1818
@@ -63,7 +63,7 @@ def __init__(self, name: str) -> None:
6363
self.num_evaluate_builds = self._get_num_evaluate_builds()
6464
self.num_aborted_builds = self._get_num_aborted_builds()
6565

66-
def add_job(self, job):
66+
def add_job(self, job: "JobData") -> None:
6767
"""
6868
add another job's results to here so we can get a summary across jobs
6969
"""
@@ -113,7 +113,8 @@ def _get_num_aborted_builds(self) -> int:
113113

114114
for build in self.builds["ABORTED"]:
115115
data = request_json(
116-
f"https://epics-jenkins.isis.rl.ac.uk/job/{self.name}/{build['number']}/api/json?tree=actions[causes[*]]"
116+
f"https://epics-jenkins.isis.rl.ac.uk/job/{self.name}/"
117+
f"{build['number']}/api/json?tree=actions[causes[*]]"
117118
)
118119
for action in data["actions"]:
119120
if (
@@ -153,7 +154,8 @@ def _get_test_reports(self) -> list[Any]:
153154

154155
def _get_failed_tests(self) -> Counter:
155156
"""
156-
Gets all the failed tests. The name is generated by using the the class name and the test name.
157+
Gets all the failed tests. The name is generated by using
158+
the class name and the test name.
157159
158160
Returns:
159161
Counter: Key is test case name, value is number of failures.
@@ -170,7 +172,8 @@ def _get_failed_tests(self) -> Counter:
170172

171173
def print_results(self) -> None:
172174
"""
173-
Prints the percentage of aborted builds for the job, the percentage of failures with no test report, and the percentage failure of each failing test.
175+
Prints the percentage of aborted builds for the job, the percentage of
176+
failures with no test report, and the percentage failure of each failing test.
174177
"""
175178
if not self.buildable:
176179
print("WARNING: build is currently disabled")
@@ -179,13 +182,13 @@ def print_results(self) -> None:
179182
# Aborted builds.
180183
valid_builds = self.num_evaluate_builds + self.no_test_report_failures
181184
all_builds = valid_builds + self.num_aborted_builds
182-
percentage_aborted_builds = (self.num_aborted_builds / all_builds) * 100 if all_builds > 0 else 0
185+
percentage_aborted_builds = (
186+
(self.num_aborted_builds / all_builds) * 100 if all_builds > 0 else 0
187+
)
183188
level = calculate_level(
184189
percentage_aborted_builds, ERROR_THRESHOLD_PERCENTAGE, WARNING_THRESHOLD_PERCENTAGE
185190
)
186-
print(
187-
f"{level}: Aborted builds [{percentage_aborted_builds:.0f}%]"
188-
)
191+
print(f"{level}: Aborted builds [{percentage_aborted_builds:.0f}%]")
189192

190193
# Failures with no test report
191194
# valid_builds will only be 0 if self.no_test_report_failures is also 0
@@ -200,7 +203,8 @@ def print_results(self) -> None:
200203
WARNING_THRESHOLD_PERCENTAGE,
201204
)
202205
print(
203-
f"{level}: Failed builds with no Test Report [{percentage_no_test_report_failures:.0f}%]"
206+
f"{level}: Failed builds with no Test Report "
207+
f"[{percentage_no_test_report_failures:.0f}%]"
204208
)
205209

206210
# Tests.
@@ -212,12 +216,10 @@ def print_results(self) -> None:
212216
level = calculate_level(
213217
percentage_test_failure, ERROR_THRESHOLD_PERCENTAGE, WARNING_THRESHOLD_PERCENTAGE
214218
)
215-
print(
216-
f"{level}: [{percentage_test_failure:.0f}%] {name}"
217-
)
219+
print(f"{level}: [{percentage_test_failure:.0f}%] {name}")
218220

219221

220-
def process_jobs(jobs, summary_name):
222+
def process_jobs(jobs: list(str), summary_name: str) -> None:
221223
first = True
222224
job_summary = None
223225
for job in jobs:
@@ -242,7 +244,12 @@ def process_jobs(jobs, summary_name):
242244
"System_Tests_win32",
243245
"System_Tests_galilold",
244246
"System_Tests_Win11",
247+
"System_Tests_Win11_Win11",
248+
]
249+
SQUISH_JOBS = [
250+
"System_Tests_Squish",
251+
"System_Tests_Squish_Win11",
252+
"System_Tests_Squish_Win11_Win11",
245253
]
246-
SQUISH_JOBS = ["System_Tests_Squish", "System_Tests_Squish_Win11"]
247254
process_jobs(EPICS_JOBS, "EPICS")
248255
process_jobs(SQUISH_JOBS, "SQUISH")

0 commit comments

Comments
 (0)