Skip to content

Commit

Permalink
Merge branch 'trunk' into rnmobile/add-media-inserter-to-toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
derekblank authored Jul 6, 2023
2 parents 4fa8834 + 1cbaccd commit 7f5a35f
Show file tree
Hide file tree
Showing 902 changed files with 28,411 additions and 6,160 deletions.
6 changes: 5 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const restrictedImports = [
'isPlainObject',
'isString',
'isUndefined',
'kebabCase',
'keyBy',
'keys',
'last',
Expand Down Expand Up @@ -367,7 +368,7 @@ module.exports = {
},
{
files: [ 'packages/jest*/**/*.js', '**/test/**/*.js' ],
excludedFiles: [ 'test/e2e/**/*.js' ],
excludedFiles: [ 'test/e2e/**/*.js', 'test/performance/**/*.js' ],
extends: [ 'plugin:@wordpress/eslint-plugin/test-unit' ],
},
{
Expand All @@ -377,6 +378,7 @@ module.exports = {
'packages/react-native-*/**/*.[tj]s?(x)',
'test/native/**/*.[tj]s?(x)',
'test/e2e/**/*.[tj]s?(x)',
'test/performance/**/*.[tj]s?(x)',
'test/storybook-playwright/**/*.[tj]s?(x)',
],
extends: [
Expand All @@ -396,6 +398,7 @@ module.exports = {
{
files: [
'test/e2e/**/*.[tj]s',
'test/performance/**/*.[tj]s',
'packages/e2e-test-utils-playwright/**/*.[tj]s',
],
extends: [
Expand All @@ -406,6 +409,7 @@ module.exports = {
tsconfigRootDir: __dirname,
project: [
'./test/e2e/tsconfig.json',
'./test/performance/tsconfig.json',
'./packages/e2e-test-utils-playwright/tsconfig.json',
],
},
Expand Down
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
# Full Site Editing
/packages/edit-site

# Interactivity API
/packages/interactivity @luisherranz @darerodz

# Tooling
/bin @ntwb @nerrad @ajitbohra
/bin/api-docs @ntwb @nerrad @ajitbohra
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-plugin-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
github.event.inputs.version == 'rc' ||
github.event.inputs.version == 'stable'
) || (
endsWith( github.ref, needs.compute-stable-branches.outputs.current_stable_branch ) &&
startsWith( github.ref, 'refs/heads/release/' ) &&
github.event.inputs.version == 'stable'
)
)
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/end2end-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
strategy:
fail-fast: false
matrix:
part: [1, 2, 3, 4]
totalParts: [4]
part: [1, 2, 3]
totalParts: [3]

steps:
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
Expand Down Expand Up @@ -67,8 +67,8 @@ jobs:
strategy:
fail-fast: false
matrix:
part: [1, 2]
totalParts: [2]
part: [1, 2, 3, 4]
totalParts: [4]

steps:
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
env:
CODEHEALTH_PROJECT_TOKEN: ${{ secrets.CODEHEALTH_PROJECT_TOKEN }}
run: |
COMMITTED_AT=$(git show -s $GITHUB_SHA --format="%ct")
COMMITTED_AT=$(git show -s $GITHUB_SHA --format="%cI")
./bin/log-performance-results.js $CODEHEALTH_PROJECT_TOKEN trunk $GITHUB_SHA 34af5829ac9edb31833167ff6a3b51bea982999c $COMMITTED_AT
- name: Archive debug artifacts (screenshots, HTML snapshots)
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ jobs:
fail-fast: true
matrix:
php:
- '5.6'
- '7.0'
- '7.1'
- '7.2'
Expand Down
119 changes: 107 additions & 12 deletions .github/workflows/upload-release-to-plugin-repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,66 @@ on:
types: [published]

jobs:
compute-should-update-trunk:
name: Decide if trunk or tag
runs-on: ubuntu-latest
# Skip this job if the release is a release candidate. This will in turn skip
# the upload jobs, which are only relevant for non-RC releases.
# We first check if the release is a prerelease, and then if the ref contains
# the string "rc". The latter is fallback in case the deployer accidentally
# unchecks the "This is a pre-release" checkbox in the release UI.
if: |
!github.event.release.prerelease && !contains(github.ref, 'rc')
outputs:
should_update_trunk: ${{ steps.compute_should_update_trunk.outputs.should_update_trunk }}

steps:
- name: Fetch latest version in the WP core repo
id: compute_latest_version_in_core_repo
run: |
latest_version_in_core_repo=$(curl -s 'https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request\[slug\]=gutenberg' | jq -r '.version')
echo "Latest Core Repo version: $latest_version_in_core_repo"
echo "version=$latest_version_in_core_repo" >> $GITHUB_OUTPUT
- name: Decide if it is a trunk or tag update
id: compute_should_update_trunk
env:
GITHUB_REF: ${{ github.ref }}
run: |
latestPublishedVersion=$(echo "$GITHUB_REF" | sed -E 's/refs\/tags\/(v?)([0-9.]+)/\2/')
latestVersionInCoreRepo="${{ steps.compute_latest_version_in_core_repo.outputs.version }}"
# Determines if the first version string is greater than the second version string.
#
# Params:
# $1 - The first version string to compare, which may have an optional leading "v".
# $2 - The second version string to compare, which may have an optional leading "v".
#
# Return values:
# 0 - The first version string is greater than the second version string.
# 1 - The first version string is less than or equal to the second version string.
is_first_version_greater_than_second() {
v1=${1#v}
v2=${2#v}
dpkg --compare-versions "$v1" gt "$v2"
return $?
}
# Only update trunk *if* the published release's version in Github is GREATER
# than the version currently published in the WP plugins repo. If not, then it
# will upload it as a new tag.
shouldUpdateTrunk=false
if is_first_version_greater_than_second "$latestPublishedVersion" "$latestVersionInCoreRepo"; then
shouldUpdateTrunk=true
fi
echo "Should update trunk: $shouldUpdateTrunk"
echo "should_update_trunk=$shouldUpdateTrunk" >> $GITHUB_OUTPUT
get-release-branch:
name: Get release branch name
runs-on: ubuntu-latest
if: github.event.release.assets[0]
outputs:
release_branch: ${{ steps.get_release_branch.outputs.release_branch }}

Expand All @@ -25,7 +81,8 @@ jobs:
update-changelog:
name: Update Changelog on ${{ matrix.branch }} branch
runs-on: ubuntu-latest
if: github.event.release.assets[0]
if: |
github.event.release.assets[0]
needs: get-release-branch
env:
TAG: ${{ github.event.release.tag_name }}
Expand Down Expand Up @@ -95,11 +152,12 @@ jobs:
path: ./changelog.txt

upload:
name: Upload Gutenberg Plugin
name: Publish as trunk (and tag)
runs-on: ubuntu-latest
environment: wp.org plugin
needs: update-changelog
if: ${{ !github.event.release.prerelease && github.event.release.assets[0] }}
needs: [compute-should-update-trunk, update-changelog]
if: |
needs.compute-should-update-trunk.outputs.should_update_trunk == 'true' && github.event.release.assets[0]
env:
PLUGIN_REPO_URL: 'https://plugins.svn.wordpress.org/gutenberg'
STABLE_VERSION_REGEX: '[0-9]\+\.[0-9]\+\.[0-9]\+\s*'
Expand All @@ -109,11 +167,7 @@ jobs:

steps:
- name: Check out Gutenberg trunk from WP.org plugin repo
run: svn checkout "$PLUGIN_REPO_URL/trunk"

- name: Get previous stable version
id: get_previous_stable_version
run: echo "stable_version=$(awk -F ':\ ' '$1 == "Stable tag" {print $2}' ./trunk/readme.txt)" >> $GITHUB_OUTPUT
run: svn checkout "$PLUGIN_REPO_URL/trunk" --username "$SVN_USERNAME" --password "$SVN_PASSWORD"

- name: Delete everything
working-directory: ./trunk
Expand All @@ -130,8 +184,8 @@ jobs:
- name: Replace the stable tag placeholder with the existing stable tag on the SVN repository
env:
STABLE_TAG_PLACEHOLDER: 'Stable tag: V\.V\.V'
STABLE_TAG: 'Stable tag: ${{ steps.get_previous_stable_version.outputs.stable_version }}'
run: sed -i "s/${STABLE_TAG_PLACEHOLDER}/${STABLE_TAG}/g" ./trunk/readme.txt
run: |
sed -i "s/$STABLE_TAG_PLACEHOLDER/Stable tag: $VERSION/g" ./trunk/readme.txt
- name: Download Changelog Artifact
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1
Expand Down Expand Up @@ -159,3 +213,44 @@ jobs:
sed -i "s/Stable tag: ${STABLE_VERSION_REGEX}/Stable tag: ${VERSION}/g" ./readme.txt
svn commit -m "Releasing version $VERSION" \
--no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD"
upload-tag:
name: Publish as tag
runs-on: ubuntu-latest
environment: wp.org plugin
needs: [compute-should-update-trunk, update-changelog]
if: |
needs.compute-should-update-trunk.outputs.should_update_trunk == 'false' && github.event.release.assets[0]
env:
PLUGIN_REPO_URL: 'https://plugins.svn.wordpress.org/gutenberg'
STABLE_VERSION_REGEX: '[0-9]\+\.[0-9]\+\.[0-9]\+\s*'
SVN_USERNAME: ${{ secrets.svn_username }}
SVN_PASSWORD: ${{ secrets.svn_password }}
VERSION: ${{ github.event.release.name }}

steps:
- name: Download and unzip Gutenberg plugin asset into tags folder
env:
PLUGIN_URL: ${{ github.event.release.assets[0].browser_download_url }}
run: |
# do the magic here
curl -L -o gutenberg.zip $PLUGIN_URL
unzip gutenberg.zip -d "$VERSION"
rm gutenberg.zip
- name: Replace the stable tag placeholder with the existing stable tag on the SVN repository
env:
STABLE_TAG_PLACEHOLDER: 'Stable tag: V\.V\.V'
run: |
sed -i "s/$STABLE_TAG_PLACEHOLDER/Stable tag: $VERSION/g" "$VERSION/readme.txt"
- name: Download Changelog Artifact
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1
with:
name: changelog trunk
path: ${{ github.event.release.name }}

- name: Add the new version directory and commit changes to the SVN repository
run: |
svn import "$VERSION" "$PLUGIN_REPO_URL/tags/$VERSION" -m "Committing version $VERSION" \
--no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ coverage
*.log
yarn.lock
/artifacts
/test/e2e/artifacts
/perf-envs
/composer.lock

Expand Down
1 change: 0 additions & 1 deletion bin/build-plugin-zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ build_files=$(
build/block-library/blocks/*.php \
build/block-library/blocks/*/block.json \
build/block-library/blocks/*/*.{js,js.map,css,asset.php} \
build/block-library/interactivity/*.{js,js.map,asset.php} \
build/edit-widgets/blocks/*/block.json \
build/widgets/blocks/*.php \
build/widgets/blocks/*/block.json \
Expand Down
2 changes: 1 addition & 1 deletion bin/log-performance-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const data = new TextEncoder().encode(
branch,
hash,
baseHash,
timestamp: parseInt( timestamp, 10 ),
timestamp,
metrics: resultsFiles.reduce( ( result, { metricsPrefix }, index ) => {
return {
...result,
Expand Down
4 changes: 4 additions & 0 deletions bin/plugin/commands/performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,10 @@ async function runPerformanceTests( branches, options ) {
path.join( environmentDirectory, '.wp-env.json' ),
JSON.stringify(
{
config: {
WP_DEBUG: false,
SCRIPT_DEBUG: false,
},
core: 'WordPress/WordPress',
plugins: [ path.join( environmentDirectory, 'plugin' ) ],
themes: [
Expand Down
Loading

0 comments on commit 7f5a35f

Please sign in to comment.