Skip to content

Commit

Permalink
Merge branch 'trunk' into update/increase-timeout-for-connect-flow
Browse files Browse the repository at this point in the history
  • Loading branch information
thilinah committed May 27, 2024
2 parents 94561e1 + 02a0bba commit e059dab
Show file tree
Hide file tree
Showing 1,223 changed files with 47,666 additions and 145,950 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
node_modules
!.github
2 changes: 1 addition & 1 deletion .github/project-pr-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
'focus: documentation':
- docs/**/*

'tool: monorepo infrastructure':
'focus: monorepo infrastructure':
- .github/**/*
- bin/**/*
- tools/**/*
Expand Down
105 changes: 0 additions & 105 deletions .github/workflows/blocks-e2e.yml

This file was deleted.

72 changes: 38 additions & 34 deletions .github/workflows/blocks-playwright.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run Blocks Playwright Tests
name: Blocks Playwright Tests

on:
pull_request:
Expand All @@ -11,13 +11,16 @@ on:
# Allow manually triggering the workflow.
workflow_dispatch:

concurrency:
group: '${{ github.workflow }}-${{ github.ref }}'
cancel-in-progress: true

env:
FORCE_COLOR: 1

jobs:
e2e:
name: ${{ matrix.config.name }} [${{ matrix.shards.name }}]
blocks-playwright-tests:
name: Shard ${{ matrix.shardIndex }} of ${{ matrix.shardTotal }}
timeout-minutes: 60
runs-on: ubuntu-latest
defaults:
Expand All @@ -26,47 +29,48 @@ jobs:
strategy:
fail-fast: false
matrix:
config:
- name: Default (Block) Theme
file: playwright.config.ts
resultPath: test-results
- name: Classic Theme
file: playwright.classic-theme.config.ts
resultPath: test-results-classic-theme
- name: Side Effects
file: playwright.side-effects.config.ts
resultPath: test-results-side-effects
- name: Block Theme With Templates
file: playwright.block-theme-with-templates.config.ts
resultPath: test-results-block-theme-with-templates
shards:
- name: 1/5
- name: 2/5
- name: 3/5
- name: 4/5
- name: 5/5
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
shardTotal: [10]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup WooCommerce Monorepo
uses: ./.github/actions/setup-woocommerce-monorepo
with:
install: '@woocommerce/plugin-woocommerce...'
build: '@woocommerce/plugin-woocommerce'

- name: Install Playwright
run: pnpm --filter='@woocommerce/block-library' exec playwright install --with-deps
- name: Install Playwright dependencies
run: pnpm exec playwright install chromium --with-deps

- name: Start wp-env
run: pnpm --filter='@woocommerce/block-library' env:start
- name: Setup testing environment and start the server
run: pnpm env:start

- name: Run Playwright tests
working-directory: plugins/woocommerce-blocks
run: pnpm playwright test --config=tests/e2e/${{ matrix.config.file }} --shard ${{ matrix.shards.name }}
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

- uses: actions/upload-artifact@v3
if: ${{ failure() }}
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
with:
name: playwright-report-${{ matrix.config.name }}
path: plugins/woocommerce-blocks/tests/e2e/artifacts/${{ matrix.config.resultPath }}
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
name: failures-artifacts
delete-merged: true
25 changes: 22 additions & 3 deletions .github/workflows/cherry-pick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,34 @@ jobs:
outputs:
run: ${{ steps.check.outputs.run }}
steps:
- name: Fetch Pull Request Details
if: github.event.issue.pull_request
id: fetch_pr_details
uses: actions/github-script@v6
with:
script: |
const issue = context.payload.issue;
const pullRequestUrl = issue.pull_request.url;
const prDetails = await github.request(pullRequestUrl);
core.setOutput('base_ref', prDetails.data.base.ref);
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: check
id: check
uses: actions/github-script@v6
with:
script: |
const baseRef = process.env.BASE_REF;
console.log("baseRef:", baseRef);
let run = false;
const isManualTrigger = context.payload.inputs && context.payload.inputs.release_branch && context.payload.inputs.release_branch != null;
const isMergedMilestonedIssue = context.payload.issue && context.payload.issue.pull_request != null && context.payload.issue.pull_request.merged_at != null && context.payload.issue.milestone != null;
const isMergedMilestonedIssue = context.payload.issue && context.payload.issue.pull_request != null && context.payload.issue.pull_request.merged_at != null && context.payload.issue.milestone != null && baseRef == 'trunk';
const isMergedMilestonedPR = context.payload.pull_request && context.payload.pull_request != null && context.payload.pull_request.merged == true && context.payload.pull_request.milestone != null;
const isMergedMilestonedPR = context.payload.pull_request && context.payload.pull_request != null && context.payload.pull_request.merged == true && context.payload.pull_request.milestone != null && baseRef == 'trunk';
const isBot = context.payload.pull_request && ( context.payload.pull_request.user.login == 'github-actions[bot]' || context.payload.pull_request.user.type == 'Bot' );
Expand All @@ -59,6 +75,9 @@ jobs:
} else {
core.setOutput( 'run', 'false' );
}
env:
BASE_REF: ${{ steps.fetch_pr_details.outputs.base_ref }}

prep:
name: Prep inputs
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -363,4 +382,4 @@ jobs:
Release lead please review:
${{ steps.cherry-pick-pr.outputs.cherry-pick-pr }}
${{ steps.deletion-pr.outputs.deletion-pr }}
${{ steps.deletion-pr.outputs.deletion-pr }}
Loading

0 comments on commit e059dab

Please sign in to comment.