Skip to content

Commit

Permalink
Merge changes published in the Gutenberg plugin "release/14.9" branch
Browse files Browse the repository at this point in the history
  • Loading branch information
gutenbergplugin committed Jan 2, 2023
1 parent 1eb65aa commit 7b578b1
Show file tree
Hide file tree
Showing 511 changed files with 19,514 additions and 8,872 deletions.
5 changes: 2 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const restrictedImports = [
'every',
'extend',
'filter',
'find',
'findIndex',
'findKey',
'findLast',
Expand Down Expand Up @@ -106,6 +107,7 @@ const restrictedImports = [
'negate',
'noop',
'nth',
'omit',
'omitBy',
'once',
'orderby',
Expand Down Expand Up @@ -370,9 +372,6 @@ module.exports = {
'plugin:jest-dom/recommended',
'plugin:testing-library/react',
],
rules: {
'testing-library/no-node-access': 'off',
},
},
{
files: [ 'packages/e2e-test*/**/*.js' ],
Expand Down
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
/packages/compose @ajitbohra
/packages/element @ajitbohra
/packages/notices @ajitbohra
/packages/nux @ajitbohra
/packages/viewport @ajitbohra
/packages/base-styles
/packages/icons
Expand Down
66 changes: 0 additions & 66 deletions .github/workflows/end2end-test-playwright.yml

This file was deleted.

97 changes: 94 additions & 3 deletions .github/workflows/end2end-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ concurrency:
cancel-in-progress: true

jobs:
admin:
name: Admin - ${{ matrix.part }}
e2e-puppeteer:
name: Puppeteer - ${{ matrix.part }}
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
strategy:
Expand Down Expand Up @@ -60,6 +60,97 @@ jobs:
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
if: always()
with:
name: flaky-tests-report-${{ matrix.part }}
name: flaky-tests-report
path: flaky-tests
if-no-files-found: ignore

e2e-playwright:
name: Playwright
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
strategy:
fail-fast: false

steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0

- name: Use desired version of NodeJS
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: npm

- name: Npm install and build
run: |
npm ci
npm run build
- name: Install Playwright dependencies
run: |
npx playwright install chromium firefox webkit --with-deps
- name: Install WordPress and start the server
run: |
npm run wp-env start
- name: Run the tests
run: |
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:e2e:playwright
- name: Archive debug artifacts (screenshots, traces)
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
if: always()
with:
name: failures-artifacts
path: artifacts/test-results
if-no-files-found: ignore

- name: Archive flaky tests report
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
if: always()
with:
name: flaky-tests-report
path: flaky-tests
if-no-files-found: ignore

report-to-issues:
name: Report to GitHub
needs: [e2e-puppeteer, e2e-playwright]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
# Checkout defaults to using the branch which triggered the event, which
# isn't necessarily `trunk` (e.g. in the case of a merge).
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
with:
ref: trunk

- uses: actions/download-artifact@v3
id: download_artifact
# Don't fail the job if there isn't any flaky tests report.
continue-on-error: true
with:
name: flaky-tests-report
path: flaky-tests

- name: Use desired version of NodeJS
if: ${{ steps.download_artifact.outcome == 'success' }}
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: npm

- name: Npm install and build
if: ${{ steps.download_artifact.outcome == 'success' }}
# TODO: We don't have to build the entire project, just the action itself.
run: |
npm ci
npm run build:packages
- name: Report flaky tests
if: ${{ steps.download_artifact.outcome == 'success' }}
uses: ./packages/report-flaky-tests
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
label: '[Type] Flaky Test'
artifact-path: flaky-tests
38 changes: 0 additions & 38 deletions .github/workflows/flaky-tests.yml

This file was deleted.

29 changes: 28 additions & 1 deletion bin/api-docs/gen-theme-reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ const getStylePropertiesMarkup = ( struct ) => {
props[ key ].type === 'object'
? keys( props[ key ].properties ).sort().join( ', ' )
: '';
markup += `| ${ key } | ${ props[ key ].type } | ${ ps } |\n`;
const type = formatType( props[ key ] );
markup += `| ${ key } | ${ type } | ${ ps } |\n`;
} );

return markup;
Expand Down Expand Up @@ -160,6 +161,32 @@ ${ markupFn( data ) }

let autogen = '';

/**
* Format list of types.
*
* @param {Object} prop
* @return {string} type
*/
const formatType = ( prop ) => {
let type = prop.type || '';

if ( prop.hasOwnProperty( 'anyOf' ) || prop.hasOwnProperty( 'oneOf' ) ) {
const propTypes = prop.anyOf || prop.oneOf;
const types = [];

propTypes.forEach( ( item ) => {
if ( item.type ) types.push( item.type );
// refComplete is always an object
if ( item.$ref && item.$ref === '#/definitions/refComplete' )
types.push( 'object' );
} );

type = [ ...new Set( types ) ].join( ', ' );
}

return type;
};

// Settings
const settings = Object.entries( themejson.definitions )
.filter( ( [ settingsKey ] ) =>
Expand Down
16 changes: 16 additions & 0 deletions bin/plugin/commands/performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const config = require( '../config' );
* @property {number[]} firstContentfulPaint Represents the time when the browser first renders any text or media.
* @property {number[]} firstBlock Represents the time when Puppeteer first sees a block selector in the DOM.
* @property {number[]} type Average type time.
* @property {number[]} typeContainer Average type time within a container.
* @property {number[]} focus Average block selection time.
* @property {number[]} inserterOpen Average time to open global inserter.
* @property {number[]} inserterSearch Average time to search the inserter.
Expand All @@ -56,6 +57,9 @@ const config = require( '../config' );
* @property {number=} type Average type time.
* @property {number=} minType Minimum type time.
* @property {number=} maxType Maximum type time.
* @property {number=} typeContainer Average type time within a container.
* @property {number=} minTypeContainer Minimum type time within a container.
* @property {number=} maxTypeContainer Maximum type time within a container.
* @property {number=} focus Average block selection time.
* @property {number=} minFocus Min block selection time.
* @property {number=} maxFocus Max block selection time.
Expand Down Expand Up @@ -129,6 +133,9 @@ function curateResults( results ) {
type: average( results.type ),
minType: Math.min( ...results.type ),
maxType: Math.max( ...results.type ),
typeContainer: average( results.typeContainer ),
minTypeContainer: Math.min( ...results.typeContainer ),
maxTypeContainer: Math.max( ...results.typeContainer ),
focus: average( results.focus ),
minFocus: Math.min( ...results.focus ),
maxFocus: Math.max( ...results.focus ),
Expand Down Expand Up @@ -393,6 +400,15 @@ async function runPerformanceTests( branches, options ) {
type: rawResults.map( ( r ) => r[ branch ].type ),
minType: rawResults.map( ( r ) => r[ branch ].minType ),
maxType: rawResults.map( ( r ) => r[ branch ].maxType ),
typeContainer: rawResults.map(
( r ) => r[ branch ].typeContainer
),
minTypeContainer: rawResults.map(
( r ) => r[ branch ].minTypeContainer
),
maxTypeContainer: rawResults.map(
( r ) => r[ branch ].maxTypeContainer
),
focus: rawResults.map( ( r ) => r[ branch ].focus ),
minFocus: rawResults.map( ( r ) => r[ branch ].minFocus ),
maxFocus: rawResults.map( ( r ) => r[ branch ].maxFocus ),
Expand Down
Loading

0 comments on commit 7b578b1

Please sign in to comment.