Skip to content

Commit a1f755f

Browse files
Merge release/10.5.0 into trunk
2 parents 76cb317 + 67367d5 commit a1f755f

File tree

273 files changed

+16924
-6420
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

273 files changed

+16924
-6420
lines changed

.claude/CLAUDE.md

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,29 @@ WooCommerce Payments (WCPay) is a WordPress plugin that provides payment process
1515
- See `woocommerce-payments.php` header for current version and WordPress/WooCommerce/PHP requirements
1616
- See `package.json` for Node.js version requirements (engines field)
1717

18+
## WooCommerce Core Reference
19+
20+
WooPayments is a separate plugin that integrates with WooCommerce core, leveraging its hooks, filters, and APIs. Having the WooCommerce codebase available locally provides useful context when working on WooPayments.
21+
22+
**Location:** `../woocommerce` (or set `WOOCOMMERCE_DIR` env var to override)
23+
24+
**Key paths within WooCommerce:**
25+
- `plugins/woocommerce/includes/` - Core WooCommerce PHP classes
26+
- `plugins/woocommerce/src/` - Modern PSR-4 WooCommerce code
27+
- `plugins/woocommerce-blocks/` - Checkout and cart blocks
28+
29+
**When to reference WooCommerce core:**
30+
- When working with WC hooks/filters - check the core implementation to understand parameters, timing, and context
31+
- When using WC base classes (e.g., `WC_Payment_Gateway`) - understand the parent class behavior
32+
- When debugging issues that may involve core behavior
33+
- When implementing features that interact with WC APIs (orders, products, customers, etc.)
34+
35+
**Auto-reference triggers:** Proactively check WooCommerce core when you encounter:
36+
- Classes using `WC_*` base classes
37+
- Hooks starting with `woocommerce_` or `wc_`
38+
- Usage of `WC()` singleton or WC helper functions
39+
- Order, product, or customer manipulation code
40+
1841
## Directory Structure
1942

2043
### PHP Code
@@ -105,7 +128,8 @@ npm run psalm # PHP static analysis
105128

106129
### Other
107130
```bash
108-
npm run changelog # Add changelog entry
131+
npm run changelog # Add changelog entry (interactive)
132+
npm run changelog:add # Add changelog entry (non-interactive, for automation)
109133
npm run i18n:pot # Generate translations
110134
```
111135

@@ -128,7 +152,9 @@ npm run i18n:pot # Generate translations
128152
- Release branch: `trunk`
129153
- Husky manages git hooks
130154
- **Before creating a PR:**
131-
- Must run `npm run changelog add` and commit the changelog entry (choose 'patch' if change is not significant)
155+
- Must add and commit a changelog entry (use 'patch' significance if change is not significant)
156+
- For Claude/automation: `npm run changelog:add -- --type=<type> --entry="<description>"`
157+
- For interactive use: `npm run changelog`
132158
- Changelog must be committed and pushed before creating the PR
133159
- Use PR template from `.github/PULL_REQUEST_TEMPLATE.md` when creating pull requests
134160
- Include testing instructions
@@ -148,8 +174,15 @@ npm run i18n:pot # Generate translations
148174
- Use npm for JavaScript dependencies
149175

150176
### Changelog
151-
- Use `npm run changelog` to add entries
152-
- Types: Add, Fix, Update, Dev
177+
- Use `npm run changelog` for interactive changelog entry creation
178+
- Use `npm run changelog:add` for non-interactive (automation/Claude) usage:
179+
```bash
180+
npm run changelog:add -- --type=fix --entry="Fixed a bug"
181+
npm run changelog:add -- --type=add --entry="Added feature" --significance=minor
182+
# Or with positional args: npm run changelog:add -- patch fix "Fixed a bug"
183+
```
184+
- Types: add, fix, update, dev
185+
- Significances: patch (default), minor, major
153186
- Entries go in `changelog/` directory
154187

155188
## Important Configuration Files

.github/workflows/compatibility.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
env:
77
WC_MIN_SUPPORTED_VERSION: '7.6.0'
88
WP_MIN_SUPPORTED_VERSION: '6.0'
9-
PHP_MIN_SUPPORTED_VERSION: '7.3'
9+
PHP_MIN_SUPPORTED_VERSION: '7.4'
1010

