diff --git a/.github/workflows/cpp-packaging.yml b/.github/workflows/cpp-packaging.yml index 32e9617a4..dd8fff421 100644 --- a/.github/workflows/cpp-packaging.yml +++ b/.github/workflows/cpp-packaging.yml @@ -178,7 +178,7 @@ jobs: tar -czhf ../packaging-tools.tgz . - name: upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: packaging-tools-${{ matrix.tools_platform }} path: packaging-tools.tgz @@ -236,7 +236,7 @@ jobs: find firebase-cpp-sdk-*-package -type f - name: upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firebase-cpp-sdk-ios-tvos-package path: firebase-cpp-sdk-ios-tvos-package.tgz @@ -296,7 +296,7 @@ jobs: find firebase-cpp-sdk-*-package -type f - name: upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firebase-cpp-sdk-android-package path: firebase-cpp-sdk-android-package.tgz @@ -450,7 +450,7 @@ jobs: continue-on-error: true - name: upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firebase-cpp-sdk-${{ env.SDK_NAME }}-build path: firebase-cpp-sdk-${{ env.SDK_NAME }}-build.tgz @@ -509,12 +509,17 @@ jobs: with: path: sdk-src - - name: download artifact - uses: actions/download-artifact@v3 + - name: download packaging-tool artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + pattern: packaging-tools-* + + - name: download build artifacts + uses: actions/download-artifact@v4 with: - # download-artifact doesn't support wildcards, but by default - # will download all artifacts. Sadly this is what we must do. path: artifacts + pattern: firebase-cpp-sdk-* - name: Setup python uses: actions/setup-python@v4 @@ -586,7 +591,7 @@ jobs: find firebase-cpp-sdk-*-package -type f - name: upload SDK zip - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firebase-cpp-sdk-${{ matrix.sdk_platform }}${{ matrix.suffix}}-package path: firebase-cpp-sdk-${{ matrix.sdk_platform }}${{ matrix.suffix}}-package.tgz @@ -656,12 +661,12 @@ jobs: if: ${{ github.event.inputs.downloadPublicVersion != '' || github.event.inputs.downloadPreviousRun != '' }} steps: - name: fetch artifact from previous run - uses: dawidd6/action-download-artifact@v2 + uses: actions/download-artifact@v4 if: ${{ github.event.inputs.downloadPreviousRun != '' }} with: name: 'firebase_cpp_sdk.zip' - workflow: 'cpp-packaging.yml' - run_id: ${{ github.event.inputs.downloadPreviousRun }} + github-token: ${{ github.token }} + run-id: ${{ github.event.inputs.downloadPreviousRun }} - name: fetch public SDK package from web if: ${{ github.event.inputs.downloadPublicVersion != '' && github.event.inputs.downloadPreviousRun == '' }} @@ -687,13 +692,13 @@ jobs: echo "::warning ::$(cat firebase_cpp_sdk_hash.txt)" - name: upload hash - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firebase_cpp_sdk_hash.txt path: firebase_cpp_sdk_hash.txt - name: upload SDK zip - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firebase_cpp_sdk.zip path: firebase_cpp_sdk.zip @@ -711,11 +716,10 @@ jobs: path: sdk-src - name: download artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - # download-artifact doesn't support wildcards, but by default - # will download all artifacts. Sadly this is what we must do. path: artifacts + pattern: firebase-cpp-sdk-*-package - name: merge SDK packages shell: bash @@ -750,13 +754,13 @@ jobs: find firebase_cpp_sdk -type f - name: upload hash - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firebase_cpp_sdk_hash.txt path: firebase_cpp_sdk_hash.txt - name: upload SDK zip - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firebase_cpp_sdk.zip path: firebase_cpp_sdk.zip @@ -767,7 +771,7 @@ jobs: needs: [merge_packages] steps: - name: download SDK zip - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: firebase_cpp_sdk.zip - name: unzip SDK and remove non-Windows files @@ -795,12 +799,12 @@ jobs: ${{ env.hashCommand }} --tag firebase_cpp_sdk_windows.zip > firebase_cpp_sdk_windows_hash.txt echo "::warning ::$(cat firebase_cpp_sdk_windows_hash.txt)" - name: upload Windows hash - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firebase_cpp_sdk_windows_hash.txt path: firebase_cpp_sdk_windows_hash.txt - name: upload Windows SDK zip - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firebase_cpp_sdk_windows.zip path: firebase_cpp_sdk_windows.zip diff --git a/.github/workflows/desktop.yml b/.github/workflows/desktop.yml index 2c5930e93..a1bd06c5a 100644 --- a/.github/workflows/desktop.yml +++ b/.github/workflows/desktop.yml @@ -270,7 +270,7 @@ jobs: sudo chmod -R +rwx ~/Library/Logs/DiagnosticReports/* || : - name: Archive crashes and binaries (linux) - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() && startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'ubuntu') with: name: crashes-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }} @@ -279,7 +279,7 @@ jobs: /tmp/bins/* - name: Archive crashes (mac) - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() && startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'macos') with: name: crashes-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }}-${{ matrix.xcode_version }} diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 1207b10ec..440351f8f 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -315,12 +315,12 @@ jobs: path: external/vcpkg/installed key: dev-vcpkg-${{ env.VCPKG_TRIPLET }}-${{ hashFiles(format('{0}', env.VCPKG_RESPONSE_FILE)) }}-${{ hashFiles('.git/modules/external/vcpkg/HEAD') }} - name: Fetch prebuilt packaged SDK from previous run - uses: dawidd6/action-download-artifact@v2 + uses: actions/download-artifact@v4 if: ${{ github.event.inputs.test_packaged_sdk != '' }} with: name: 'firebase_cpp_sdk.zip' - workflow: 'cpp-packaging.yml' - run_id: ${{ github.event.inputs.test_packaged_sdk }} + github-token: ${{ github.token }} + run-id: ${{ github.event.inputs.test_packaged_sdk }} - name: Build integration tests shell: bash env: @@ -358,7 +358,7 @@ jobs: --arch ${{ matrix.arch }} \ ${additional_flags[*]} - name: Upload Desktop Cmake - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: name: cmake-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }} @@ -373,25 +373,25 @@ jobs: echo "__SUMMARY_MISSING__" > build-results-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}.log.json fi - name: Upload Desktop integration tests artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: name: testapps-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }} path: testapps-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }} retention-days: ${{ env.artifactRetentionDays }} - name: Upload Desktop build results artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: - name: log-artifact + name: log-artifact-build-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }} path: build-results-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}* retention-days: ${{ env.artifactRetentionDays }} - name: Download log artifacts if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }} - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: test_results - name: log-artifact + name: log-artifact-build-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }} - name: Update PR label and comment if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }} shell: bash @@ -450,12 +450,12 @@ jobs: max_attempts: 3 command: scripts/gha/install_test_workflow_prereqs.sh -p Android - name: Fetch prebuilt packaged SDK from previous run - uses: dawidd6/action-download-artifact@v2 + uses: actions/download-artifact@v4 if: ${{ github.event.inputs.test_packaged_sdk != '' }} with: name: 'firebase_cpp_sdk.zip' - workflow: 'cpp-packaging.yml' - run_id: ${{ github.event.inputs.test_packaged_sdk }} + github-token: ${{ github.token }} + run-id: ${{ github.event.inputs.test_packaged_sdk }} - name: Build integration tests shell: bash run: | @@ -485,25 +485,25 @@ jobs: echo "__SUMMARY_MISSING__" > build-results-android-${{ matrix.os }}.log.json fi - name: Upload Android integration tests artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: name: testapps-android-${{ matrix.os }} path: testapps-android-${{ matrix.os }} retention-days: ${{ env.artifactRetentionDays }} - name: Upload Android build results artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: - name: log-artifact + name: log-artifact-build-android-${{ matrix.os }} path: build-results-android-${{ matrix.os }}* retention-days: ${{ env.artifactRetentionDays }} - name: Download log artifacts if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }} - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: test_results - name: log-artifact + name: log-artifact-build-android-${{ matrix.os }} - name: Update PR label and comment if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }} shell: bash @@ -554,12 +554,12 @@ jobs: max_attempts: 3 command: scripts/gha/install_test_workflow_prereqs.sh -p iOS - name: Fetch prebuilt packaged SDK from previous run - uses: dawidd6/action-download-artifact@v2 + uses: actions/download-artifact@v4 if: ${{ github.event.inputs.test_packaged_sdk != '' }} with: name: 'firebase_cpp_sdk.zip' - workflow: 'cpp-packaging.yml' - run_id: ${{ github.event.inputs.test_packaged_sdk }} + github-token: ${{ github.token }} + run-id: ${{ github.event.inputs.test_packaged_sdk }} - name: Build integration tests shell: bash run: | @@ -590,25 +590,25 @@ jobs: echo "__SUMMARY_MISSING__" > build-results-ios-${{ matrix.os }}.log.json fi - name: Upload iOS integration tests artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: name: testapps-ios-${{ matrix.os }} path: testapps-ios-${{ matrix.os }} retention-days: ${{ env.artifactRetentionDays }} - name: Upload iOS build results artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: - name: log-artifact + name: log-artifact-build-ios-${{ matrix.os }} path: build-results-ios-${{ matrix.os }}* retention-days: ${{ env.artifactRetentionDays }} - name: Download log artifacts if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }} - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: test_results - name: log-artifact + name: log-artifact-build-ios-${{ matrix.os }} - name: Update PR label and comment if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }} shell: bash @@ -659,12 +659,12 @@ jobs: max_attempts: 3 command: scripts/gha/install_test_workflow_prereqs.sh -p tvOS - name: Fetch prebuilt packaged SDK from previous run - uses: dawidd6/action-download-artifact@v2 + uses: actions/download-artifact@v4 if: ${{ github.event.inputs.test_packaged_sdk != '' }} with: name: 'firebase_cpp_sdk.zip' - workflow: 'cpp-packaging.yml' - run_id: ${{ github.event.inputs.test_packaged_sdk }} + github-token: ${{ github.token }} + run-id: ${{ github.event.inputs.test_packaged_sdk }} - name: Build integration tests shell: bash run: | @@ -694,25 +694,25 @@ jobs: echo "__SUMMARY_MISSING__" > build-results-tvos-${{ matrix.os }}.log.json fi - name: Upload tvOS integration tests artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: name: testapps-tvos-${{ matrix.os }} path: testapps-tvos-${{ matrix.os }} retention-days: ${{ env.artifactRetentionDays }} - name: Upload tvOS build results artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: - name: log-artifact + name: log-artifact-build-tvos-${{ matrix.os }} path: build-results-tvos-${{ matrix.os }}* retention-days: ${{ env.artifactRetentionDays }} - name: Download log artifacts if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }} - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: test_results - name: log-artifact + name: log-artifact-build-tvos-${{ matrix.os }} - name: Update PR label and comment if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }} shell: bash @@ -772,7 +772,7 @@ jobs: with: ref: ${{needs.check_and_prepare.outputs.github_ref}} - name: Download Desktop integration tests artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: testapps/testapps-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }} name: testapps-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }} @@ -834,17 +834,17 @@ jobs: fi - name: Upload Desktop test results artifact if: ${{ !cancelled() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: log-artifact + name: log-artifact-test-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }} path: testapps/test-results-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}* retention-days: ${{ env.artifactRetentionDays }} - name: Download log artifacts if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }} - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: test_results - name: log-artifact + name: log-artifact-test-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }} - name: Update PR label and comment if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }} shell: bash @@ -885,7 +885,7 @@ jobs: with: ref: ${{needs.check_and_prepare.outputs.github_ref}} - name: Download Android integration tests artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: testapps/testapps-android-${{ matrix.build_os }} name: testapps-android-${{ matrix.build_os }} @@ -948,31 +948,31 @@ jobs: fi - name: Upload Android test results artifact if: ${{ !cancelled() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: log-artifact + name: log-artifact-test-android-${{ matrix.build_os }}-${{ matrix.android_device }}-${{ matrix.test_type }} path: testapps/test-results-android-${{ matrix.build_os }}-${{ matrix.android_device }}-${{ matrix.test_type }}* retention-days: ${{ env.artifactRetentionDays }} - name: Upload Android test video artifact if: ${{ steps.device-info.outputs.device_type == 'virtual' && !cancelled() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: mobile-simulator-test-video-artifact + name: mobile-simulator-test-video-artifact-${{ matrix.build_os }}-${{ matrix.android_device }}-${{ matrix.test_type }} path: testapps/video-*-android-${{ matrix.build_os }}-${{ matrix.android_device }}-${{ matrix.test_type }}.mp4 retention-days: ${{ env.artifactRetentionDays }} - name: Upload Android test logcat artifact if: ${{ steps.device-info.outputs.device_type == 'virtual' && !cancelled() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: mobile-simulator-test-logcat-artifact + name: mobile-simulator-test-logcat-artifact-${{ matrix.build_os }}-${{ matrix.android_device }}-${{ matrix.test_type }} path: testapps/logcat-*-android-${{ matrix.build_os }}-${{ matrix.android_device }}-${{ matrix.test_type }}.txt retention-days: ${{ env.artifactRetentionDays }} - name: Download log artifacts if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }} - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: test_results - name: log-artifact + name: log-artifact-test-android-${{ matrix.build_os }}-${{ matrix.android_device }}-${{ matrix.test_type }} - name: Update PR label and comment if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }} shell: bash @@ -1015,7 +1015,7 @@ jobs: with: ref: ${{needs.check_and_prepare.outputs.github_ref}} - name: Download iOS integration tests artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: testapps/testapps-ios-${{ matrix.build_os }} name: testapps-ios-${{ matrix.build_os }} @@ -1133,24 +1133,24 @@ jobs: security delete-keychain tmp-keychain || true - name: Upload iOS test results artifact if: ${{ !cancelled() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: log-artifact + name: log-artifact-test-ios-${{ matrix.build_os }}-${{ matrix.ios_device }}-${{ matrix.test_type }} path: testapps/test-results-ios-${{ matrix.build_os }}-${{ matrix.ios_device }}-${{ matrix.test_type }}* retention-days: ${{ env.artifactRetentionDays }} - name: Upload iOS test video artifact if: ${{ steps.device-info.outputs.device_type == 'virtual' && !cancelled() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: mobile-simulator-test-video-artifact path: testapps/video-*-ios-${{ matrix.build_os }}-${{ matrix.ios_device }}-${{ matrix.test_type }}.mp4 retention-days: ${{ env.artifactRetentionDays }} - name: Download log artifacts if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }} - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: test_results - name: log-artifact + name: log-artifact-test-ios-${{ matrix.build_os }}-${{ matrix.ios_device }}-${{ matrix.test_type }} - name: Update PR label and comment if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }} shell: bash @@ -1185,7 +1185,7 @@ jobs: with: ref: ${{needs.check_and_prepare.outputs.github_ref}} - name: Download tvOS integration tests artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: testapps/testapps-tvos-${{ matrix.build_os }} name: testapps-tvos-${{ matrix.build_os }} @@ -1273,24 +1273,24 @@ jobs: security delete-keychain tmp-keychain || true - name: Upload tvOS test results artifact if: ${{ !cancelled() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: log-artifact + name: log-artifact-test-tvos-${{ matrix.build_os }}-${{ matrix.tvos_device }} path: testapps/test-results-tvos-${{ matrix.build_os }}-${{ matrix.tvos_device }}* retention-days: ${{ env.artifactRetentionDays }} - name: Upload tvOS test video artifact if: ${{ !cancelled() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: mobile-simulator-test-video-artifact path: testapps/video-*-tvos-${{ matrix.build_os }}-${{ matrix.tvos_device }}.mp4 retention-days: ${{ env.artifactRetentionDays }} - name: Download log artifacts if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }} - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: test_results - name: log-artifact + name: log-artifact-test-tvos-${{ matrix.build_os }}-${{ matrix.tvos_device }} - name: Update PR label and comment if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }} shell: bash @@ -1326,10 +1326,11 @@ jobs: - name: Install python deps run: pip install -r scripts/gha/python_requirements.txt - name: Download log artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: test_results - name: log-artifact + pattern: log-artifact-* + merge-multiple: true # Use a different token to remove the "in-progress" label, # to allow the removal to trigger the "Check Labels" workflow. - name: Generate token for GitHub API diff --git a/scripts/gha/report_build_status.py b/scripts/gha/report_build_status.py index 757053d20..38a280da4 100644 --- a/scripts/gha/report_build_status.py +++ b/scripts/gha/report_build_status.py @@ -466,41 +466,50 @@ def main(argv): run['log_success'] = True run['log_results'] = '' artifacts = firebase_github.list_artifacts(FLAGS.token, run['id']) - if 'log-artifact' in [a['name'] for a in artifacts]: - artifact_id = [a['id'] for a in artifacts if a['name'] == 'log-artifact'][0] - artifact_contents = firebase_github.download_artifact(FLAGS.token, artifact_id) - if artifact_contents: - artifact_data = io.BytesIO(artifact_contents) - artifact_zip = zipfile.ZipFile(artifact_data) - with tempfile.TemporaryDirectory() as tmpdir: - artifact_zip.extractall(path=tmpdir) - (success, results) = summarize_test_results.summarize_logs(tmpdir, False, False, True) - run['log_success'] = success - run['log_results'] = results - else: - # Artifacts expire after some time, so if they are gone, we need - # to read the GitHub logs instead. This is much slower, so we - # prefer to read artifacts instead whenever possible. - logging.info("Reading github logs for run %s instead", run['id']) - - logs_url = run['logs_url'] - headers = {'Accept': 'application/vnd.github.v3+json', 'Authorization': 'Bearer %s' % FLAGS.token} - with requests.get(logs_url, headers=headers, stream=True) as response: - if response.status_code == 200: - logs_compressed_data = io.BytesIO(response.content) - logs_zip = zipfile.ZipFile(logs_compressed_data) - m = get_message_from_github_log( - logs_zip, - r'summarize-results/.*Summarize results into GitHub', - r'\[error\]INTEGRATION TEST FAILURES\n—+\n(.*)$') - if m: - run['log_success'] = False - m2 = re.match(r'(.*?)^' + day, m.group(1), re.MULTILINE | re.DOTALL) - if m2: - run['log_results'] = m2.group(1) - else: - run['log_results'] = m.group(1) - logging.debug("Integration test results: %s", run['log_results']) + found_artifacts = False + # There are possibly multiple artifacts, so iterate through all of them, + # and extract the relevant ones into a temp folder, and then summarize them all. + with tempfile.TemporaryDirectory() as tmpdir: + for a in artifacts: + if 'log-artifact' in a['name']: + print("Checking this artifact:", a['name'], "\n") + artifact_contents = firebase_github.download_artifact(FLAGS.token, a['id']) + if artifact_contents: + found_artifacts = True + artifact_data = io.BytesIO(artifact_contents) + artifact_zip = zipfile.ZipFile(artifact_data) + artifact_zip.extractall(path=tmpdir) + if found_artifacts: + (success, results) = summarize_test_results.summarize_logs(tmpdir, False, False, True) + print("Results:", success, " ", results, "\n") + run['log_success'] = success + run['log_results'] = results + + if not found_artifacts: + # Artifacts expire after some time, so if they are gone, we need + # to read the GitHub logs instead. This is much slower, so we + # prefer to read artifacts instead whenever possible. + logging.info("Reading github logs for run %s instead", run['id']) + + logs_url = run['logs_url'] + headers = {'Accept': 'application/vnd.github.v3+json', 'Authorization': 'Bearer %s' % FLAGS.token} + with requests.get(logs_url, headers=headers, stream=True) as response: + if response.status_code == 200: + logs_compressed_data = io.BytesIO(response.content) + logs_zip = zipfile.ZipFile(logs_compressed_data) + m = get_message_from_github_log( + logs_zip, + r'summarize-results/.*Summarize results into GitHub', + r'\[error\]INTEGRATION TEST FAILURES\n—+\n(.*)$') + if m: + run['log_success'] = False + m2 = re.match(r'(.*?)^' + day, m.group(1), re.MULTILINE | re.DOTALL) + if m2: + run['log_results'] = m2.group(1) + else: + run['log_results'] = m.group(1) + logging.debug("Integration test results: %s", run['log_results']) + tests[day] = run bar.next()