Skip to content

Commit 04c7345

Browse files
authored
Additional small fixes for the build report. (#1343)
* Fix reports. * Fix ditto mark in text output. * Fix whitespace. * Increase one more timeout, to be safe.
1 parent 186060b commit 04c7345

File tree

3 files changed

+26
-21
lines changed

3 files changed

+26
-21
lines changed

.github/workflows/build-report.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ jobs:
5252
run: |
5353
echo -n > comment.md
5454
cat >> comment.md <<EOF
55-
56-
***
57-
5855
EOF
5956
cat report_short.md >> comment.md
6057
cat >> comment.md <<EOF
@@ -70,14 +67,17 @@ jobs:
7067
cat report.txt >> comment.md
7168
cat >> comment.md <<EOF
7269
</pre></details>
70+
71+
***
72+
7373
EOF
7474
- name: Show comment string
7575
run: |
7676
cat comment.md
7777
- name: Update GitHub issue (with retry)
7878
uses: nick-invision/retry@v2
7979
with:
80-
timeout_minutes: 1
80+
timeout_minutes: 5
8181
max_attempts: 3
8282
shell: bash
8383
command: python3 scripts/gha/update_issue_comment.py --token ${{ github.token }} --issue_title '[C++] Nightly Integration Testing Report' --start_tag build-dashboard-comment-start --end_tag build-dashboard-comment-end < comment.md

scripts/gha/it_workflow.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@
8282
_COMMENT_HIDDEN_DIVIDER = f'\r\n<hidden value="{_COMMENT_IDENTIFIER}"></hidden>\r\n'
8383

8484
_COMMENT_IDENTIFIER_DASHBOARD = "build-dashboard-comment"
85-
_COMMENT_DASHBOARD_START = f'\r\n<hidden value="{_COMMENT_IDENTIFIER_DASHBOARD}"-start></hidden>\r\n'
86-
_COMMENT_DASHBOARD_END = f'\r\n<hidden value="{_COMMENT_IDENTIFIER_DASHBOARD}"-end></hidden>\r\n'
85+
_COMMENT_DASHBOARD_START = f'\r\n<hidden value="{_COMMENT_IDENTIFIER_DASHBOARD}-start"></hidden>\r\n'
86+
_COMMENT_DASHBOARD_END = f'\r\n<hidden value="{_COMMENT_IDENTIFIER_DASHBOARD}-end"></hidden>\r\n'
8787

8888
_LOG_ARTIFACT_NAME = "log-artifact"
8989
_LOG_OUTPUT_DIR = "test_results"
@@ -235,12 +235,17 @@ def test_report(token, actor, commit, run_id, build_against, build_apis):
235235
previous_comment = github.get_issue_body(token, issue_number)
236236
[previous_prefix, previous_comment_repo, previous_comment_sdk,
237237
previous_comment_tip] = previous_comment.split(_COMMENT_HIDDEN_DIVIDER)
238+
logging.info("Previous prefix: %s", previous_prefix)
238239
# If there is a build dashboard, preserve it.
239240
if (_COMMENT_DASHBOARD_START in previous_prefix and
240241
_COMMENT_DASHBOARD_END in previous_prefix):
242+
logging.info("Found dashboard comment, preserving.")
241243
[_, previous_dashboard_plus_the_rest] = previous_prefix.split(_COMMENT_DASHBOARD_START)
242244
[previous_dashboard, _] = previous_dashboard_plus_the_rest.split(_COMMENT_DASHBOARD_END)
243245
prefix = prefix + _COMMENT_DASHBOARD_START + previous_dashboard + _COMMENT_DASHBOARD_END
246+
logging.info("New prefix: %s", prefix)
247+
else:
248+
logging.info("No dashboard comment '%s' or '%s'", _COMMENT_DASHBOARD_START, _COMMENT_DASHBOARD_END)
244249

245250
success_or_only_flakiness, log_summary = _get_summary_table(token, run_id)
246251
if success_or_only_flakiness and not log_summary:

scripts/gha/report_build_status.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
# Installing prerequisites:
16-
#
16+
#
1717
# sudo python3 -m pip install python-dateutil progress attrs
1818

1919
"""A utility to report on daily build status.
@@ -166,14 +166,14 @@ def format_errors(all_errors, severity, event):
166166
individual_errors = 0
167167
for product, platform_dict in errors.items():
168168
platforms = list(platform_dict.keys())
169-
169+
170170
if product == 'missing_log':
171171
product_name = 'missing logs'
172172
elif product == 'gma':
173173
product_name = product.upper()
174174
else:
175175
product_name = product.replace('_', ' ').title()
176-
176+
177177
if 'iOS' in platforms:
178178
all_simulator = True
179179
for descriptors in platform_dict['iOS']:
@@ -182,7 +182,7 @@ def format_errors(all_errors, severity, event):
182182
if all_simulator:
183183
platform_dict = rename_key(platform_dict, 'iOS', 'iOS simulator')
184184
platforms = list(platform_dict.keys())
185-
185+
186186
if 'Android' in platforms:
187187
all_emulator = True
188188
for descriptors in platform_dict['Android']:
@@ -202,7 +202,7 @@ def format_errors(all_errors, severity, event):
202202

203203
event_text = event.lower()
204204
severity_text = 'flake' if severity == 'FLAKINESS' else severity.lower()
205-
205+
206206
if total_errors == 0:
207207
return None
208208

@@ -345,7 +345,7 @@ def main(argv):
345345
all_days.add(day)
346346
# elif firestore_test_time in str(run['date']):
347347
# firestore_tests[day] = run
348-
348+
349349
workflow_id = _WORKFLOW_PACKAGING
350350
all_runs = github.list_workflow_runs(FLAGS.token, workflow_id, _BRANCH, 'schedule', _LIMIT)
351351
bar.next()
@@ -362,7 +362,7 @@ def main(argv):
362362
all_days.add(day)
363363
packaging_runs[day] = run
364364
packaging_run_ids.add(str(run['id']))
365-
365+
366366
workflow_id = _WORKFLOW_TESTS
367367
all_runs = github.list_workflow_runs(FLAGS.token, workflow_id, _BRANCH, 'workflow_dispatch', _LIMIT)
368368
bar.next()
@@ -376,22 +376,22 @@ def main(argv):
376376
if run['day'] < start_date or run['day'] > end_date: continue
377377
if run['triggering_actor']['login'] != _TRIGGER_USER: continue
378378
package_tests_all.append(run)
379-
379+
380380
# For each workflow_trigger run of the tests, determine which packaging run it goes with.
381381
package_tests = {}
382-
382+
383383
logging.info("Source tests: %s %s", list(source_tests.keys()), [source_tests[r]['id'] for r in source_tests.keys()])
384384
logging.info("Packaging runs: %s %s", list(packaging_runs.keys()), [packaging_runs[r]['id'] for r in packaging_runs.keys()])
385-
385+
386386
with progress.bar.Bar('Downloading triggered workflow logs...', max=len(package_tests_all)) as bar:
387387
for run in package_tests_all:
388388
day = str(run['date'].date())
389389
if day in package_tests and int(package_tests[day]['id']) < int(run['id']):
390390
bar.next()
391391
continue
392-
392+
393393
packaging_run = 0
394-
394+
395395
logs_url = run['logs_url']
396396
headers = {'Accept': 'application/vnd.github.v3+json', 'Authorization': 'Bearer %s' % FLAGS.token}
397397
with requests.get(logs_url, headers=headers, stream=True) as response:
@@ -407,9 +407,9 @@ def main(argv):
407407
if str(packaging_run) in packaging_run_ids:
408408
package_tests[day] = run
409409
bar.next()
410-
410+
411411
logging.info("Package tests: %s %s", list(package_tests.keys()), [package_tests[r]['id'] for r in package_tests.keys()])
412-
412+
413413
with progress.bar.Bar('Downloading test summaries...', max=len(source_tests)+len(package_tests)) as bar:
414414
for tests in source_tests, package_tests:
415415
for day in tests:
@@ -519,7 +519,7 @@ def main(argv):
519519
if FLAGS.output_markdown and notes:
520520
notes = "<details><summary>&nbsp;</summary>" + notes + "</details>"
521521
if notes == prev_notes and not FLAGS.output_markdown:
522-
if len(notes) > 0: notes = '\'\"\"'
522+
if len(notes) > 0: notes = "'''" # Creates a "ditto" mark.
523523
else:
524524
prev_notes = notes
525525

0 commit comments

Comments
 (0)