Skip to content

Commit

Permalink
Merge pull request #2067 from woocommerce/release/2.5.3
Browse files Browse the repository at this point in the history
Release 2.5.3
  • Loading branch information
eason9487 authored Aug 22, 2023
2 parents 0c095a6 + 13f5eee commit 9ecc3eb
Show file tree
Hide file tree
Showing 113 changed files with 3,785 additions and 8,201 deletions.
17 changes: 8 additions & 9 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,13 @@ module.exports = {
additionalHooks: 'useSelect',
},
],
// When a file imports from both `@wordpress/components` and `extracted/@wordpress/components`
// at the same time, it would get the "no-duplicates" warning. It should be considered a
// false positive when working on the externalization process. So here we temporarily change
// to use "no-duplicate-imports" instead.
//
// TODO: After the externalizations of `@wordpress/*` and `@woocommerce/*` are complete,
// remove the following two lines of rule settings.
'import/no-duplicates': 'off',
'no-duplicate-imports': 'warn',
},
overrides: [
{
files: [ 'tests/e2e/**/*.js' ],
rules: {
'jest/no-done-callback': [ 'off' ],
},
},
],
};
2 changes: 1 addition & 1 deletion .externalized.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["@woocommerce/components","@woocommerce/customer-effort-score","@woocommerce/data","@woocommerce/navigation","@woocommerce/settings","@wordpress/a11y","@wordpress/api-fetch","@wordpress/data","@wordpress/data-controls","@wordpress/date","@wordpress/deprecated","@wordpress/dom","@wordpress/element","@wordpress/escape-html","@wordpress/hooks","@wordpress/html-entities","@wordpress/i18n","@wordpress/is-shallow-equal","@wordpress/keycodes","@wordpress/priority-queue","@wordpress/rich-text","@wordpress/url","@wordpress/warning","extracted/@wordpress/components","lodash","moment","react","react-dom"]
["@woocommerce/components","@woocommerce/customer-effort-score","@woocommerce/data","@woocommerce/navigation","@woocommerce/settings","@wordpress/api-fetch","@wordpress/components","@wordpress/compose","@wordpress/data","@wordpress/data-controls","@wordpress/date","@wordpress/deprecated","@wordpress/dom","@wordpress/element","@wordpress/hooks","@wordpress/html-entities","@wordpress/i18n","@wordpress/primitives","@wordpress/url","lodash","moment","react","react-dom"]
40 changes: 25 additions & 15 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on:
branches:
- "release/**"
workflow_dispatch:
inputs:
wp-rc-version:
description: 'WordPress version for Release Candidate (ex. 6.3-RC3)'
wc-rc-version:
description: 'WooCommerce version for Release Candidate (ex. 8.0.0-rc.1)'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -20,11 +25,6 @@ jobs:
env:
FORCE_COLOR: 2
steps:
# Needed for Ubuntu 20.04.
- name: Kill mono to free 8084
run: |
sudo killall mono
- name: Checkout repository
uses: actions/checkout@v3

Expand All @@ -45,22 +45,32 @@ jobs:
npm run build
echo "::endgroup::"
- name: Start docker container
- name: Start wp-env container
run: npm run wp-env:up

- name: Install WP release candidate (optional)
if: github.event.inputs.wp-rc-version != ''
run: |
npm run docker:up
sleep 10
npm run -- wp-env run tests-cli -- wp core update --version=${{ github.event.inputs.wp-rc-version }}
npm run -- wp-env run tests-cli -- wp core update-db
- name: Run tests
env:
WC_E2E_SCREENSHOTS: 1
- name: Install WC release candidate (optional)
if: github.event.inputs.wc-rc-version != ''
run: |
npm run test:e2e
npm run -- wp-env run tests-cli -- wp plugin update woocommerce --version=${{ github.event.inputs.wc-rc-version }}
npm run -- wp-env run tests-cli -- wp wc update
- name: Download and install Chromium browser.
run: npx playwright install chromium

- name: Run tests
run: npm run test:e2e