1111
concurrency:
1212
group: ${{ github.workflow }}-${{ github.ref }}

.github/workflows/e2e-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
# - WC RC: YES blocks tests (newest version, test upcoming release)
7373
7474
# Define common values to reduce repetition
75-
PHP_LEGACY="7.3"
75+
PHP_LEGACY="7.4"
7676
PHP_STABLE="8.3"
7777
PHP_LATEST="8.4"
7878
TEST_GROUPS_WCPAY="wcpay"
@@ -84,7 +84,7 @@ jobs:
8484
# Initialize empty matrix array
8585
MATRIX_ENTRIES=()
8686
87-
# Add WC 7.7.0 with PHP 7.3 only (legacy - NO blocks tests)
87+
# Add WC 7.7.0 with PHP 7.4 only (legacy - NO blocks tests)
8888
MATRIX_ENTRIES+=("{\"woocommerce\":\"7.7.0\",\"php\":\"$PHP_LEGACY\",\"test_groups\":\"$TEST_GROUPS_WCPAY\",\"test_branches\":\"$TEST_BRANCHES_MERCHANT\"}")
8989
MATRIX_ENTRIES+=("{\"woocommerce\":\"7.7.0\",\"php\":\"$PHP_LEGACY\",\"test_groups\":\"$TEST_GROUPS_WCPAY\",\"test_branches\":\"$TEST_BRANCHES_SHOPPER\"}")
9090
# The following tests are temporarily disabled due to a fatal error with WC 7.7.0.

.github/workflows/php-lint-test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ on:
77
env:
88
WP_VERSION: latest
99
WC_MIN_SUPPORTED_VERSION: '7.6.0'
10-
GUTENBERG_VERSION: latest
11-
PHP_MIN_SUPPORTED_VERSION: '7.3'
10+
PHP_MIN_SUPPORTED_VERSION: '7.4'
1211

1312
concurrency:
1413
group: ${{ github.workflow }}-${{ github.ref }}
@@ -41,8 +40,8 @@ jobs:
4140
- name: "Generate matrix"
4241
id: generate_matrix
4342
run: |
44-
PHP_VERSIONS=$( echo "[\"$PHP_MIN_SUPPORTED_VERSION\", \"7.3\", \"7.4\"]" )
45-
echo "matrix={\"php\":$PHP_VERSIONS}" >> $GITHUB_OUTPUT
43+
# PHP 7.4+ can use latest Gutenberg
44+
echo "matrix={\"php\":[\"7.4\"],\"gutenberg\":[\"latest\"],\"include\":[{\"php\":\"$PHP_MIN_SUPPORTED_VERSION\",\"gutenberg\":\"22.3.0\"}]}" >> $GITHUB_OUTPUT
4645
4746
test:
4847
name: PHP testing
@@ -69,3 +68,4 @@ jobs:
6968
- run: bash bin/run-ci-tests.bash
7069
env:
7170
WC_VERSION: ${{ env.WC_MIN_SUPPORTED_VERSION }}
71+
GUTENBERG_VERSION: ${{ matrix.gutenberg }}

