Skip to content

Commit

Permalink
Download junit xml files from MH
Browse files Browse the repository at this point in the history
Android and raspi emit junit xml files that MH pulls from the devices and uploads to GCS.
Download those files and upload them as artifacts so the test report uploader will pick them up.
  • Loading branch information
oxve committed May 16, 2024
1 parent 864d1f9 commit bc17741
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
24 changes: 23 additions & 1 deletion .github/actions/on_device_tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ runs:
uses: isarkis/setup-gcloud@40dce7857b354839efac498d3632050f568090b6 # v1.1.1
- name: Set env vars
env:
GCS_PATH: gs://${PROJECT_NAME}-test-artifacts/${WORKFLOW}/${GITHUB_RUN_NUMBER}/${{ matrix.platform }}_${{ matrix.config }}
WORKFLOW: ${{ github.workflow }}
run: |
echo "PROJECT_NAME=$(gcloud config get-value project)" >> $GITHUB_ENV
Expand All @@ -41,6 +42,7 @@ runs:
echo "SHARD_NAME=unit_test_${{ matrix.shard }}" >> $GITHUB_ENV
echo "TEST_TYPE=unit_test" >> $GITHUB_ENV
echo "USE_SHARDING=1" >> $GITHUB_ENV
echo "GCS_RESULTS=${GCS_PATH}/results.zip" >> $GITHUB_ENV
fi
shell: bash
- name: Run ${{ env.SHARD_NAME }} Tests on ${{ matrix.platform }} Platform
Expand Down Expand Up @@ -77,7 +79,8 @@ runs:
${DIMENSION:+"--dimension" "$DIMENSION"} \
${USE_SHARDING:+"--unittest_shard_index" "${{ matrix.shard }}"} \
${ON_DEVICE_TEST_ATTEMPTS:+"--test_attempts" "$ON_DEVICE_TEST_ATTEMPTS"} \
--archive_path gs://${PROJECT_NAME}-test-artifacts/${WORKFLOW}/${GITHUB_RUN_NUMBER}/${{ matrix.platform }}_${{ matrix.config }}/artifacts.tar \
--archive_path ${GCS_PATH}/artifacts.tar \
--gcs_xml_result_path=${GCS_RESULTS}
--label github \
--label ${GITHUB_EVENT_NAME} \
--label ${WORKFLOW} \
Expand All @@ -89,3 +92,22 @@ runs:
--label author-${GITHUB_PR_HEAD_USER_LOGIN:-$GITHUB_COMMIT_AUTHOR_USERNAME} \
--label author_id-${GITHUB_PR_HEAD_USER_ID:-$GITHUB_COMMIT_AUTHOR_EMAIL}
shell: bash
- name: Download ${{ matrix.platform }} Test Results
if: env.TEST_TYPE == 'unit_test'
run: |
set -eux
gsutil -d cp "${GCS_RESULTS_PATH}" results.zip
if [[ $? -ne 0 ]]; then
warn="Unable to download results from ${GCS_RESULTS_PATH}"
echo "::warning title=No unit test results::$warn"
exit 0
fi
mkdir -p unit-test-results/${{ matrix.platform }}/${{ matrix.shard }}/
unzip results.zip -d unit-test-results/${{ matrix.platform }}/${{ matrix.shard }}/
shell: bash
- name: Archive Unit Test Results
uses: actions/upload-artifact@v3
if: env.TEST_TYPE == 'unit_test'
with:
name: unit-test-results
path: unit-test-results/
2 changes: 2 additions & 0 deletions .github/workflows/unit_test_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ name: Upload Unit Test Results
on:
workflow_run:
workflows:
- android
- evergreen
- linux
- raspi
- win32
types:
- completed
Expand Down
1 change: 1 addition & 0 deletions tools/on_device_tests_gateway.proto
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ message OnDeviceTestsCommand {
string start_timeout = 20;
string test_timeout = 21;
string builder_url = 22;
string gcs_xml_result_path = 23;
}

// Working directory and command line arguments to be passed to the gateway.
Expand Down
5 changes: 5 additions & 0 deletions tools/on_device_tests_gateway_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def run_trigger_command(self, workdir: str, args: argparse.Namespace):
config=args.config,
tag=args.tag,
labels=args.label,
gcs_xml_result_path=args.gcs_xml_result_path,
builder_name=args.builder_name,
builder_url=args.builder_url,
change_id=args.change_id,
Expand Down Expand Up @@ -192,6 +193,10 @@ def main():
'if any. Saved with performance test results')
trigger_parser.add_argument(
'--builder_url', type=str, help='Url to the run, if any.')
trigger_parser.add_argument(
'--gcs_xml_result_path',
type=str,
help='GCS url where test result files should be uploaded.')
trigger_parser.add_argument(
'-n',
'--build_number',
Expand Down

0 comments on commit bc17741

Please sign in to comment.