- name: Archive e2e test screenshots
- name: Archive e2e failure screenshots
if: ${{ always() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: e2e-screenshots
path: tests/e2e/screenshots
path: tests/e2e/test-results/report/**/*.png
if-no-files-found: ignore
retention-days: 5
58 changes: 58 additions & 0 deletions .github/workflows/php-hook-documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: PHP Hook Documentation Generator

on:
push:
branches:
- "release/**"
paths:
- "**.php"
- .github/workflows/php-hook-documentation.yml
pull_request:
types:
- opened
branches:
- "release/**"
paths:
- "**.php"
- .github/workflows/php-hook-documentation.yml
workflow_dispatch:

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

jobs:
HookDocumentation:
name: Hook Documentation Generator
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
with:
# Checks out a branch instead of a commit in detached HEAD state
ref: ${{ github.head_ref }}

# This generates the documentation string. The `id` property is used to reference the output in the next step.
- name: Generate hook documentation
id: generate-hook-docs
uses: woocommerce/grow/hook-documentation@actions-v1
with:
debug-output: yes
source-directories: src/,views/,google-listings-and-ads.php,uninstall.php

- name: Commit hook documentation
shell: bash
# Use the github-actions bot account to commit.
# https://api.github.com/users/github-actions%5Bbot%5D
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
echo "${{ steps.generate-hook-docs.outputs.hook-docs }}" > src/Hooks/README.md
git add src/Hooks/README.md
if git diff --cached --quiet; then
echo "*No documentation changes to commit.*" >> $GITHUB_STEP_SUMMARY
else
echo "*Committing documentation changes.*" >> $GITHUB_STEP_SUMMARY
git commit -q -m "Update hooks documentation from ${{ github.head_ref }} branch."
git push
fi
32 changes: 21 additions & 11 deletions .github/workflows/php-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,46 @@ concurrency:

jobs:
GetMatrix:
name: Get WP version Matrix
name: Get WP and WC version Matrix
runs-on: ubuntu-latest
outputs:
wp-versions: ${{ steps.wp.outputs.versions }}
latest-wp-version: ${{ fromJson(steps.wp.outputs.versions)[0] }}
wc-versions: ${{ steps.wc.outputs.versions }}
latest-wc-version: ${{ fromJson(steps.wc.outputs.versions)[0] }}
steps:
- name: Get Release versions from Wordpress
id: wp
uses: woocommerce/grow/get-plugin-releases@actions-v1
with:
slug: wordpress
- name: Get Release versions from WooCommerce
id: wc
uses: woocommerce/grow/get-plugin-releases@actions-v1
with:
slug: woocommerce

UnitTests:
name: PHP unit tests - PHP ${{ matrix.php }}, WP ${{ matrix.wp-version }}
name: PHP unit tests - PHP ${{ matrix.php }}, WP ${{ matrix.wp-version || 'latest' }}, WC ${{ matrix.wc-versions || 'latest' }}
needs: GetMatrix
runs-on: ubuntu-latest
env:
WP_CORE_DIR: "/tmp/wordpress/src"
WP_TESTS_DIR: "/tmp/wordpress/tests/phpunit"
strategy:
matrix:
php: [8.0]
wp-version: ${{ fromJson(needs.GetMatrix.outputs.wp-versions) }}
php: [ 8.0 ]
wp-version: [ latest ]
wc-versions: ${{ fromJson(needs.GetMatrix.outputs.wc-versions) }}
include:
- php: 8.2
wp-version: latest
wc-versions: latest
- php: 7.4
wp-version: ${{ needs.GetMatrix.outputs.latest-wp-version }}
wp-version: ${{ fromJson(needs.GetMatrix.outputs.wp-versions)[2] }} # L-2 WP Version support
wc-versions: ${{ fromJson(needs.GetMatrix.outputs.wc-versions)[2] }} # L-2 WC Version support
- php: 8.1
wp-version: ${{ needs.GetMatrix.outputs.latest-wp-version }}
- php: 8.2
wp-version: ${{ needs.GetMatrix.outputs.latest-wp-version }}
wp-version: latest
wc-versions: latest

steps:
- name: Checkout repository
Expand All @@ -67,9 +77,9 @@ jobs:
uses: woocommerce/grow/prepare-mysql@actions-v1

- name: Install WP tests
run: ./bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wp-version }}
run: ./bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wp-version }} ${{ matrix.wc-versions }}

- if: matrix.wp-version == needs.GetMatrix.outputs.latest-wp-version && matrix.php == 8.0
- if: matrix.wc-versions == needs.GetMatrix.outputs.latest-wc-version && matrix.php == 8.0
name: Set condition to generate coverage report (only on latest versions)
run: echo "generate_coverage=true" >> $GITHUB_ENV

