Skip to content

Commit 122368d

Browse files
committed
Reapply "Merge remote-tracking branch 'origin/release/9.4.0' into trunk"
This reverts commit 27f2949 as a precursor to merging release/9.5.0 back into trunk, as that branch was based on release/9.4.0 (or at least has a common root from develop).
1 parent 0371046 commit 122368d

File tree

201 files changed

+8474
-1942
lines changed

Some content is hidden

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

201 files changed

+8474
-1942
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Did I add a title? A descriptive, yet concise, title.
66
Issue: Link to the GitHub issue this PR addresses (if appropriate).
77
-->
88

9-
Fixes #
9+
Fixes STRIPE-<issue_id>
1010

1111
## Changes proposed in this Pull Request:
1212

.github/actions/setup-env/action.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Setup PHP and Node
2+
description: Composite Action with steps to setup PHP and Node
3+
4+
inputs:
5+
php-version:
6+
type: string
7+
default: '7.4'
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
13+
# PHP
14+
- name: Setup PHP
15+
uses: shivammathur/setup-php@v2
16+
with:
17+
php-version: ${{ inputs.php-version }}
18+
tools: composer
19+
coverage: none
20+
21+
- name: Cache Composer dependencies
22+
id: composer-cache
23+
uses: actions/cache@v4
24+
with:
25+
path: ./vendor
26+
key: ${{ runner.os }}-vendor-${{ hashFiles('composer.lock') }}
27+
28+
- name: Install Composer dependencies
29+
if: ${{ steps.composer-cache.outputs.cache-hit == false }}
30+
shell: bash
31+
run: composer install --no-progress
32+
33+
# Node
34+
- name: Setup Node
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version-file: '.nvmrc'
38+
cache: 'npm'
39+
40+
- name: Cache Node dependencies
41+
id: node-cache
42+
uses: actions/cache@v4
43+
with:
44+
path: |
45+
./node_modules
46+
~/.cache/ms-playwright
47+
key: ${{ runner.os }}-node_modules-${{ hashFiles('package-lock.json') }}
48+
49+
- name: Install Node dependencies
50+
if: ${{ steps.node-cache.outputs.cache-hit == false }}
51+
shell: bash
52+
run: npm ci --no-optional --ignore-scripts
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build and Upload Package
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
artifact:
7+
type: string
8+
default: 'woocommerce-gateway-stripe'
9+
php-version:
10+
type: string
11+
default: '7.4'
12+
13+
jobs:
14+
build_project:
15+
name: Build and upload
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Setup PHP and Node
23+
uses: ./.github/actions/setup-env
24+
with:
25+
php-version: ${{ inputs.php-version }}
26+
27+
- name: Build
28+
run: npm run build
29+
30+
- name: Upload package
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: ${{ inputs.artifact }}
34+
path: ${{ github.workspace }}/woocommerce-gateway-stripe.zip

.github/workflows/ci-cron-qit.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Scheduled Weekly QIT
2+
description: Builds a package and runs the QIT tests.
3+
4+
on:
5+
schedule:
6+
- cron: '0 0 * * 1' # At 00:00 on Monday
7+
8+
jobs:
9+
10+
build-project:
11+
name: Build package
12+
uses: ./.github/workflows/build-upload-zip.yml
13+
with:
14+
artifact: 'weekly-test-package'
15+
16+
qit-tests:
17+
name: Run QIT
18+
needs: build-project
19+
uses: ./.github/workflows/run-qit.yml
20+
secrets: inherit
21+
with:
22+
extension: 'woocommerce-gateway-stripe'
23+
artifact: 'weekly-test-package'
24+
wp-version: 'nightly'
25+
wc-version: 'nightly'
26+
test-activation: true
27+
test-security: true
28+
test-phpcompatibility: true
29+
test-validation: true
30+
test-phpstan: false # TODO: Enable this once the PHPStan tests are fixed
31+
test-woo-api: true
32+
test-woo-e2e: true
33+
test-malware: true
34+
35+
handle-error:
36+
if: ${{ failure() }}
37+
needs: qit-tests
38+
name: Handle failure
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: slackapi/slack-github-action@v2.0.0
42+
with:
43+
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
44+
webhook-type: webhook-trigger
45+
payload: |
46+
icon: ":workflow-failed:"
47+
status: "failed"
48+
workflowName: "${{ github.workflow }}"
49+
workflowUrl: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"

