Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: extract batch download action (#23410)

Yury Semikhatsky90aa378e8fd7
diff --git a/.github/actions/download-blob-report-from-azure/action.yml b/.github/actions/download-blob-report-from-azure/action.yml
new file mode 100644
index 0000000000..8986053183
--- /dev/null
+++ b/.github/actions/download-blob-report-from-azure/action.yml
@@ -0,0 +1,23 @@
+name: 'Download blob report from Azure'
+description: 'Download blob report from Azure blob storage'
+inputs:
+ run_dir:
+ description: 'Name of the Azure blob storage directory containing blob report'
+ required: true
+ type: string
+ connection_string:
+ description: 'Azure connection string'
+ required: true
+ type: string
+runs:
+ using: "composite"
+ steps:
+ - name: Download blob report from Azure
+ shell: bash
+ run: |
+ mkdir -p ${{ inputs.run_dir }}
+ LIST=$(az storage blob list -c '$web' --prefix ${{ inputs.run_dir }} --connection-string "${{ inputs.connection_string }}")
+ for name in $(echo $LIST | jq --raw-output '.[].name | select(test(".jsonl$"))');
+ do
+ az storage blob download -c '$web' --name $name -f $name --connection-string "${{ inputs.connection_string }}"
+ done
\ No newline at end of file
diff --git a/.github/workflows/tests_primary.yml b/.github/workflows/tests_primary.yml
index 56b4eafb71..d84f9af2f3 100644
--- a/.github/workflows/tests_primary.yml
+++ b/.github/workflows/tests_primary.yml
@@ -82,19 +82,15 @@ jobs:
DEBUG: pw:install
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- - name: Download Blob Reports from Azure Blob Storage
- run: |
- run_dir='run-${{ github.run_id }}-${{ github.sha }}-test_linux'
- mkdir -p $run_dir
- LIST=$(az storage blob list -c '$web' --prefix $run_dir --connection-string "${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}")
- for name in $(echo $LIST | jq --raw-output '.[].name | select(test(".jsonl$"))');
- do
- az storage blob download -c '$web' --name $name -f $name --connection-string "${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}"
- done
+ - name: Download blob report from Azure
+ uses: ./.github/actions/download-blob-report-from-azure
+ with:
+ run_dir: 'run-${{ github.run_id }}-${{ github.sha }}-test_linux'
+ connection_string: '${{ secrets.AZURE_CONNECTION_STRING }}'
- name: Merge into HTML Report
run: |
npx playwright merge-reports --reporter html --attachments missing 'run-${{ github.run_id }}-${{ github.sha }}-test_linux'
- - name: Upload HTML Report to Azure Blob Storage
+ - name: Upload HTML Report to Azure
run: |
az storage blob upload-batch -s playwright-report -d '$web/run-${{ github.run_id }}-${{ github.sha }}-test_linux' --connection-string "${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}"
echo "Report url: https://mspwblobreport.z1.web.core.windows.net/run-${{ github.run_id }}-${{ github.sha }}-test_linux/index.html"
@@ -227,19 +223,15 @@ jobs:
DEBUG: pw:install
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- - name: Download Blob Reports from Azure Blob Storage
- run: |
- run_dir='run-${{ github.run_id }}-${{ github.sha }}-test_test_runner'
- mkdir -p $run_dir
- LIST=$(az storage blob list -c '$web' --prefix $run_dir --connection-string "${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}")
- for name in $(echo $LIST | jq --raw-output '.[].name | select(test(".jsonl$"))');
- do
- az storage blob download -c '$web' --name $name -f $name --connection-string "${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}"
- done
+ - name: Download blob report from Azure
+ uses: ./.github/actions/download-blob-report-from-azure
+ with:
+ run_dir: 'run-${{ github.run_id }}-${{ github.sha }}-test_test_runner'
+ connection_string: '${{ secrets.AZURE_CONNECTION_STRING }}'
- name: Merge into HTML Report
run: |
npx playwright merge-reports --reporter html --attachments missing 'run-${{ github.run_id }}-${{ github.sha }}-test_test_runner'
- - name: Upload HTML Report to Azure Blob Storage
+ - name: Upload HTML report to Azure
run: |
az storage blob upload-batch -s playwright-report -d '$web/run-${{ github.run_id }}-${{ github.sha }}-test_test_runner' --connection-string "${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}"
echo "Report url: https://mspwblobreport.z1.web.core.windows.net/run-${{ github.run_id }}-${{ github.sha }}-test_test_runner/index.html"
diff --git a/.github/workflows/tests_secondary.yml b/.github/workflows/tests_secondary.yml
index cfe54c9532..634bbbfd0e 100644
--- a/.github/workflows/tests_secondary.yml
+++ b/.github/workflows/tests_secondary.yml
@@ -229,19 +229,15 @@ jobs:
DEBUG: pw:install
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- - name: Download Blob Reports from Azure Blob Storage
- run: |
- run_dir='run-${{ github.run_id }}-${{ github.sha }}-tracing_linux'
- mkdir -p $run_dir
- LIST=$(az storage blob list -c '$web' --prefix $run_dir --connection-string "${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}")
- for name in $(echo $LIST | jq --raw-output '.[].name | select(test(".jsonl$"))');
- do
- az storage blob download -c '$web' --name $name -f $name --connection-string "${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}"
- done
+ - name: Download blob report from Azure
+ uses: ./.github/actions/download-blob-report-from-azure
+ with:
+ run_dir: 'run-${{ github.run_id }}-${{ github.sha }}-tracing_linux'
+ connection_string: '${{ secrets.AZURE_CONNECTION_STRING }}'
- name: Merge into HTML Report
run: |
npx playwright merge-reports --reporter html --attachments missing 'run-${{ github.run_id }}-${{ github.sha }}-tracing_linux'
- - name: Upload HTML Report to Azure Blob Storage
+ - name: Upload HTML report to Azure
run: |
az storage blob upload-batch -s playwright-report -d '$web/run-${{ github.run_id }}-${{ github.sha }}-tracing_linux' --connection-string "${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}"
echo "Report url: https://mspwblobreport.z1.web.core.windows.net/run-${{ github.run_id }}-${{ github.sha }}-tracing_linux/index.html"