Expand Down
19 changes: 0 additions & 19 deletions .github/workflows/post-release-automerge.yml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/post-release-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'Merge the release to develop'
run-name: Make a PR to merge the released `${{ github.head_ref }}` from `trunk` to `develop`

# **What it does**: Creates a PR to merge `trunk` to `develop` after `prepare-extension-release`-based release is merged to `trunk`.
# **Why we have it**: To automate the release process and follow the git-flow.

on:
pull_request:
types:
- closed
branches:
- trunk

jobs:
MergeTrunkDevelopPR:
runs-on: ubuntu-latest
steps:
- uses: woocommerce/grow/merge-trunk-develop-pr@actions-v1
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ languages/*
coverage
tests/php-coverage
.phpunit.result.cache
tests/e2e/test-results.json
tests/e2e/test-results

# Directories/files that may appear in your environment
.DS_Store
Expand Down
5 changes: 4 additions & 1 deletion .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"phpVersion": "8.0",
"plugins": [
"https://downloads.wordpress.org/plugin/woocommerce.latest-stable.zip",
"https://github.com/WP-API/Basic-Auth/archive/master.zip",
"."
],
"mappings": {
"wp-cli.yml": "./tests/e2e/config/wp-cli.yml",
"wp-content/plugins/test-data.php": "./tests/e2e/bin/test-data.php"
},
"lifecycleScripts": {
"afterStart": "./tests/e2e/bin/test-env-setup.sh",
"afterClean": "./tests/e2e/bin/test-env-setup.sh"
Expand Down
31 changes: 26 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,14 @@ The tests will execute and you'll be presented with a summary.

## E2E Testing

E2E testing uses [@woocommerce/e2e-environment](https://www.npmjs.com/package/@woocommerce/e2e-environment) which requires [Docker](https://www.docker.com/).
E2E testing uses [wp-env](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/) which requires [Docker](https://www.docker.com/).

Make sure Docker is running in your machine, and run the following:

`npm run docker:up` - This will automatically download and run WordPress in a Docker container. You can access it at http://localhost:8084 (Username: admin, Password: password).
`npm run wp-env:up` - This will automatically download and run WordPress in a Docker container. You can access it at http://localhost:8889 (Username: admin, Password: password).

To install the PlayWright browser locally you can run:
`npx playwright install chromium`

Run E2E testing:

Expand All @@ -148,13 +151,31 @@ Run E2E testing:

To remove the Docker container and images (this will **delete everything** in the WordPress Docker container):

`npm run docker:down`
`npm run wp-env destroy`

:warning: Currently, the E2E testing on GitHub Actions is only run automatically after opening a PR with `release/*` branches or pushing changes to `release/*` branches. To run it manually, please visit [here](../../actions/workflows/e2e-tests.yml) and follow [this instruction](https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow?tool=webui) to do so.

### Linux Troubleshooting
### Test other WordPress versions
By default the latest version of WordPress will be installed. `WP_ENV_CORE` can be used to install a specific version.

```
WP_ENV_CORE=WordPress/WordPress#6.2.2 npm run wp-env:up
```

This does not work with Release Candidate versions as the tag is not available. Instead we can bring the `wp-env:up` with the latest version and then upgrade WordPress through WP CLI.

If you encounter problems starting your `test:e2e`, like `No usable sandbox!` or `UnhandledPromiseRejectionWarning: Error: Page crashed!`, you may try disabling the Chromium sandbox by adding `--no-sandbox` to `launch.args` in [`/tests/e2e/config/jest-puppeteer.config.js#L7`](https://github.com/woocommerce/google-listings-and-ads/blob/develop/tests/e2e/config/jest-puppeteer.config.js#L7).
```
npm run -- wp-env run tests-cli -- wp core update --version=6.3-RC3
npm run -- wp-env run tests-cli -- wp core update-db
```

### Test other WooCommerce versions
WooCommerce is installed through WP CLI so we can use this to update to a newer version like a release candidate.

```
npm run -- wp-env run tests-cli -- wp plugin update woocommerce --version=8.0.0-rc.1
npm run -- wp-env run tests-cli -- wp wc update
```

## Docs

Expand Down
2 changes: 1 addition & 1 deletion bin/GoogleAdsCleanupServices.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class GoogleAdsCleanupServices {
*
* @var string
*/
protected $version = 'V13';
protected $version = 'V14';

/**
* @var Event Composer event.
Expand Down
Loading

0 comments on commit 9ecc3eb

Please sign in to comment.