Skip to content

Commit

Permalink
Merge branch 'trunk' into fix-css-imports-not-minified
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo authored Dec 5, 2023
2 parents 957f570 + 41ddc35 commit 6691c61
Show file tree
Hide file tree
Showing 668 changed files with 31,190 additions and 19,312 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/end2end-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ jobs:
npm run wp-env start
- name: Run the tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:e2e:playwright -- --shard=${{ matrix.part }}/${{ matrix.totalParts }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/stale-issue-gardening.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
remove-stale-when-updated: true
stale-issue-label: '[Status] Stale'
- name: 'Flaky test issues without activity'
message: 'This issue has gone 30 days without any activity.'
days-before-stale: 30
message: 'This issue has gone 15 days without any activity.'
days-before-stale: 15
days-before-close: 1
only-labels: '[Type] Flaky Test'
remove-stale-when-updated: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ jobs:
# dependency versions are installed and cached.
##
- name: Set up PHP
uses: shivammathur/setup-php@a36e1e52ff4a1c9e9c9be31551ee4712a6cb6bd0 # v2.27.1
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # v2.28.0
with:
php-version: '${{ matrix.php }}'
ini-file: development
Expand Down Expand Up @@ -226,7 +226,7 @@ jobs:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}

- name: Set up PHP
uses: shivammathur/setup-php@a36e1e52ff4a1c9e9c9be31551ee4712a6cb6bd0 # v2.27.1
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # v2.28.0
with:
php-version: '7.4'
coverage: none
Expand Down
41 changes: 33 additions & 8 deletions bin/plugin/commands/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,17 @@ const LABEL_FEATURE_MAPPING = {
'[Feature] Raw Handling': 'Block Editor',
'[Package] Edit Post': 'Post Editor',
'[Package] Icons': 'Icons',
'[Package] Block Editor': 'Block Editor',
'[Package] Block editor': 'Block Editor',
'[Package] Block library': 'Block Library',
'[Package] Editor': 'Post Editor',
'[Package] Edit Site': 'Site Editor',
'[Package] Edit Widgets': 'Widgets Editor',
'[Package] Widgets Customizer': 'Widgets Editor',
'[Package] Components': 'Components',
'[Package] Block Library': 'Block Library',
'[Package] Rich text': 'Block Editor',
'[Package] Data': 'Data Layer',
'[Package] Commands': 'Commands',
'[Block] Legacy Widget': 'Widgets Editor',
'REST API Interaction': 'REST API',
'New Block': 'Block Library',
Expand Down Expand Up @@ -220,9 +222,18 @@ function getTypesByLabels( labels ) {
...new Set(
labels
.filter( ( label ) =>
Object.keys( LABEL_TYPE_MAPPING ).includes( label )
Object.keys( LABEL_TYPE_MAPPING )
.map( ( currentLabel ) => currentLabel.toLowerCase() )
.includes( label.toLowerCase() )
)
.map( ( label ) => LABEL_TYPE_MAPPING[ label ] )
.map( ( label ) => {
const lowerCaseLabel =
Object.keys( LABEL_TYPE_MAPPING ).find(
( key ) => key.toLowerCase() === label.toLowerCase()
) || label;

return LABEL_TYPE_MAPPING[ lowerCaseLabel ];
} )
),
];
}
Expand All @@ -236,11 +247,24 @@ function getTypesByLabels( labels ) {
* @return {string[]} Feature candidates.
*/
function mapLabelsToFeatures( labels ) {
return labels
.filter( ( label ) =>
Object.keys( LABEL_FEATURE_MAPPING ).includes( label )
)
.map( ( label ) => LABEL_FEATURE_MAPPING[ label ] );
return [
...new Set(
labels
.filter( ( label ) =>
Object.keys( LABEL_FEATURE_MAPPING )
.map( ( currentLabel ) => currentLabel.toLowerCase() )
.includes( label.toLowerCase() )
)
.map( ( label ) => {
const lowerCaseLabel =
Object.keys( LABEL_FEATURE_MAPPING ).find(
( key ) => key.toLowerCase() === label.toLowerCase()
) || label;

return LABEL_FEATURE_MAPPING[ lowerCaseLabel ];
} )
),
];
}

/**
Expand Down Expand Up @@ -1070,4 +1094,5 @@ async function getReleaseChangelog( options ) {
getChangelog,
getUniqueByUsername,
skipCreatedByBots,
mapLabelsToFeatures,
};
1 change: 1 addition & 0 deletions bin/plugin/commands/performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ async function runTestSuite( testSuite, testRunnerDir, runKey ) {
testRunnerDir,
{
...process.env,
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1',
WP_ARTIFACTS_PATH: ARTIFACTS_PATH,
RESULTS_ID: runKey,
}
Expand Down
324 changes: 191 additions & 133 deletions bin/plugin/commands/test/__snapshots__/changelog.js.snap

Large diffs are not rendered by default.

24 changes: 21 additions & 3 deletions bin/plugin/commands/test/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
getChangelog,
getContributorProps,
getContributorsList,
mapLabelsToFeatures,
} from '../changelog';
import _pullRequests from './fixtures/pull-requests.json';
import botPullRequestFixture from './fixtures/bot-pull-requests.json';
Expand Down Expand Up @@ -312,18 +313,35 @@ describe( 'sortGroup', () => {
} );

describe( 'getTypesByLabels', () => {
it( 'returns all normalized type candidates by type prefix', () => {
it( 'returns all normalized type candidates by type prefix. it is case insensitive', () => {
const result = getTypesByLabels( [
'[Type] Regression',
'[Type] Bug',
'[Package] Blocks',
'[Type] Performance',
'[Type] performance',
] );

expect( result ).toEqual( [ 'Bug Fixes', 'Performance' ] );
} );
} );

describe( 'mapLabelsToFeatures', () => {
it( 'returns all normalized feature candidates by feature prefix. it is case insensitive', () => {
const result = mapLabelsToFeatures( [
'[Package] Commands',
'[Package] Block Library',
'[Feature] Link Editing',
'[Feature] block Multi Selection',
] );

expect( result ).toEqual( [
'Commands',
'Block Library',
'Block Editor',
] );
} );
} );

describe( 'getTypesByTitle', () => {
it.each( [
[ 'Fix Typography panel rendering from style hooks' ],
Expand Down Expand Up @@ -473,7 +491,7 @@ describe( 'getFormattedItemDescription', () => {
describe( 'getChangelog', () => {
test( 'verify that the changelog is properly formatted', () => {
// The fixture with the list of pull requests was generated by running the following command:
// npm run other:changelog -- --milestone="Gutenberg 11.3"
// npm run other:changelog -- --milestone="Gutenberg 16.8"
// The response from the `fetchAllPullRequests` call in the `getChangelog` method was stored in the JSON file.
expect( getChangelog( pullRequests ) ).toMatchSnapshot();
} );
Expand Down
Loading

0 comments on commit 6691c61

Please sign in to comment.