.github/workflows/ci-manual.yml

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
name: Manual QIT
2+
description: Builds a package for the specified branch and runs the selected QIT tests.
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
wp-version:
8+
description: 'WordPress version: `latest` or a specific version number.'
9+
type: string
10+
default: 'latest'
11+
wc-version:
12+
description: 'WooCommerce version: `latest`, `nightly` or a specific version number.'
13+
type: string
14+
default: 'latest'
15+
php-version:
16+
description: 'PHP version'
17+
type: choice
18+
default: '7.4'
19+
options:
20+
- '7.4'
21+
- '8.0'
22+
- '8.1'
23+
- '8.3'
24+
- '8.4'
25+
qit-tests:
26+
description: 'QIT Tests'
27+
type: choice
28+
options:
29+
- 'WooCommerce Pre-Release Tests (includes Activation, WooCommerce E2E and API tests)'
30+
- 'Code Quality Checks (includes Security, PHP Compatibility, PHPStan, Malware, and Validation tests)'
31+
- 'Activation'
32+
- 'Security'
33+
- 'PHP Compatibility'
34+
- 'PHPStan'
35+
- 'Malware'
36+
- 'Plugin Checks (dotOrg metadata)'
37+
- 'Validation'
38+
- 'WooCommerce E2E and API tests'
39+
- 'None'
40+
extension-tests:
41+
description: 'Extension Tests'
42+
type: choice
43+
default: 'All'
44+
options:
45+
- 'All'
46+
- 'Unit Tests'
47+
- 'E2E Tests'
48+
- 'None'
49+
qit-wait:
50+
description: 'Wait for QIT? Requires additional time for the QIT tests to complete within GHA.'
51+
type: boolean
52+
default: true
53+
options:
54+
description: 'QIT additional options, like `--optional_features=hpos`.'
55+
type: string
56+
default: ''
57+
58+
run-name: Tests with WP=${{ inputs.wp-version }} - WC=${{ inputs.wc-version }} - PHP=${{ inputs.php-version }} - Tests=${{ inputs.extension-tests }} - QIT=${{ inputs.qit-tests }}
59+
60+
jobs:
61+
62+
php-tests:
63+
if: contains(inputs.extension-tests, 'All') || contains(inputs.extension-tests, 'Unit')
64+
name: Run PHP Unit
65+
uses: ./.github/workflows/run-unit-tests.yml
66+
with:
67+
wp-version: ${{ inputs.wp-version }}
68+
wc-version: ${{ inputs.wc-version }}
69+
php-version: ${{ inputs.php-version }}
70+
71+
e2e-tests:
72+
if: contains(inputs.extension-tests, 'All') || contains(inputs.extension-tests, 'E2E')
73+
name: Run E2E
74+
uses: ./.github/workflows/run-e2e-tests.yml
75+
secrets: inherit
76+
with:
77+
wp-version: ${{ inputs.wp-version }}
78+
wc-version: ${{ inputs.wc-version }}
79+
php-version: ${{ inputs.php-version }}
80+
81+
build-project:
82+
name: Build package
83+
uses: ./.github/workflows/build-upload-zip.yml
84+
with:
85+
artifact: 'manual-test-package'
86+
php-version: ${{ inputs.php-version }}
87+
88+
qit-tests:
89+
name: Run QIT
90+
needs: build-project
91+
uses: ./.github/workflows/run-qit.yml
92+
secrets: inherit
93+
with:
94+
extension: 'woocommerce-gateway-stripe'
95+
artifact: 'manual-test-package'
96+
wp-version: ${{ inputs.wp-version == 'latest' && 'stable' || inputs.wp-version }}
97+
wc-version: ${{ inputs.wc-version == 'latest' && 'stable' || contains( inputs.wc-version, 'rc' ) && 'rc' || inputs.wc-version }}
98+
php-version: ${{ inputs.php-version }}
99+
test-activation: ${{ contains(inputs.qit-tests, 'Activation') && true || false }}
100+
test-security: ${{ contains(inputs.qit-tests, 'Security') && true || false }}
101+
test-phpcompatibility: ${{ contains(inputs.qit-tests, 'Compatibility') && true || false }}
102+
test-phpstan: ${{ contains(inputs.qit-tests, 'PHPStan') && true || false }}
103+
test-malware: ${{ contains(inputs.qit-tests, 'Malware') && true || false }}
104+
test-plugin-check: ${{ contains(inputs.qit-tests, 'dotOrg') && true || false }}
105+
test-validation: ${{ contains(inputs.qit-tests, 'Validation') && true || false }}
106+
test-woo-api: ${{ contains(inputs.qit-tests, 'API') && true || false }}
107+
test-woo-e2e: ${{ contains(inputs.qit-tests, 'WooCommerce E2E') && true || false }}
108+
options: ${{ inputs.options }}
109+
wait: ${{ inputs.qit-wait }}
110+
111+
handle-success:
112+
if: |
113+
always() &&
114+
(needs.php-tests.result == 'success' || needs.php-tests.result == 'skipped') &&
115+
(needs.e2e-tests.result == 'success' || needs.e2e-tests.result == 'skipped') &&
116+
(needs.qit-tests.result == 'success' || needs.qit-tests.result == 'skipped')
117+
needs: [php-tests, e2e-tests, qit-tests]
118+
name: Handle success
119+
runs-on: ubuntu-latest
120+
steps:
121+
- uses: slackapi/slack-github-action@v2.0.0
122+
with:
123+
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
124+
webhook-type: webhook-trigger
125+
payload: |
126+
icon: ":workflow-passed:"
127+
status: "passed"
128+
workflowName: "${{ github.workflow }} | ${{ github.head_ref || github.ref_name}}"
129+
workflowUrl: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
130+
131+
handle-cancelled:
132+
if: cancelled()
133+
needs: [php-tests, e2e-tests, qit-tests]
134+
name: Handle cancellation
135+
runs-on: ubuntu-latest
136+
steps:
137+
- uses: slackapi/slack-github-action@v2.0.0
138+
with:
139+
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
140+
webhook-type: webhook-trigger
141+
payload: |
142+
icon: ":workflow-cancelled:"
143+
status: "cancelled"
144+
workflowName: "${{ github.workflow }} | ${{ github.head_ref || github.ref_name}}"
145+
workflowUrl: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
146+
147+
handle-error:
148+
if: failure()
149+
needs: [php-tests, e2e-tests, qit-tests]
150+
name: Handle failure
151+
runs-on: ubuntu-latest
152+
steps:
153+
- uses: slackapi/slack-github-action@v2.0.0
154+
with:
155+
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
156+
webhook-type: webhook-trigger
157+
payload: |
158+
icon: ":workflow-failed:"
159+
status: "failed"
160+
workflowName: "${{ github.workflow }} | ${{ github.head_ref || github.ref_name }}"
161+
workflowUrl: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"