.github/workflows/qit-e2e-pr.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: QIT E2E Tests - Pull Request
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
- trunk
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
build:
16+
name: Build plugin
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Set up repository
23+
uses: ./.github/actions/setup-repo
24+
25+
- name: Build the plugin
26+
uses: ./.github/actions/build
27+
28+
- name: Upload plugin artifact
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: woocommerce-payments-${{ github.run_id }}
32+
path: woocommerce-payments.zip
33+
retention-days: 1
34+
35+
generate-matrix:
36+
name: Generate test matrix
37+
runs-on: ubuntu-latest
38+
outputs:
39+
matrix: ${{ steps.generate.outputs.matrix }}
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@v4
43+
44+
- name: Generate matrix
45+
id: generate
46+
run: |
47+
# Get WC versions from matrix script
48+
SCRIPT_RESULT=$(.github/scripts/generate-wc-matrix.sh)
49+
L1_VERSION=$(echo "$SCRIPT_RESULT" | jq -r '.metadata.l1_version')
50+
51+
echo "L-1 version: $L1_VERSION" >&2
52+
53+
# Build PR matrix: L-1 + latest, PHP 8.3 only, all projects
54+
MATRIX_ENTRIES=()
55+
for wc_version in "$L1_VERSION" "latest"; do
56+
for project in "shopper" "merchant" "subscriptions"; do
57+
MATRIX_ENTRIES+=("{\"woocommerce\":\"$wc_version\",\"wordpress\":\"latest\",\"php\":\"8.3\",\"project\":\"$project\"}")
58+
done
59+
done
60+
61+
MATRIX_JSON=$(printf '%s\n' "${MATRIX_ENTRIES[@]}" | jq -s '{"include": .}' -c)
62+
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
63+
64+
qit-e2e:
65+
name: "${{ matrix.project }} | WC ${{ matrix.woocommerce }} | PHP ${{ matrix.php }}"
66+
needs: [build, generate-matrix]
67+
strategy:
68+
fail-fast: false
69+
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
70+
uses: ./.github/workflows/qit-e2e-run.yml
71+
with:
72+
woocommerce-version: ${{ matrix.woocommerce }}
73+
wordpress-version: ${{ matrix.wordpress }}
74+
php-version: ${{ matrix.php }}
75+
artifact-name: woocommerce-payments-${{ github.run_id }}
76+
playwright-project: ${{ matrix.project }}
77+
secrets:
78+
QIT_CI_USER: ${{ secrets.QIT_CI_USER }}
79+
QIT_CI_SECRET: ${{ secrets.QIT_CI_SECRET }}
80+
E2E_QIT_JP_SITE_ID: ${{ secrets.E2E_QIT_JP_SITE_ID }}
81+
E2E_QIT_JP_BLOG_TOKEN: ${{ secrets.E2E_QIT_JP_BLOG_TOKEN }}
82+
E2E_QIT_JP_USER_TOKEN: ${{ secrets.E2E_QIT_JP_USER_TOKEN }}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: QIT E2E Tests - Pre-release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
woocommerce-version:
7+
description: 'WooCommerce version (e.g., 10.5.0-dev, 9.7.0-beta.1, 9.7.0-rc.1)'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
build:
13+
name: Build plugin
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up repository
20+
uses: ./.github/actions/setup-repo
21+
22+
- name: Build the plugin
23+
uses: ./.github/actions/build
24+
25+
- name: Upload plugin artifact
26+
uses: actions/upload-artifact@v4
27+
with:
28+
name: woocommerce-payments-${{ github.run_id }}
29+
path: woocommerce-payments.zip
30+
retention-days: 1
31+
32+
generate-matrix:
33+
name: Generate test matrix
34+
runs-on: ubuntu-latest
35+
outputs:
36+
matrix: ${{ steps.generate.outputs.matrix }}
37+
steps:
38+
- name: Generate matrix
39+
id: generate
40+
run: |
41+
WC_VERSION="${{ inputs.woocommerce-version }}"
42+
echo "WC version: $WC_VERSION" >&2
43+
44+
# Build pre-release matrix: user-specified WC version, PHP 8.3, all projects
45+
MATRIX_ENTRIES=()
46+
for project in "shopper" "merchant" "subscriptions"; do
47+
MATRIX_ENTRIES+=("{\"woocommerce\":\"$WC_VERSION\",\"wordpress\":\"latest\",\"php\":\"8.3\",\"project\":\"$project\"}")
48+
done
49+
50+
MATRIX_JSON=$(printf '%s\n' "${MATRIX_ENTRIES[@]}" | jq -s '{"include": .}' -c)
51+
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
52+
53+
qit-e2e:
54+
name: "${{ matrix.project }} | WC ${{ matrix.woocommerce }} | PHP ${{ matrix.php }}"
55+
needs: [build, generate-matrix]
56+
strategy:
57+
fail-fast: false
58+
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
59+
uses: ./.github/workflows/qit-e2e-run.yml
60+
with:
61+
woocommerce-version: ${{ matrix.woocommerce }}
62+
wordpress-version: ${{ matrix.wordpress }}
63+
php-version: ${{ matrix.php }}
64+
artifact-name: woocommerce-payments-${{ github.run_id }}
65+
playwright-project: ${{ matrix.project }}
66+
secrets:
67+
QIT_CI_USER: ${{ secrets.QIT_CI_USER }}
68+
QIT_CI_SECRET: ${{ secrets.QIT_CI_SECRET }}
69+
E2E_QIT_JP_SITE_ID: ${{ secrets.E2E_QIT_JP_SITE_ID }}
70+
E2E_QIT_JP_BLOG_TOKEN: ${{ secrets.E2E_QIT_JP_BLOG_TOKEN }}
71+
E2E_QIT_JP_USER_TOKEN: ${{ secrets.E2E_QIT_JP_USER_TOKEN }}

