diff --git a/.github/actions/download-blob-report-from-azure/action.yml b/.github/actions/download-blob-report-from-azure/action.yml index c2bd197257..8026de64ea 100644 --- a/.github/actions/download-blob-report-from-azure/action.yml +++ b/.github/actions/download-blob-report-from-azure/action.yml @@ -23,7 +23,7 @@ runs: OUTPUT_DIR='${{ inputs.output_dir }}' mkdir -p $OUTPUT_DIR LIST=$(az storage blob list -c '$web' --prefix ${{ inputs.blob_prefix }} --connection-string "${{ inputs.connection_string }}") - for name in $(echo $LIST | jq --raw-output '.[].name | select(test(".jsonl$"))'); + for name in $(echo $LIST | jq --raw-output '.[].name | select(test("report-.*\\.zip$"))'); do az storage blob download -c '$web' --name $name -f $OUTPUT_DIR/$(basename $name) --connection-string "${{ inputs.connection_string }}" - done \ No newline at end of file + done diff --git a/.github/actions/upload-blob-report/action.yml b/.github/actions/upload-blob-report/action.yml new file mode 100644 index 0000000000..a1ed440351 --- /dev/null +++ b/.github/actions/upload-blob-report/action.yml @@ -0,0 +1,28 @@ +name: 'Upload blob report' +description: 'Upload blob to Azure blob storage or to GitHub artifacts (for pull requests)' +inputs: + report_dir: + description: 'Directory containing blob report' + required: true + type: string + default: 'test-results/blob-report' + connection_string: + description: 'Azure connection string' + required: true + type: string +runs: + using: "composite" + steps: + - name: Upload blob report to Azure + if: always() && github.event_name == 'push' + shell: bash + run: | + REPORT_DIR='run-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.sha }}' + az storage blob upload-batch -s "${{ inputs.report_dir }}" -d "\$web/$REPORT_DIR" --connection-string "${{ inputs.connection_string }}" + - name: Upload blob report to GitHub + if: always() && github.event_name == 'pull_request' + uses: actions/upload-artifact@v3 + with: + name: blob-report-${{ github.run_attempt }} + path: ${{ inputs.report_dir }} + retention-days: 30 \ No newline at end of file diff --git a/.github/workflows/create_test_report.yml b/.github/workflows/create_test_report.yml index f004bc81f8..050fd241fd 100644 --- a/.github/workflows/create_test_report.yml +++ b/.github/workflows/create_test_report.yml @@ -28,14 +28,6 @@ jobs: with: name: 'blob-report-${{ github.event.workflow_run.run_attempt }}' path: 'blob-report' - - - name: Read pull request number - if: ${{ always() && github.event.workflow_run.event == 'pull_request' }} - uses: ./.github/actions/download-artifact - with: - name: 'pull-request' - path: './' - - name: Download blob report from Azure if: ${{ always() && github.event.workflow_run.event == 'push' }} uses: ./.github/actions/download-blob-report-from-azure @@ -60,6 +52,13 @@ jobs: REPORT_DIR='run-${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}-${{ github.sha }}' az storage blob upload-batch -s blob-report -d "\$web/$REPORT_DIR" --connection-string "${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}" + - name: Read pull request number + if: ${{ always() && github.event.workflow_run.event == 'pull_request' }} + uses: ./.github/actions/download-artifact + with: + name: 'pull-request' + path: './' + - name: Comment on PR uses: actions/github-script@v6 with: @@ -80,6 +79,10 @@ jobs: ...context.repo, commit_sha: context.sha, }); + if (!data.length) { + core.info(`No pull request found for commit ${context.sha}. Not publishing anything.`); + return; + } prNumber = data[0].number; } else { core.error('Unsupported workflow trigger event: ' + context.payload.workflow_run.event); diff --git a/.github/workflows/tests_primary.yml b/.github/workflows/tests_primary.yml index c5694b3c08..deb9ab2f08 100644 --- a/.github/workflows/tests_primary.yml +++ b/.github/workflows/tests_primary.yml @@ -61,25 +61,12 @@ jobs: - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json if: always() shell: bash - - name: Upload blob report to Azure - if: always() && github.event_name == 'push' - run: az storage blob upload-batch -s test-results/blob-report -d '$web/run-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.sha }}' --connection-string "${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}" - - name: Upload blob report to GitHub - uses: actions/upload-artifact@v3 - if: always() && github.event_name == 'pull_request' + - name: Upload blob report + if: always() + uses: ./.github/actions/upload-blob-report with: - name: blob-report-${{ github.run_attempt }} - path: test-results/blob-report - retention-days: 30 - - name: Write the pull request number in an file - if: always() && github.event_name == 'pull_request' - run: echo '${{ github.event.number }}' > pull_request_number.txt; - - name: Upload artifact with pull request number - uses: actions/upload-artifact@v3 - if: always() && github.event_name == 'pull_request' - with: - name: pull-request - path: pull_request_number.txt + report_dir: test-results/blob-report + connection_string: '${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}' test_linux_chromium_tot: name: ${{ matrix.os }} (chromium tip-of-tree) @@ -102,6 +89,8 @@ jobs: - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=chromium env: PWTEST_CHANNEL: chromium-tip-of-tree + PWTEST_BLOB_REPORT: 1 + PWTEST_BLOB_SUFFIX: "-${{ matrix.os }}-chromium-tip-of-tree" - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json if: always() shell: bash @@ -151,25 +140,12 @@ jobs: - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json if: always() shell: bash - - name: Upload blob report to Azure - if: always() && github.event_name == 'push' - run: az storage blob upload-batch -s test-results/blob-report -d '$web/run-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.sha }}' --connection-string "${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}" - - name: Upload blob report to GitHub - uses: actions/upload-artifact@v3 - if: always() && github.event_name == 'pull_request' + - name: Upload blob report + if: always() + uses: ./.github/actions/upload-blob-report with: - name: blob-report-${{ github.run_attempt }} - path: test-results/blob-report - retention-days: 30 - - name: Write the pull request number in an file - if: always() && github.event_name == 'pull_request' - run: echo '${{ github.event.number }}' > pull_request_number.txt; - - name: Upload artifact with pull request number - uses: actions/upload-artifact@v3 - if: always() && github.event_name == 'pull_request' - with: - name: pull-request - path: pull_request_number.txt + report_dir: test-results/blob-report + connection_string: '${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}' test_web_components: name: Web Components @@ -245,3 +221,16 @@ jobs: if: always() shell: bash + write-pull-request-number: + name: Write PR number + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + - name: Write triggering pull request number in a file + shell: bash + run: echo '${{ github.event.number }}' > pull_request_number.txt; + - name: Upload artifact with the pull request number + uses: actions/upload-artifact@v3 + with: + name: pull-request + path: pull_request_number.txt \ No newline at end of file diff --git a/.github/workflows/tests_secondary.yml b/.github/workflows/tests_secondary.yml index 27686ff7ec..ab77fd668f 100644 --- a/.github/workflows/tests_secondary.yml +++ b/.github/workflows/tests_secondary.yml @@ -208,25 +208,12 @@ jobs: - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json if: always() shell: bash - - name: Upload blob report to Azure - if: always() && github.event_name == 'push' - run: az storage blob upload-batch -s test-results/blob-report -d '$web/run-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.sha }}' --connection-string "${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}" - - name: Upload blob report to GitHub - uses: actions/upload-artifact@v3 - if: always() && github.event_name == 'pull_request' + - name: Upload blob report + if: always() + uses: ./.github/actions/upload-blob-report with: - name: blob-report-${{ github.run_attempt }} - path: test-results/blob-report - retention-days: 30 - - name: Write the pull request number in an file - if: always() && github.event_name == 'pull_request' - run: echo '${{ github.event.number }}' > pull_request_number.txt; - - name: Upload artifact with pull request number - uses: actions/upload-artifact@v3 - if: always() && github.event_name == 'pull_request' - with: - name: pull-request - path: pull_request_number.txt + report_dir: test-results/blob-report + connection_string: '${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}' chrome_stable_linux: name: "Chrome Stable (Linux)" @@ -686,3 +673,17 @@ jobs: - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json if: always() shell: bash + + write-pull-request-number: + name: Write PR number + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + - name: Write triggering pull request number in a file + shell: bash + run: echo '${{ github.event.number }}' > pull_request_number.txt; + - name: Upload artifact with the pull request number + uses: actions/upload-artifact@v3 + with: + name: pull-request + path: pull_request_number.txt \ No newline at end of file