Skip to content

Commit 09fb205

Browse files
authored
Always show table with tests (#7101)
1 parent 2d042c1 commit 09fb205

File tree

2 files changed

+20
-36
lines changed

2 files changed

+20
-36
lines changed

.github/actions/test_ya/action.yml

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,6 @@ runs:
261261

262262
for RETRY in $(seq 1 $TEST_RETRY_COUNT)
263263
do
264-
if [ $RETRY = $TEST_RETRY_COUNT ]; then
265-
IS_LAST_RETRY=1
266-
else
267-
IS_LAST_RETRY=0
268-
fi
269-
270264
if [ $RETRY != 1 ]; then
271265
IS_RETRY=1
272266
else
@@ -344,6 +338,22 @@ runs:
344338
"$CURRENT_JUNIT_XML_PATH"
345339
cp $CURRENT_JUNIT_XML_PATH $LAST_JUNIT_REPORT_XML
346340

341+
TESTS_RESULT=0
342+
.github/scripts/tests/fail-checker.py "$CURRENT_JUNIT_XML_PATH" --output_path $CURRENT_PUBLIC_DIR/failed_count.txt || TESTS_RESULT=$?
343+
FAILED_TESTS_COUNT=$(cat $CURRENT_PUBLIC_DIR/failed_count.txt)
344+
345+
IS_LAST_RETRY=0
346+
347+
if [ $TESTS_RESULT = 0 ] || [ $RETRY = $TEST_RETRY_COUNT ]; then
348+
IS_LAST_RETRY=1
349+
fi
350+
351+
if [ $FAILED_TESTS_COUNT -gt 500 ]; then
352+
IS_LAST_RETRY=1
353+
TOO_MANY_FAILED="Too many tests failed, NOT going to retry"
354+
echo $TOO_MANY_FAILED | GITHUB_TOKEN="${{ github.token }}" .github/scripts/tests/comment-pr.py --fail
355+
fi
356+
347357
if [ "${{ inputs.run_tests }}" = "true" ]; then
348358
GITHUB_TOKEN=${{ github.token }} .github/scripts/tests/generate-summary.py \
349359
--summary_links "$SUMMARY_LINKS" \
@@ -395,18 +405,7 @@ runs:
395405
echo "runid=" >> $GITHUB_OUTPUT
396406
fi
397407

398-
TESTS_RESULT=0
399-
.github/scripts/tests/fail-checker.py "$CURRENT_JUNIT_XML_PATH" --output_path $CURRENT_PUBLIC_DIR/failed_count.txt || TESTS_RESULT=$?
400-
401-
FAILED_TESTS_COUNT=$(cat $CURRENT_PUBLIC_DIR/failed_count.txt)
402-
403-
if [ $FAILED_TESTS_COUNT -gt 500 ]; then
404-
TOO_MANY_FAILED="Too many tests failed, NOT going to retry"
405-
echo $TOO_MANY_FAILED | GITHUB_TOKEN="${{ github.token }}" .github/scripts/tests/comment-pr.py --fail
406-
break
407-
fi
408-
409-
if [ $TESTS_RESULT = 0 ]; then
408+
if [ $IS_LAST_RETRY = 1 ]; then
410409
break
411410
fi
412411
done;

.github/scripts/tests/generate-summary.py

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,6 @@ def add_line(self, line: TestSummaryLine):
152152
self.is_failed |= line.is_failed
153153
self.lines.append(line)
154154

155-
@property
156-
def is_empty(self):
157-
return len(self.lines) == 0
158-
159155
def render_line(self, items):
160156
return f"| {' | '.join(items)} |"
161157

@@ -262,11 +258,8 @@ def write_summary(summary: TestSummary):
262258
else:
263259
fp = sys.stdout
264260

265-
if summary.is_empty:
266-
fp.write(f"Test run completed, no test results found")
267-
else:
268-
for line in summary.render(add_footnote=True):
269-
fp.write(f"{line}\n")
261+
for line in summary.render(add_footnote=True):
262+
fp.write(f"{line}\n")
270263

271264
fp.write("\n")
272265

@@ -283,9 +276,6 @@ def gen_summary(public_dir, public_dir_url, paths, is_retry: bool):
283276
for fn, suite, case in iter_xml_files(path):
284277
test_result = TestResult.from_junit(case)
285278
summary_line.add(test_result)
286-
287-
if not summary_line.tests:
288-
continue
289279

290280
if os.path.isabs(html_fn):
291281
html_fn = os.path.relpath(html_fn, public_dir)
@@ -300,12 +290,7 @@ def gen_summary(public_dir, public_dir_url, paths, is_retry: bool):
300290

301291
def get_comment_text(pr: PullRequest, summary: TestSummary, summary_links: str, is_last_retry: bool)->tuple[str, list[str]]:
302292
color = "red"
303-
if summary.is_empty:
304-
color = "green"
305-
return color, [
306-
f"Test run completed, no test results found for commit {pr.head.sha}. "
307-
]
308-
elif summary.is_failed:
293+
if summary.is_failed:
309294
color = "red" if is_last_retry else "yellow"
310295
result = f"Some tests failed, follow the links below."
311296
if not is_last_retry:

0 commit comments

Comments
 (0)