.github/workflows/qit-e2e-run.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: QIT E2E Tests - Run
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
woocommerce-version:
7+
description: 'WooCommerce version (nightly, or specific version like 9.6.0, 10.5.0-dev)'
8+
required: true
9+
type: string
10+
wordpress-version:
11+
description: 'WordPress version (latest, nightly, or specific version)'
12+
required: false
13+
type: string
14+
default: 'latest'
15+
php-version:
16+
description: 'PHP version'
17+
required: true
18+
type: string
19+
artifact-name:
20+
description: 'Name of the artifact containing the built plugin zip'
21+
required: true
22+
type: string
23+
playwright-project:
24+
description: 'Playwright project to run (shopper, merchant, subscriptions)'
25+
required: true
26+
type: string
27+
secrets:
28+
QIT_CI_USER:
29+
required: true
30+
QIT_CI_SECRET:
31+
required: true
32+
E2E_QIT_JP_SITE_ID:
33+
required: true
34+
E2E_QIT_JP_BLOG_TOKEN:
35+
required: true
36+
E2E_QIT_JP_USER_TOKEN:
37+
required: true
38+
39+
jobs:
40+
qit-e2e:
41+
name: "Run tests"
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Checkout repository
45+
uses: actions/checkout@v4
46+
47+
- name: Download plugin artifact
48+
uses: actions/download-artifact@v4
49+
with:
50+
name: ${{ inputs.artifact-name }}
51+
52+
- name: Setup PHP
53+
uses: shivammathur/setup-php@v2
54+
with:
55+
php-version: ${{ inputs.php-version }}
56+
tools: composer
57+
coverage: none
58+
59+
- name: Install QIT CLI
60+
# Use dev-trunk because test packages feature is not yet in stable releases
61+
run: composer global require woocommerce/qit-cli:dev-trunk
62+
63+
- name: Authenticate QIT
64+
run: qit partner:add --user='${{ secrets.QIT_CI_USER }}' --application_password='${{ secrets.QIT_CI_SECRET }}'
65+
66+
- name: Run QIT E2E Tests
67+
env:
68+
E2E_JP_SITE_ID: ${{ secrets.E2E_QIT_JP_SITE_ID }}
69+
E2E_JP_BLOG_TOKEN: ${{ secrets.E2E_QIT_JP_BLOG_TOKEN }}
70+
E2E_JP_USER_TOKEN: ${{ secrets.E2E_QIT_JP_USER_TOKEN }}
71+
run: |
72+
qit run:e2e woocommerce-payments \
73+
--config tests/qit/qit.json \
74+
--woo=${{ inputs.woocommerce-version }} \
75+
--wp=${{ inputs.wordpress-version }} \
76+
--php=${{ inputs.php-version }} \
77+
--env E2E_JP_SITE_ID=$E2E_JP_SITE_ID \
78+
--env E2E_JP_BLOG_TOKEN=$E2E_JP_BLOG_TOKEN \
79+
--env E2E_JP_USER_TOKEN=$E2E_JP_USER_TOKEN \
80+
--verbose \
81+
--wait \
82+
-- --project=${{ inputs.playwright-project }}
83+
84+
- name: Upload test results
85+
if: always()
86+
uses: actions/upload-artifact@v4
87+
with:
88+
name: qit-e2e-results-wp${{ inputs.wordpress-version }}-wc${{ inputs.woocommerce-version }}-php${{ inputs.php-version }}-${{ inputs.playwright-project }}
89+
path: |
90+
tests/qit/test-package/test-results/
91+
qit-results/
92+
retention-days: 7

0 commit comments

Comments
 (0)