Skip to content

Commit b9a53cf

Browse files
authored
Add Firestore test history report (#1403)
* Add --firestore flag to report Firestore history. * Add Firestore report to nightly cron job. * Remove multiline commands. * Revert "Remove multiline commands." This reverts commit 6393ae9. * Fix tabbing. * Fix packaging test detection for Firestore.
1 parent b5e5477 commit b9a53cf

File tree

2 files changed

+41
-9
lines changed

2 files changed

+41
-9
lines changed

.github/workflows/build-report.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,16 @@ env:
1313

1414
jobs:
1515
generate-report:
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
test_set: [ general, firestore ]
1620
runs-on: ubuntu-20.04
21+
name: generate-report-${{ matrix.test_set }}
1722
steps:
23+
- name: Pause 5 minutes to offset Firestore fetches.
24+
if: ${{ matrix.test_set == 'firestore' }}
25+
run: sleep 300
1826
- name: Setup python
1927
uses: actions/setup-python@v4
2028
with:
@@ -36,14 +44,24 @@ jobs:
3644
timeout_minutes: 20
3745
max_attempts: 3
3846
shell: bash
39-
command: python3 scripts/gha/report_build_status.py --token ${{ github.token }} --days ${{ env.numDays }} --write_cache build_status_short.cache
47+
command: |
48+
extra_flags=
49+
if [[ "${{ matrix.test_set }}" == "firestore" ]]; then
50+
extra_flags=--firestore
51+
fi
52+
python3 scripts/gha/report_build_status.py --token ${{ github.token }} --days ${{ env.numDays }} --write_cache build_status_short.cache ${extra_flags}
4053
- name: Fetch extended GitHub jobs (with retry)
4154
uses: nick-invision/retry@v2
4255
with:
4356
timeout_minutes: 80
4457
max_attempts: 3
4558
shell: bash
46-
command: python3 scripts/gha/report_build_status.py --token ${{ github.token }} --days ${{ env.numDaysExtended }} --write_cache build_status.cache
59+
command: |
60+
extra_flags=
61+
if [[ "${{ matrix.test_set }}" == "firestore" ]]; then
62+
extra_flags=--firestore
63+
fi
64+
python3 scripts/gha/report_build_status.py --token ${{ github.token }} --days ${{ env.numDaysExtended }} --write_cache build_status.cache ${extra_flags}
4765
- name: Generate report files
4866
run: |
4967
python3 scripts/gha/report_build_status.py --token ${{ github.token }} --days ${{ env.numDays }} --output_markdown --read_cache build_status_short.cache > report_short.md
@@ -88,4 +106,9 @@ jobs:
88106
timeout_minutes: 5
89107
max_attempts: 3
90108
shell: bash
91-
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
109+
command: |
110+
issue_title='[C++] Nightly Integration Testing Report'
111+
if [[ "${{ matrix.test_set }}" == "firestore" ]]; then
112+
issue_title='[C++] Nightly Integration Testing Report for Firestore'
113+
fi
114+
python3 scripts/gha/update_issue_comment.py --token ${{ github.token }} --issue_title "${issue_title}" --start_tag build-dashboard-comment-start --end_tag build-dashboard-comment-end < comment.md

scripts/gha/report_build_status.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@
112112
"summary_include_crashes", True,
113113
"Whether to include CRASH/TIMEOUT in the test summary.")
114114

115+
flags.DEFINE_bool(
116+
"firestore", False,
117+
"Report on Firestore tests rather than on general tests.")
118+
115119
_WORKFLOW_TESTS = 'integration_tests.yml'
116120
_WORKFLOW_PACKAGING = 'cpp-packaging.yml'
117121
_TRIGGER_USER = 'firebase-workflow-trigger[bot]'
@@ -380,11 +384,10 @@ def main(argv):
380384
if run['status'] != 'completed': continue
381385
if run['day'] < start_date or run['day'] > end_date: continue
382386
run['duration'] = dateutil.parser.parse(run['updated_at'], ignoretz=True) - run['date']
383-
if general_test_time in str(run['date']):
387+
compare_test_time = firestore_test_time if FLAGS.firestore else general_test_time
388+
if compare_test_time in str(run['date']):
384389
source_tests[day] = run
385390
all_days.add(day)
386-
# elif firestore_test_time in str(run['date']):
387-
# firestore_tests[day] = run
388391

389392
workflow_id = _WORKFLOW_PACKAGING
390393
all_runs = firebase_github.list_workflow_runs(FLAGS.token, workflow_id, _BRANCH, 'schedule', _LIMIT)
@@ -426,9 +429,15 @@ def main(argv):
426429
with progress.bar.Bar('Downloading triggered workflow logs...', max=len(package_tests_all)) as bar:
427430
for run in package_tests_all:
428431
day = str(run['date'].date())
429-
if day in package_tests and int(package_tests[day]['id']) < int(run['id']):
430-
bar.next()
431-
continue
432+
if day in package_tests:
433+
# Packaging triggers two tests. For Firestore, we want the larger run ID (the second run triggered).
434+
if FLAGS.firestore and int(package_tests[day]['id']) > int(run['id']):
435+
bar.next()
436+
continue
437+
# For general tests we want the smaller run ID (the first run triggered).
438+
if not FLAGS.firestore and int(package_tests[day]['id']) < int(run['id']):
439+
bar.next()
440+
continue
432441

433442
packaging_run = 0
434443

0 commit comments

Comments
 (0)