Make WordPress Core

Changeset 59577


Ignore:
Timestamp:
01/06/2025 10:29:09 AM (8 days ago)
Author:
swissspidy
Message:

Build/Test Tools: Expand performance tests setup.

Run tests against Multisite (possible since [58097]) and on single post pages. Also improve cache flushes/resets between iterations.

Props swissspidy, flixos90, desrosj, mukesh27.
Fixes #62725.

Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/performance.yml

    r59507 r59577  
    3333  # Runs the performance test suite.
    3434  performance:
    35     name: Performance tests ${{ matrix.memcached && '(with memcached)' || '' }}
     35    name: ${{ matrix.multisite && 'Multisite' || 'Single site' }}
    3636    uses: WordPress/wordpress-develop/.github/workflows/reusable-performance.yml@trunk
    3737    permissions:
     
    4242      matrix:
    4343        memcached: [ true, false ]
     44        multisite: [ true, false ]
    4445    with:
    4546      memcached: ${{ matrix.memcached }}
     47      multisite: ${{ matrix.multisite }}
    4648    secrets:
    4749      CODEVITALS_PROJECT_TOKEN: ${{ secrets.CODEVITALS_PROJECT_TOKEN }}
  • trunk/.github/workflows/reusable-performance.yml

    r59571 r59577  
    22# A reusable workflow that runs the performance test suite.
    33##
    4 name: Performance Tests
     4name: Run performance Tests
    55
    66on:
     
    2424      memcached:
    2525        description: 'Whether to enable memcached.'
     26        required: false
     27        type: 'boolean'
     28        default: false
     29      multisite:
     30        description: 'Whether to use Multisite.'
    2631        required: false
    2732        type: 'boolean'
     
    5459  LOCAL_PHP_MEMCACHED: ${{ inputs.memcached }}
    5560  LOCAL_PHP: ${{ inputs.php-version }}${{ 'latest' != inputs.php-version && '-fpm' || '' }}
     61  LOCAL_MULTISITE: ${{ inputs.multisite }}
    5662
    5763jobs:
     
    6672  # - Build WordPress.
    6773  # - Start Docker environment.
     74  # - Install object cache drop-in.
    6875  # - Log running Docker containers.
    6976  # - Docker debug information.
    7077  # - Install WordPress.
     78  # - Enable themes on Multisite.
    7179  # - Install WordPress Importer plugin.
    7280  # - Import mock data.
     
    99107  # - Ensure version-controlled files are not modified or deleted.
    100108  performance:
    101     name: Run tests
     109    name: ${{ inputs.multisite && 'Multisite' || 'Single site' }} / ${{ inputs.memcached && 'Memcached' || 'Default' }}
    102110    runs-on: ubuntu-latest
    103111    permissions:
     
    167175        run: npm run env:install
    168176
     177      - name: Enable themes on Multisite
     178        if: ${{ inputs.multisite }}
     179        run: |
     180          npm run env:cli -- theme enable twentytwentyone --network --path=/var/www/${{ env.LOCAL_DIR }}
     181          npm run env:cli -- theme enable twentytwentythree --network --path=/var/www/${{ env.LOCAL_DIR }}
     182          npm run env:cli -- theme enable twentytwentyfour --network --path=/var/www/${{ env.LOCAL_DIR }}
     183          npm run env:cli -- theme enable twentytwentyfive --network --path=/var/www/${{ env.LOCAL_DIR }}
     184
    169185      - name: Install WordPress Importer plugin
    170186        run: npm run env:cli -- plugin install wordpress-importer --activate --path=/var/www/${{ env.LOCAL_DIR }}
     
    291307        if: always()
    292308        with:
    293           name: performance-artifacts${{ inputs.memcached && '-memcached' || '' }}-${{ github.run_id }}
     309          name: performance-artifacts${{ inputs.multisite && '-multisite' || '' }}${{ inputs.memcached && '-memcached' || '' }}-${{ github.run_id }}
    294310          path: artifacts
    295311          if-no-files-found: ignore
     
    304320      - name: Set the base sha
    305321        # Only needed when publishing results.
    306         if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' && ! inputs.memcached }}
     322        if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' && ! inputs.memcached && ! inputs.multisite }}
    307323        uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
    308324        id: base-sha
     
    315331      - name: Set commit details
    316332        # Only needed when publishing results.
    317         if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' && ! inputs.memcached }}
     333        if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' && ! inputs.memcached && ! inputs.multisite }}
    318334        uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
    319335        id: commit-timestamp
     
    326342      - name: Publish performance results
    327343        # Only publish results on pushes to trunk.
    328         if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' && ! inputs.memcached }}
     344        if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' && ! inputs.memcached && ! inputs.multisite }}
    329345        env:
    330346          BASE_SHA: ${{ steps.base-sha.outputs.result }}
  • trunk/tests/performance/compare-results.js

    r58076 r59577  
    9797}
    9898
     99summaryMarkdown += `<details><summary>Results</summary>`;
     100
    99101for ( const { title, results } of afterStats ) {
    100102    const prevStat = beforeStats.find( ( s ) => s.title === title );
     
    144146    }
    145147
    146     summaryMarkdown += `**${ title }**\n\n`;
     148    summaryMarkdown += `<b>${ title }</b>\n\n`;
    147149    summaryMarkdown += `${ formatAsMarkdownTable( rows ) }\n`;
    148150}
     151
     152summaryMarkdown += `</details>`;
    149153
    150154writeFileSync(
  • trunk/tests/performance/log-results.js

    r59170 r59577  
    1919    'Admin › Locale: en_US': 'admin',
    2020    'Admin › Locale: de_DE': 'admin-l10n',
    21     'Front End › Theme: twentytwentyone, Locale: en_US': 'home-classic-theme',
    22     'Front End › Theme: twentytwentyone, Locale: de_DE':
     21    'Homepage › Theme: twentytwentyone, Locale: en_US': 'home-classic-theme',
     22    'Homepage › Theme: twentytwentyone, Locale: de_DE':
    2323        'home-classic-theme-l10n',
    24     'Front End › Theme: twentytwentythree, Locale: en_US': 'home-block-theme',
    25     'Front End › Theme: twentytwentythree, Locale: de_DE':
     24    'Homepage › Theme: twentytwentythree, Locale: en_US': 'home-block-theme',
     25    'Homepage › Theme: twentytwentythree, Locale: de_DE':
    2626        'home-block-theme-l10n',
     27    'Homepage › Theme: twentytwentyfour, Locale: en_US': 'home-twentytwentyfour',
     28    'Homepage › Theme: twentytwentyfour, Locale: de_DE':
     29        'home-twentytwentyfour-l10n',
     30    'Homepage › Theme: twentytwentyfive, Locale: en_US': 'home-twentytwentyfive',
     31    'Homepage › Theme: twentytwentyfive, Locale: de_DE':
     32        'home-twentytwentyfive-l10n',
    2733};
    2834
  • trunk/tests/performance/specs/admin.test.js

    r58076 r59577  
    77 * Internal dependencies
    88 */
    9 import { camelCaseDashes } from '../utils';
     9import { camelCaseDashes, locales } from '../utils';
    1010
    1111const results = {
    1212    timeToFirstByte: [],
    1313};
    14 
    15 const locales = [ 'en_US', 'de_DE' ];
    1614
    1715test.describe( 'Admin', () => {
     
    4846            for ( let i = 1; i <= iterations; i++ ) {
    4947                test( `Measure load time metrics (${ i } of ${ iterations })`, async ( {
     48                    page,
    5049                    admin,
    5150                    metrics,
    5251                } ) => {
     52                    // Clear caches using the clear-cache.php mu-plugin. Not actually loading the page.
     53                    await page.goto( '/?clear_cache' );
     54
     55                    // This is the actual page to test.
    5356                    await admin.visitAdminPage( '/' );
    5457
  • trunk/tests/performance/specs/home.test.js

    r59524 r59577  
    77 * Internal dependencies
    88 */
    9 import { camelCaseDashes } from '../utils';
     9import { camelCaseDashes, themes, locales } from '../utils';
    1010
    1111const results = {
     
    1515};
    1616
    17 const themes = [ 'twentytwentyone', 'twentytwentythree', 'twentytwentyfour', 'twentytwentyfive' ];
    18 
    19 const locales = [ 'en_US', 'de_DE' ];
    20 
    21 test.describe( 'Front End', () => {
     17test.describe( 'Homepage', () => {
    2218    test.use( {
    2319        storageState: {}, // User will be logged out.
     
    5551                        metrics,
    5652                    } ) => {
     53                        // Clear caches using the clear-cache.php mu-plugin. Not actually loading the page.
     54                        await page.goto( '/?clear_cache' );
     55
     56                        // This is the actual page to test.
    5757                        await page.goto( '/' );
    5858
  • trunk/tests/performance/utils.js

    r58076 r59577  
    66
    77process.env.WP_ARTIFACTS_PATH ??= join( process.cwd(), 'artifacts' );
     8
     9const locales = [ 'en_US', 'de_DE' ];
     10
     11const themes = [ 'twentytwentyone', 'twentytwentythree', 'twentytwentyfour', 'twentytwentyfive' ];
    812
    913/**
     
    190194    medianAbsoluteDeviation,
    191195    accumulateValues,
     196    themes,
     197    locales,
    192198};
Note: See TracChangeset for help on using the changeset viewer.