Skip to content

Commit

Permalink
Merge branch 'trunk' into as-update-to-php-81
Browse files Browse the repository at this point in the history
  • Loading branch information
asumaran committed Jan 16, 2024
2 parents 15e0d3c + 42a90a3 commit 01ffbb0
Show file tree
Hide file tree
Showing 4,847 changed files with 437,688 additions and 28,863 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .gitattributes
Expand Up @@ -13,3 +13,4 @@
*.tsx text eol=lf
*.css text eol=lf
*.scss text eol=lf
*.flf text eol=lf
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Expand Up @@ -35,7 +35,7 @@ Please take a moment to review the [project readme](https://github.com/woocommer

- Ensure you stick to the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/).
- Run our build process described in the document on [how to set up WooCommerce development environment](https://github.com/woocommerce/woocommerce/wiki/How-to-set-up-WooCommerce-development-environment), it will install our pre-commit hook, code sniffs, dependencies, and more.
- Before pushing commits to GitHub, check your code against our code standards. For PHP code in the WooCommerce Core project you can do this by running `pnpm --filter=woocommerce run lint:php:changes:branch`.
- Before pushing commits to GitHub, check your code against our code standards. For PHP code in the WooCommerce Core project you can do this by running `pnpm --filter=@woocommerce/plugin-woocommerce lint:php:changes:branch`.
- Whenever possible, please fix pre-existing code standards errors in code that you change.
- Please consider adding appropriate tests related to your change if applicable such as unit, API and E2E tests. You can check the following guides for this purpose:
- [Writing unit tests](https://github.com/woocommerce/woocommerce/blob/trunk/plugins/woocommerce/tests/README.md#guide-for-writing-unit-tests).
Expand All @@ -46,7 +46,7 @@ Please take a moment to review the [project readme](https://github.com/woocommer
- Ensure that your code supports the minimum supported versions of PHP and WordPress; this is shown at the top of the `readme.txt` file.
- Push the changes to your fork and submit a pull request on the trunk branch of the WooCommerce repository.
- Make sure to write good and detailed commit messages (see [this post](https://chris.beams.io/posts/git-commit/) for more on this) and follow all the applicable sections of the pull request template.
- Please create a change file for your changes by running `pnpm --filter=<project> changelog add`. For example, a change file for the WooCommerce Core project would be added by running `pnpm --filter=woocommerce changelog add`.
- Please create a change file for your changes by running `pnpm --filter=<project> changelog add`. For example, a change file for the WooCommerce Core project would be added by running `pnpm --filter=@woocommerce/plugin-woocommerce changelog add`.
- Please avoid modifying the changelog directly or updating the .pot files. These will be updated by the WooCommerce team.

If you are contributing code to our (Javascript-driven) Gutenberg blocks, please note that they are developed in their [own repository](https://github.com/woocommerce/woocommerce-gutenberg-products-block) and have their [own issue tracker](https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues).
Expand Down
3 changes: 0 additions & 3 deletions .github/ISSUE_TEMPLATE/config.yml
Expand Up @@ -9,6 +9,3 @@ contact_links:
- name: ❓ Support Question
url: https://woo.com/document/woocommerce-self-service-guide/
about: If you have a question please see our docs or use our forums, helpdesk, or Slack community!
- name: WooCommerce Blocks
url: https://github.com/woocommerce/woocommerce-gutenberg-products-block
about: Please report issues for WooCommerce Blocks directly to it's repository.
153 changes: 64 additions & 89 deletions .github/actions/setup-woocommerce-monorepo/action.yml
@@ -1,91 +1,66 @@
name: Setup WooCommerce Monorepo
description: Handles the installation, building, and caching of the projects within the monorepo.
permissions: {}

name: 'Setup WooCommerce Monorepo'
description: 'A composite action bundling together the setup of dependencies and optional installation and building of projects.'
inputs:
install:
description: Indicates whether or not the action should install any projects.
default: 'true'
install-filters:
description: The PNPM filter used to decide what projects to install. Supports multiline strings for multiple filters.
default: ''
build:
description: Indicates whether or not the action should build any projects.
default: 'true'
build-filters:
description: The PNPM filter used to decide what projects to build. Supports multiline strings for multiple filters.
default: ''
php-version:
description: The version of PHP that the action should set up.
default: '7.4'

php-version:
description: 'The PHP version that should be installed. Use "false" to skip PHP installation.'
default: '7.4'
install:
description: 'Given a boolean or PNPM filter, runs the install command for monorepo project(s).'
default: false
build:
description: 'Given a boolean or PNPM filter, runs the build command for monorepo project(s).'
default: false
runs:
using: composite
steps:
- name: Parse Action Input
id: parse-input
shell: bash
run: |
echo "INSTALL_FILTERS=$(node ./.github/actions/setup-woocommerce-monorepo/scripts/parse-input-filter.js '${{ inputs.install-filters }}')" >> $GITHUB_OUTPUT
echo "BUILD_FILTERS=$(node ./.github/actions/setup-woocommerce-monorepo/scripts/parse-input-filter.js '${{ inputs.build-filters }}')" >> $GITHUB_OUTPUT
- name: Setup PNPM
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd
with:
version: '8.6.7'

- name: Setup Node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
with:
node-version-file: .nvmrc
cache: pnpm
registry-url: 'https://registry.npmjs.org'

- name: Setup PHP
uses: shivammathur/setup-php@8e2ac35f639d3e794c1da1f28999385ab6fdf0fc
with:
php-version: ${{ inputs.php-version }}
coverage: none
tools: phpcs, sirbrillig/phpcs-changed:2.11.1

- name: Cache Composer Dependencies
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
with:
path: ~/.cache/composer/files
key: ${{ runner.os }}-php-${{ inputs.php-version }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-php-${{ inputs.php-version }}-composer-

- name: Install Node and PHP Dependencies
shell: bash
if: ${{ inputs.install == 'true' }}
env:
PUPPETEER_SKIP_DOWNLOAD: 'true'
run: |
pnpm -w install turbo
pnpm install ${{ steps.parse-input.outputs.INSTALL_FILTERS }}
- name: Get branch name
id: get_branch
shell: bash
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
branch_name=$(echo "${{ github.head_ref }}" | tr '/' '-')
echo "CURRENT_BRANCH_NAME=$branch_name" >> $GITHUB_OUTPUT
else
echo "CURRENT_BRANCH_NAME=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
- name: Cache Build Output
if: ${{ inputs.build == 'true' }}
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
with:
path: .turbo
key: ${{ runner.os }}-build-output-${{ steps.get_branch.outputs.CURRENT_BRANCH_NAME }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-output-${{ steps.get_branch.outputs.CURRENT_BRANCH_NAME }}
${{ runner.os }}-build-output
- name: Build
if: ${{ inputs.install == 'true' && inputs.build == 'true' }}
shell: bash
run: pnpm -w exec turbo run turbo:build --cache-dir=".turbo" ${{ steps.parse-input.outputs.BUILD_FILTERS }}
using: 'composite'
steps:
- name: 'Read PNPM Version'
id: 'read-pnpm-version'
shell: 'bash'
run: 'echo "version=$(./.github/actions/setup-woocommerce-monorepo/scripts/read-pnpm-version.sh package.json)" >> $GITHUB_OUTPUT'
- name: 'Setup PNPM'
uses: 'pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598'
with:
version: ${{ steps.read-pnpm-version.outputs.version }}
- name: 'Setup Node'
uses: 'actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65'
with:
node-version-file: '.nvmrc'
# We only want to use the cache if something is being installed.
cache: ${{ inputs.install != 'false' && 'pnpm' || '' }}
- name: 'Setup PHP'
if: ${{ inputs.php-version != 'false' }}
uses: 'shivammathur/setup-php@a36e1e52ff4a1c9e9c9be31551ee4712a6cb6bd0'
with:
php-version: '${{ inputs.php-version }}'
coverage: 'none'
- name: 'Cache Composer Dependencies'
if: ${{ inputs.php-version != 'false' }}
uses: 'actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84'
with:
path: '~/.cache/composer/files'
key: "${{ runner.os }}-composer-${{ hashFiles( '**/composer.lock' ) }}"
restore-keys: '${{ runner.os }}-composer-'
- name: 'Parse Project Filters'
id: 'project-filters'
shell: 'bash'
run: |
echo "install=$(node ./.github/actions/setup-woocommerce-monorepo/scripts/parse-input-filter.js '${{ inputs.install }}')" >> $GITHUB_OUTPUT
echo "build=$(node ./.github/actions/setup-woocommerce-monorepo/scripts/parse-input-filter.js '${{ inputs.build }}')" >> $GITHUB_OUTPUT
- name: 'Install Project Dependencies'
# Boolean inputs aren't parsed into filters so it'll either be "true" or there will be a filter.
if: ${{ inputs.install == 'true' || steps.project-filters.outputs.install != '' }}
shell: 'bash'
run: 'pnpm install'
# `pnpm install` filtering is broken: https://github.com/pnpm/pnpm/issues/6300
# run: 'pnpm install ${{ steps.project-filters.outputs.install }}'
# We want to include an option to build projects using this action so that we can make
# sure that the build cache is always used when building projects.
- name: 'Cache Build Output'
# Boolean inputs aren't parsed into filters so it'll either be "true" or there will be a filter.
if: ${{ inputs.build == 'true' || steps.project-filters.outputs.build != '' }}
uses: 'google/wireit@f3a3c79c553122e2fe5829eeac7d815326502903'
- name: 'Build'
# Boolean inputs aren't parsed into filters so it'll either be "true" or there will be a filter.
if: ${{ inputs.build == 'true' || steps.project-filters.outputs.build != '' }}
shell: 'bash'
run: 'pnpm ${{ steps.project-filters.outputs.build }} build'
@@ -1,22 +1,27 @@
const args = process.argv.slice(2);
if (args.length != 1) {
console.error('Filters must be passed as a single string!');
process.exit(-1);
const args = process.argv.slice( 2 );
if ( args.length != 1 ) {
console.error( 'Filters must be passed as a single string!' );
process.exit( -1 );
}

// Boolean inputs should not be processed.
if ( args[0] === 'true' || args[0] === 'false' ) {
process.exit();
}

// Read all of the given filters and return the full filter options string.
const filterLines = args[0].split("\n");
const filterLines = args[0].split( "\n" );
let output = '';
for (const line of filterLines) {
if (line === '') {
for ( const line of filterLines ) {
if ( line === '' ) {
continue;
}

if (output !== '') {
if ( output !== '' ) {
output += ' ';
}
output += "--filter='" + line + "'";
output += `--filter='${ line }'`;
}

console.log(output);
process.exit(0);
console.log( output );
process.exit();
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

PACKAGE_FILE=$1
if [[ -z "$PACKAGE_FILE" ]]; then
echo "Usage: $0 <package.json>"
exit 1
fi

awk -F'"' '/"pnpm": ".+"/{ print $4; exit; }' $PACKAGE_FILE
6 changes: 3 additions & 3 deletions .github/actions/tests/setup-local-test-environment/action.yml
Expand Up @@ -18,12 +18,12 @@ runs:
if: ( inputs.test-type == 'e2e' ) || ( inputs.test-type == 'api' )
working-directory: plugins/woocommerce
shell: bash
run: pnpm run env:test
run: pnpm env:test

- name: Load docker images and start containers for k6 performance tests
if: inputs.test-type == 'k6'
working-directory: plugins/woocommerce
shell: bash
run: |
pnpm env:dev --filter=woocommerce
pnpm env:performance-init --filter=woocommerce
pnpm --filter=@woocommerce/plugin-woocommerce env:dev
pnpm --filter=@woocommerce/plugin-woocommerce env:performance-init
17 changes: 17 additions & 0 deletions .github/automate-team-review-assignment-config.yml
@@ -0,0 +1,17 @@
when:
- author:
teamIs:
- rubik
ignore:
nameIs:
assign:
teams:
- rubik
- author:
teamIs:
- woo-fse
ignore:
nameIs:
assign:
teams:
- woo-fse
4 changes: 2 additions & 2 deletions .github/project-community-pr-assigner.yml
@@ -1,7 +1,7 @@
# See https://github.com/shufo/auto-assign-reviewer-by-files/blob/main/README.md for configuration format

".github/*":
- team: atlas
- team: vortex

"packages/js/api/**/*":
- team: solaris
Expand Down Expand Up @@ -82,4 +82,4 @@
- team: ghidorah

"plugins/woocommerce-beta-tester/**/*":
- team: atlas
- team: vortex
3 changes: 3 additions & 0 deletions .github/project-pr-labeler.yml
Expand Up @@ -67,6 +67,9 @@
'plugin: woo-ai':
- plugins/woo-ai/**/*

'plugin: woocommerce docs':
- plugins/woocommerce-docs/**/*

'focus: performance tests':
- plugins/woocommerce/tests/performance/**/*

Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/automate-team-review-assignment-config.yml
@@ -0,0 +1,15 @@
name: 'Automate assigning team for review.'
on:
pull_request:
types: [opened, ready_for_review]

jobs:
add-reviews:
if: github.event.pull_request.draft == false && github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- name: Check config and assign reviews
uses: acq688/Request-Reviewer-For-Team-Action@v1.1
with:
config: '.github/automate-team-review-assignment-config.yml'
GITHUB_TOKEN: ${{ secrets.FINE_GRAINED_TOKEN_ACTIONS }}

0 comments on commit 01ffbb0

Please sign in to comment.