Skip to content

Commit 1ea86a7

Browse files
authored
Improve integration test results reporting. (#348)
Each test phase now uploads its results summary as a temporary artifact. A new summarize script looks at those artifacts and prints out a table and/or a github log entry at the end of the test run, if any builds or tests failed.
1 parent 6071a27 commit 1ea86a7

File tree

2 files changed

+411
-1
lines changed

2 files changed

+411
-1
lines changed

.github/workflows/integration_tests.yml

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,16 @@ jobs:
359359
if: matrix.target_platform != 'Desktop' && !cancelled()
360360
run: |
361361
python scripts/gha/test_lab.py --android_model ${{ needs.prepare_matrix.outputs.android_device }} --android_api ${{ needs.prepare_matrix.outputs.android_api }} --ios_model ${{ needs.prepare_matrix.outputs.ios_device }} --ios_version ${{ needs.prepare_matrix.outputs.ios_version }} --testapp_dir ta --code_platform cpp --key_file scripts/gha-encrypted/gcs_key_file.json
362-
362+
- name: Prepare results summary artifact
363+
if: ${{ !cancelled() }}
364+
run: |
365+
cp ta/summary.log test-results-${{ matrix.os }}-${{ matrix.target_platform }}-${{ matrix.ssl_variant }}.txt
366+
- name: Upload results summary artifact
367+
uses: actions/[email protected]
368+
if: ${{ !cancelled() }}
369+
with:
370+
name: test-results-${{ matrix.os }}-${{ matrix.target_platform }}-${{ matrix.ssl_variant }}
371+
path: test-results-${{ matrix.os }}-${{ matrix.target_platform }}-${{ matrix.ssl_variant }}.txt
363372
### The below allow us to set the failure label and comment early, when the first failure
364373
### in the matrix occurs. It'll be cleaned up in a subsequent job.
365374
- name: add failure label
@@ -377,6 +386,22 @@ jobs:
377386
run: |
378387
echo -n "::set-output name=time::"
379388
TZ=America/Los_Angeles date
389+
- name: download artifact
390+
uses: actions/[email protected]
391+
if: ${{ needs.check_trigger.outputs.should_update_labels && failure() && !cancelled() }}
392+
with:
393+
# download-artifact doesn't support wildcards, but by default
394+
# will download all artifacts. Sadly this is what we must do.
395+
path: test_results
396+
- name: get summary of test results
397+
id: get-summary
398+
shell: bash
399+
if: ${{ needs.check_trigger.outputs.should_update_labels && failure() && !cancelled() }}
400+
run: |
401+
mv test_results/test-results-*/test-results-*.txt test_results || true
402+
echo 'SUMMARY_TABLE<<EOF' >> $GITHUB_ENV
403+
python scripts/gha/summarize_test_results.py --dir test_results --markdown >> $GITHUB_ENV
404+
echo 'EOF' >> $GITHUB_ENV
380405
- name: add failure status comment
381406
uses: phulsechinmay/[email protected]
382407
if: ${{ needs.check_trigger.outputs.should_update_labels && failure() && !cancelled() }}
@@ -386,6 +411,7 @@ jobs:
386411
Requested by @${{github.actor}} on commit ${{github.event.pull_request.head.sha}}
387412
Last updated: ${{ steps.get-time.outputs.time }}
388413
**[View integration test results](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})**
414+
${{ env.SUMMARY_TABLE }}
389415
GITHUB_TOKEN: ${{ github.token }}
390416
COMMENT_IDENTIFIER: ${{ env.statusCommentIdentifier }}
391417

@@ -445,6 +471,29 @@ jobs:
445471
run: |
446472
echo -n "::set-output name=time::"
447473
TZ=America/Los_Angeles date
474+
- uses: actions/checkout@v2
475+
- name: Setup python
476+
uses: actions/setup-python@v2
477+
with:
478+
python-version: '3.7'
479+
480+
- name: Install python deps
481+
run: |
482+
python scripts/gha/install_prereqs_desktop.py
483+
484+
- name: download artifact
485+
uses: actions/[email protected]
486+
with:
487+
# download-artifact doesn't support wildcards, but by default
488+
# will download all artifacts. Sadly this is what we must do.
489+
path: test_results
490+
- name: get summary of test results
491+
shell: bash
492+
run: |
493+
mv test_results/test-results-*/test-results-*.txt test_results || true
494+
echo 'SUMMARY_TABLE<<EOF' >> $GITHUB_ENV
495+
python scripts/gha/summarize_test_results.py --dir test_results --markdown >> $GITHUB_ENV
496+
echo 'EOF' >> $GITHUB_ENV
448497
- name: add failure status comment
449498
uses: phulsechinmay/[email protected]
450499
with:
@@ -453,6 +502,7 @@ jobs:
453502
Requested by @${{github.actor}} on commit ${{github.event.pull_request.head.sha}}
454503
Last updated: ${{ steps.get-time.outputs.time }}
455504
**[View integration test results](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})**
505+
${{ env.SUMMARY_TABLE }}
456506
GITHUB_TOKEN: ${{ github.token }}
457507
COMMENT_IDENTIFIER: ${{ env.statusCommentIdentifier }}
458508

@@ -477,3 +527,32 @@ jobs:
477527
label: "${{ env.statusLabelInProgress }}"
478528
type: remove
479529

530+
summarize_results:
531+
name: "summarize-results"
532+
needs: [add_failure_label, add_success_label, remove_in_progress_label, tests]
533+
runs-on: ubuntu-latest
534+
if: ${{ !cancelled() }}
535+
steps:
536+
- uses: actions/checkout@v2
537+
- name: Setup python
538+
uses: actions/setup-python@v2
539+
with:
540+
python-version: '3.7'
541+
- name: Install python deps
542+
run: |
543+
python scripts/gha/install_prereqs_desktop.py
544+
- name: download artifact
545+
uses: actions/[email protected]
546+
with:
547+
path: test_results
548+
- name: Summarize results into GitHub log
549+
run: |
550+
mv test_results/test-results-*/test-results-*.txt test_results || true
551+
python scripts/gha/summarize_test_results.py --dir test_results --github_log
552+
- uses: geekyeggo/delete-artifact@1-glob-support
553+
# Delete all of the test result artifacts.
554+
with:
555+
name: |
556+
test-results-*
557+
failOnError: false
558+
useGlob: true

0 commit comments

Comments
 (0)