Skip to content

Commit

Permalink
Merge branch 'trunk' into add-product-attributes-lookup-table-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Konamiman committed May 14, 2024
2 parents 6df0ad6 + d66c5b8 commit 7d286c8
Show file tree
Hide file tree
Showing 436 changed files with 35,604 additions and 25,284 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
module.exports = ( { core } ) => {
const { UPLOAD_RESULT, E2E_RESULT, PLUGIN_NAME, PLUGIN_SLUG } = process.env;
const { E2E_RESULT, PLUGIN_NAME, PLUGIN_SLUG } = process.env;
const { selectEmoji } = require( './utils' );
const fs = require( 'fs' );

const emoji_UPLOAD = selectEmoji( UPLOAD_RESULT );
const emoji_E2E = selectEmoji( E2E_RESULT );
const reportURL = `https://woocommerce.github.io/woocommerce-test-reports/daily/${ PLUGIN_SLUG }/e2e`;

Expand All @@ -12,18 +11,9 @@ module.exports = ( { core } ) => {
type: 'section',
text: {
type: 'mrkdwn',
text: `<${ reportURL }|*${ PLUGIN_NAME }*>`,
text: `<${ reportURL }|*${ PLUGIN_NAME }*>: E2E tests ${ emoji_E2E }`,
},
},
{
type: 'context',
elements: [
{
type: 'mrkdwn',
text: `"Upload plugin" test ${ emoji_UPLOAD }\tOther E2E tests ${ emoji_E2E }`,
},
],
},
{
type: 'divider',
},
Expand Down
16 changes: 8 additions & 8 deletions .github/project-community-pr-assigner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@
- team: developer-advocacy

"packages/js/api/**/*":
- team: solaris
- team: vortex

"packages/js/e2e-utils/**/*":
- team: solaris
- team: vortex

"packages/js/e2e-environment/**/*":
- team: solaris
- team: vortex

"packages/js/api-core-tests/**/*":
- team: solaris
- team: vortex

"packages/js/e2e-core-tests/**/*":
- team: solaris
- team: vortex

"packages/js/admin-e2e-tests/**/*":
- team: solaris
- team: vortex

"packages/js/components/**/*":
- team: mothra
Expand All @@ -51,10 +51,10 @@
- team: mothra

"packages/js/dependency-extraction-webpack-plugin/**/*":
- team: mothra
- team: vortex

"packages/js/eslint-plugin/**/*":
- team: mothra
- team: vortex

"packages/js/experimental/**/*":
- team: mothra
Expand Down
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
70 changes: 35 additions & 35 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,12 @@ on:
# Allow manually triggering the workflow.
workflow_dispatch:


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 +25,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 }}
38 changes: 36 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ jobs:
if ( baseRef ) {
baseRef = `--base-ref origin/${ baseRef }`;
}
let githubEvent = ${{ toJson( github.event_name ) }};
const child_process = require( 'node:child_process' );
child_process.execSync( `pnpm utils ci-jobs ${ baseRef } --event ${ githubEvent }` );
Expand Down Expand Up @@ -116,12 +116,29 @@ jobs:
install: '${{ matrix.projectName }}...'
build: '${{ matrix.projectName }}'

- name: Get commit message
id: get_commit_message
run: |
if [[ "${{ github.event_name }}" == "push" ]]; then
COMMIT_MESSAGE=`echo "${{ github.event.head_commit.message }}" | head -1`
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
COMMIT_MESSAGE="${{ github.event.pull_request.title }}"
else
COMMIT_MESSAGE="${{ github.event_name }}"
fi
echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" >> "$GITHUB_OUTPUT"
shell: bash

- name: 'Prepare Test Environment'
id: 'prepare-test-environment'
if: ${{ matrix.testEnv.shouldCreate }}
run: 'pnpm --filter="${{ matrix.projectName }}" ${{ matrix.testEnv.start }}'

- name: 'Run tests'
env:
BUILDKITE_ANALYTICS_TOKEN: ${{ secrets.BUILDKITE_ANALYTICS_TOKEN }}
BUILDKITE_ANALYTICS_MESSAGE: ${{ steps.get_commit_message.outputs.COMMIT_MESSAGE }}
run: 'pnpm --filter="${{ matrix.projectName }}" ${{ matrix.command }}'

- name: 'Upload artifacts'
Expand Down Expand Up @@ -153,12 +170,29 @@ jobs:
install: '${{ matrix.projectName }}...'
build: '${{ matrix.projectName }}'

- name: Get commit message
id: get_commit_message
run: |
if [[ "${{ github.event_name }}" == "push" ]]; then
COMMIT_MESSAGE=`echo "${{ github.event.head_commit.message }}" | head -1`
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
COMMIT_MESSAGE="${{ github.event.pull_request.title }}"
else
COMMIT_MESSAGE="${{ github.event_name }}"
fi
echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" >> "$GITHUB_OUTPUT"
shell: bash

- name: 'Prepare Test Environment'
id: 'prepare-test-environment'
if: ${{ matrix.testEnv.shouldCreate }}
run: 'pnpm --filter="${{ matrix.projectName }}" ${{ matrix.testEnv.start }}'

- name: 'Run tests'
env:
BUILDKITE_ANALYTICS_TOKEN: ${{ secrets.BUILDKITE_API_ANALYTICS_TOKEN }}
BUILDKITE_ANALYTICS_MESSAGE: ${{ steps.get_commit_message.outputs.COMMIT_MESSAGE }}
run: 'pnpm --filter="${{ matrix.projectName }}" ${{ matrix.command }}'

- name: 'Upload artifacts'
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/community-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ on:
types: [opened]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# For pull_request_target, cancel concurrent jobs with the same type and branch.
# Don't cancel for other events, by grouping on the unique run_id.
group: community-label-${{ github.event_name }}-${{ github.event.action }}-${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.ref || github.run_id }}
cancel-in-progress: true

permissions: {}
Expand All @@ -27,10 +29,10 @@ jobs:
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c

- name: Install Octokit
run: npm --prefix .github/workflows/scripts install @octokit/action
run: npm --prefix .github/workflows/scripts install @octokit/action@~6.1.0

- name: Install Actions Core
run: npm --prefix .github/workflows/scripts install @actions/core
run: npm --prefix .github/workflows/scripts install @actions/core@~1.10.1

- name: Check if user is a community contributor
id: check
Expand Down

0 comments on commit 7d286c8

Please sign in to comment.