.github/workflows/ci-merge.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Post PR Merge QIT
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
types:
8+
- closed
9+
10+
concurrency:
11+
group: ${{ github.workflow }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
build-project:
16+
if: github.event.pull_request.merged == true
17+
name: Build package
18+
uses: ./.github/workflows/build-upload-zip.yml
19+
with:
20+
artifact: 'pr-merge-test-package'
21+
22+
qit-tests:
23+
if: github.event.pull_request.merged == true
24+
name: Run QIT tests
25+
needs: build-project
26+
uses: ./.github/workflows/run-qit.yml
27+
secrets: inherit
28+
with:
29+
extension: 'woocommerce-gateway-stripe'
30+
artifact: 'pr-merge-test-package'
31+
test-activation: true
32+
test-security: true
33+
test-phpcompatibility: true
34+
test-validation: true
35+
test-phpstan: false # TODO: Enable this once the PHPStan tests are fixed
36+
37+
handle-cancelled:
38+
if: ${{ cancelled() }}
39+
needs: qit-tests
40+
name: Handle cancellation
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: slackapi/slack-github-action@v2.0.0
44+
with:
45+
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
46+
webhook-type: webhook-trigger
47+
payload: |
48+
icon: ":workflow-cancelled:"
49+
status: "cancelled"
50+
workflowName: "${{ github.workflow }} | ${{ github.head_ref }}"
51+
workflowUrl: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
52+
53+
handle-error:
54+
if: ${{ failure() }}
55+
needs: qit-tests
56+
name: Handle failure
57+
runs-on: ubuntu-latest
58+
steps:
59+
- uses: slackapi/slack-github-action@v2.0.0
60+
with:
61+
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
62+
webhook-type: webhook-trigger
63+
payload: |
64+
icon: ":workflow-failed:"
65+
status: "failed"
66+
workflowName: "${{ github.workflow }} | ${{ github.head_ref }}"
67+
workflowUrl: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"

0 commit comments

Comments
 (0)