Skip to content

Commit 6f52b64

Browse files
committed
Merge remote-tracking branch 'origin/release/9.3.0' into trunk
2 parents 38b506c + 37be477 commit 6f52b64

File tree

155 files changed

+6598
-1190
lines changed

Some content is hidden

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

155 files changed

+6598
-1190
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ module.exports = {
7373
// This helps the `import/no-extraneous-dependencies` and
7474
//`import/no-unresolved` rules account for them.
7575
'import/core-modules': [
76+
'@woocommerce/blocks-checkout',
7677
'@woocommerce/blocks-registry',
7778
'@woocommerce/settings',
7879
'@wordpress/i18n',

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,22 @@ Please follow the following guidelines when writing testing instructions:
4242
---
4343

4444
- [ ] Covered with tests (or have a good reason not to test in description ☝️)
45-
- [ ] Added changelog entry **in both** `changelog.txt` and `readme.txt` (or does not apply)
4645
- [ ] Tested on mobile (or does not apply)
4746

47+
### Changelog entry
48+
49+
<!-- If no changelog entry is required for this PR, you can specify that below and provide a comment explaining why. This cannot be used if you selected the option to automatically create a changelog entry above. -->
50+
51+
- [ ] This Pull Request does not require a changelog entry. (Comment required below)
52+
53+
<details>
54+
55+
<summary>Changelog Entry Comment</summary>
56+
57+
#### Comment <!-- If your Pull Request doesn't require a changelog entry, a comment explaining why is required instead -->
58+
59+
</details>
60+
4861
**Post merge**
4962

5063
- [ ] Added testing instructions to the [Release Testing Instructions wiki page](https://github.com/woocommerce/woocommerce-gateway-stripe/wiki/Release-Testing-Instructions) (or does not apply)
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: PHP code coverage
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
8+
permissions:
9+
pull-requests: write
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-22.04
14+
name: PHP=8.1, WP=6.7, WC=9.5.2
15+
env:
16+
PHP_VERSION: '8.1'
17+
WP_VERSION: '6.7'
18+
WC_VERSION: '9.5.2'
19+
steps:
20+
- name: Get Changed Files
21+
id: get-changed-files
22+
uses: hanseltimeindustries/get-changed-files@v1
23+
with:
24+
format: 'space-delimited'
25+
filter: '**/*.php'
26+
27+
- name: Checking out
28+
uses: actions/checkout@v2
29+
30+
- name: Set up dependencies caching
31+
uses: actions/cache@v4
32+
with:
33+
path: ~/.cache/composer/
34+
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
35+
36+
- name: Set up PHP
37+
uses: shivammathur/setup-php@v2
38+
with:
39+
php-version: ${{ env.PHP_VERSION }}
40+
coverage: xdebug
41+
42+
- name: Set up PHPUnit 9.5
43+
run: wget https://phar.phpunit.de/phpunit-9.5.28.phar && mv phpunit-9.5.28.phar phpunit.phar
44+
45+
- name: Run CI checks
46+
run: bash bin/run-ci-tests.bash
47+
48+
- name: Code Coverage Report
49+
uses: irongut/[email protected]
50+
with:
51+
filename: php-coverage.xml
52+
format: markdown
53+
hide_branch_rate: false
54+
hide_complexity: true
55+
indicators: true
56+
output: both
57+
thresholds: '60 80'
58+
59+
- name: Filter Changed Files in Report
60+
run: |
61+
echo "### 📈 PHP Unit Code Coverage Report" > code-coverage-results-filtered.md
62+
echo "Package | Line Rate | Health" >> code-coverage-results-filtered.md
63+
echo "-------- | --------- | ------" >> code-coverage-results-filtered.md
64+
grep -E "$(echo ${{ steps.get-changed-files.outputs.all }} | tr ' ' '|')" code-coverage-results.md >> code-coverage-results-filtered.md
65+
tail -n1 code-coverage-results.md >> code-coverage-results-filtered.md
66+
67+
- name: Add Coverage PR Comment
68+
uses: marocchino/sticky-pull-request-comment@v2
69+
with:
70+
number: ${{ github.event.number }}
71+
header: code-coverage
72+
recreate: true
73+
path: code-coverage-results-filtered.md
74+

.github/workflows/php-tests.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,28 @@ jobs:
1616
include:
1717
# WooCommerce
1818
- woocommerce_support_policy: L
19-
woocommerce: '9.1.2'
19+
woocommerce: '9.5.2'
2020
- woocommerce_support_policy: L-1
21-
woocommerce: '9.0.2'
21+
woocommerce: '9.3.4'
2222
- woocommerce_support_policy: L-2
23-
woocommerce: '8.9.3'
23+
woocommerce: '9.2.3'
2424
# WordPress
2525
- wordpress_support_policy: L
26-
wordpress: '6.6'
26+
wordpress: '6.7'
2727
- wordpress_support_policy: L-1
28-
wordpress: '6.5'
28+
wordpress: '6.6'
2929
- wordpress_support_policy: L-2
30-
wordpress: '6.4'
30+
wordpress: '6.5'
3131
# PHP
3232
- php_support_policy: L
3333
php: '8.1'
3434
- php_support_policy: L-1
3535
php: '8.0'
3636
- php_support_policy: L-2
3737
php: '7.4'
38+
exclude: # incompatible versions of PHP, WordPress, and WooCommerce
39+
- woocommerce_support_policy: L
40+
wordpress_support_policy: L-2
3841

3942
name: Stable (PHP=${{ matrix.php_support_policy }}, WP=${{ matrix.wordpress_support_policy }}, WC=${{ matrix.woocommerce_support_policy }})
4043
env:
@@ -55,11 +58,12 @@ jobs:
5558
uses: shivammathur/setup-php@v2
5659
with:
5760
php-version: ${{ matrix.php }}
58-
coverage: none
61+
coverage: xdebug
5962

6063
- name: If PHP >= 8.0 set up PHPUnit 9.5 for compatibility
6164
if: ${{ matrix.php >= '8.0' }}
62-
run: wget https://phar.phpunit.de/phpunit-9.5.13.phar && mv phpunit-9.5.13.phar phpunit.phar
63-
65+
run: wget https://phar.phpunit.de/phpunit-9.5.28.phar && mv phpunit-9.5.28.phar phpunit.phar
66+
6467
- name: Run CI checks
6568
run: bash bin/run-ci-tests.bash
69+

.github/workflows/qit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ permissions:
3030
jobs:
3131
build:
3232
if: "${{ ( inputs.test != '' && inputs.test != 'none' ) || contains(github.event.pull_request.labels.*.name, 'needs: qit default tests') || contains(github.event.pull_request.labels.*.name, 'needs: qit activation test') || contains(github.event.pull_request.labels.*.name, 'needs: qit api test') || contains(github.event.pull_request.labels.*.name, 'needs: qit e2e test') || contains(github.event.pull_request.labels.*.name, 'needs: qit phpstan test') || contains(github.event.pull_request.labels.*.name, 'needs: qit phpcompat test') || contains(github.event.pull_request.labels.*.name, 'needs: qit security test') || contains(github.event.pull_request.labels.*.name, 'needs: qit malware test') }}"
33-
uses: woocommerce/woocommerce-gateway-stripe/.github/workflows/generate-zip.yml@fix-qit-security
33+
uses: ./.github/workflows/generate-zip.yml
3434

3535
test:
3636
if: "${{ ( inputs.test != '' && inputs.test != 'none' ) || contains(github.event.pull_request.labels.*.name, 'needs: qit default tests') || contains(github.event.pull_request.labels.*.name, 'needs: qit activation test') || contains(github.event.pull_request.labels.*.name, 'needs: qit api test') || contains(github.event.pull_request.labels.*.name, 'needs: qit e2e test') || contains(github.event.pull_request.labels.*.name, 'needs: qit phpstan test') || contains(github.event.pull_request.labels.*.name, 'needs: qit phpcompat test') || contains(github.event.pull_request.labels.*.name, 'needs: qit security test') || contains(github.event.pull_request.labels.*.name, 'needs: qit malware test') }}"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: 'Validate Changelog'
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, edited]
6+
branches:
7+
- trunk
8+
- develop
9+
10+
jobs:
11+
check_changelog:
12+
name: 'Check for changelog updates'
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Check PR description for changelog exemption
19+
id: check_exemption
20+
uses: actions/github-script@v7
21+
with:
22+
script: |
23+
const prBody = context.payload.pull_request.body || '';
24+
25+
const exemptionPattern = /- *\[x\] *This Pull Request does not require a changelog entry/i;
26+
const isExempt = exemptionPattern.test(prBody);
27+
28+
core.setOutput('is_exempt', isExempt.toString());
29+
30+
- name: Check for changelog updates
31+
if: steps.check_exemption.outputs.is_exempt != 'true'
32+
uses: actions/github-script@v7
33+
with:
34+
script: |
35+
const { data: files } = await github.rest.pulls.listFiles({
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
pull_number: context.issue.number
39+
});
40+
41+
const changelogUpdated = files.some(file => file.filename === 'changelog.txt');
42+
const readmeUpdated = files.some(file => file.filename === 'readme.txt');
43+
44+
if (!changelogUpdated || !readmeUpdated) {
45+
core.setFailed(
46+
'This PR requires changelog entries. Please run `npm run changelog` to add entries to both changelog.txt and readme.txt, ' +
47+
'or check "This Pull Request does not require a changelog entry" in the PR description if no changelog is needed.'
48+
);
49+
} else {
50+
console.log('Changelog entries found in both files ✅');
51+
}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,7 @@ docker/logs
4242
# PHPUnit cache files
4343
.phpunit.cache/
4444
.phpunit.result.cache
45+
46+
# PHPUnit coverage results files
47+
php-coverage.xml
48+
phpunit-html/

.husky/post-merge

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,27 @@ npx --no-install yarnhook
66

77
# make sure the autoload files are regenerated
88
composer dumpautoload
9+
10+
DEV_TOOLS_PLUGIN_PATH=${LOCAL_STRIPE_DEV_TOOLS_PLUGIN_REPO_PATH:-"docker/wordpress/wp-content/plugins/woocommerce-gateway-stripe-dev-tools"}
11+
if [ ! -d $DEV_TOOLS_PLUGIN_PATH ]; then
12+
echo
13+
echo "\033[33mCouldn't find the '$DEV_TOOLS_PLUGIN_PATH' directory. Skipping the auto-update for the Stripe Dev Tools plugin...\033[0m"
14+
else
15+
if [ "$(cd $DEV_TOOLS_PLUGIN_PATH && git rev-parse --show-toplevel 2>/dev/null)" = "$(cd $DEV_TOOLS_PLUGIN_PATH && pwd)" ]; then
16+
echo
17+
echo "\033[32mDetermining if there is an update for the Stripe Dev Tools plugin...\033[0m"
18+
19+
DEV_TOOLS_BRANCH=$(cd $DEV_TOOLS_PLUGIN_PATH && git branch --show-current)
20+
if [[ $DEV_TOOLS_BRANCH = "trunk" ]]; then
21+
echo " \033[32mThe current branch is $DEV_TOOLS_BRANCH. Check if we are safe to pull from origin/$DEV_TOOLS_BRANCH...\033[0m"
22+
if [[ `cd $DEV_TOOLS_PLUGIN_PATH && git status --porcelain` ]]; then
23+
echo "\033[33m There are uncommitted local changes on the Stripe Dev Tools repo. Skipping any attempt to update it.\033[0m"
24+
else
25+
echo " \033[32mPulling the latest changes from origin/$DEV_TOOLS_BRANCH, if any...\033[0m"
26+
cd $DEV_TOOLS_PLUGIN_PATH && git pull
27+
fi
28+
else
29+
echo "\033[33m The Stripe Dev Tools local clone is not on the trunk branch. Skipping any attempt to update it.\033[0m"
30+
fi
31+
fi
32+
fi

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# WooCommerce Stripe Payment Gateway
2+
3+
This is the official feature plugin for accepting payments via the Stripe payment gateway on a WooCommerce store.
4+
5+
## Dependencies
6+
7+
- WooCommerce
8+
9+
## Version Support Policy
10+
11+
We adopt the L-2 version support policy for WordPress core strictly, and a loose L-2 policy for WooCommerce. See [more details](./docs/version-support-policy.md).
12+
13+
## Development
14+
15+
### Install Dependencies & Build
16+
17+
- `npm install`
18+
- `composer install`
19+
- `npm run build:webpack`, or if you're developing the client you can have it auto-update when changes are made: `npm start`
20+
21+
If you run into errors with `npm install` it may be due to node version, try `nvm install` followed by `nvm use` then try again.
22+
23+
When running the `composer install/update`, Composer may prompt you for a GitHub OAuth token before it can fetch the `subscriptions` and `pre-orders` extensions from GitHub.
24+
25+
## Setup
26+
27+
If you're using the Docker environment see setup instructions here:
28+
https://github.com/woocommerce/woocommerce-gateway-stripe/blob/trunk/docs/DOCKER.md
29+
30+
Install the following plugins:
31+
32+
- WooCommerce
33+
- Stripe Dev Tools (clone or download [the GitHub repo](https://github.com/woocommerce/woocommerce-gateway-stripe-dev-tools))
34+
35+
## Debugging
36+
37+
If you are following the Docker setup [here](https://github.com/woocommerce/woocommerce-gateway-stripe/blob/trunk/docs/DOCKER.md), Xdebug is ready to use for debugging.
38+
39+
Install [Xdebug Helper browser extension mentioned here](https://xdebug.org/docs/remote) to enable Xdebug on demand.

assets/images/affirm.svg

Lines changed: 4 additions & 14 deletions
Loading

0 commit comments

Comments
 (0)