2024-05-13 12:58:26 +00:00
|
|
|
name: Blocks Playwright Tests
|
2024-03-07 19:32:58 +00:00
|
|
|
|
2023-12-15 17:34:29 +00:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
paths:
|
2024-03-07 19:32:58 +00:00
|
|
|
- '.github/workflows/blocks-playwright.yml' # This file
|
2023-12-15 17:34:29 +00:00
|
|
|
- 'plugins/woocommerce-blocks/**'
|
|
|
|
- 'plugins/woocommerce/src/Blocks/**'
|
|
|
|
- 'plugins/woocommerce/templates/**'
|
|
|
|
- 'plugins/woocommerce/patterns/**'
|
2024-03-07 13:01:22 +00:00
|
|
|
# Allow manually triggering the workflow.
|
|
|
|
workflow_dispatch:
|
|
|
|
|
2023-12-15 17:34:29 +00:00
|
|
|
env:
|
|
|
|
FORCE_COLOR: 1
|
|
|
|
|
|
|
|
jobs:
|
2024-05-13 12:58:26 +00:00
|
|
|
blocks-playwright-tests:
|
|
|
|
name: Shard ${{ matrix.shardIndex }} of ${{ matrix.shardTotal }}
|
2023-12-15 17:34:29 +00:00
|
|
|
timeout-minutes: 60
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: plugins/woocommerce-blocks
|
|
|
|
strategy:
|
2024-02-15 17:27:17 +00:00
|
|
|
fail-fast: false
|
2023-12-15 17:34:29 +00:00
|
|
|
matrix:
|
2024-05-13 12:58:26 +00:00
|
|
|
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
|
|
|
shardTotal: [10]
|
|
|
|
|
2023-12-15 17:34:29 +00:00
|
|
|
steps:
|
2024-05-13 12:58:26 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-12-15 17:34:29 +00:00
|
|
|
|
|
|
|
- name: Setup WooCommerce Monorepo
|
|
|
|
uses: ./.github/actions/setup-woocommerce-monorepo
|
|
|
|
with:
|
|
|
|
install: '@woocommerce/plugin-woocommerce...'
|
|
|
|
build: '@woocommerce/plugin-woocommerce'
|
|
|
|
|
2024-05-13 12:58:26 +00:00
|
|
|
- name: Install Playwright dependencies
|
|
|
|
run: pnpm exec playwright install chromium --with-deps
|
2023-12-15 17:34:29 +00:00
|
|
|
|
2024-05-13 12:58:26 +00:00
|
|
|
- name: Setup testing environment and start the server
|
|
|
|
run: pnpm env:start
|
2023-12-15 17:34:29 +00:00
|
|
|
|
|
|
|
- name: Run Playwright tests
|
2024-05-13 12:58:26 +00:00
|
|
|
run: pnpm test:e2e --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
|
|
|
|
|
|
|
|
- name: Archive debug artifacts (screenshots, traces)
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
if: ${{ !cancelled() }}
|
|
|
|
with:
|
|
|
|
name: failures-artifacts-shard-${{ matrix.shardIndex }}
|
|
|
|
path: plugins/woocommerce-blocks/tests/e2e/artifacts/test-results
|
|
|
|
if-no-files-found: ignore
|
2023-12-15 17:34:29 +00:00
|
|
|
|
2024-05-13 12:58:26 +00:00
|
|
|
merge-artifacts:
|
|
|
|
# Merges all artifacts from all shards into a single zip and
|
|
|
|
# deletes the parts. In case of a rerun, artifacts from the
|
|
|
|
# previous run will be retained by merging them with the new ones.
|
|
|
|
name: Merge Artifacts
|
|
|
|
if: ${{ !cancelled() }}
|
|
|
|
needs: [blocks-playwright-tests]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Merge Artifacts
|
|
|
|
uses: actions/upload-artifact/merge@v4
|
|
|
|
# Don't fail the job if there aren't any artifacts to merge.
|
|
|
|
continue-on-error: true
|
2023-12-15 17:34:29 +00:00
|
|
|
with:
|
2024-05-13 12:58:26 +00:00
|
|
|
name: failures-artifacts
|
|
|
|
delete-merged: true
|