Make WordPress Core


Ignore:
Timestamp:
04/02/2021 04:02:57 PM (4 years ago)
Author:
desrosj
Message:

Build/Test Tools: Backport GitHub Action and build improvements to the 4.1 branch.

This backports several build and test tool improvements to the 4.1 branch. Most notably, this includes:

  • The changes required to allow each workflow to be triggered by the workflow_dispatch event so that tests can be run on a schedule [50590].
  • Splitting single site and multisite tests into parallel jobs [50379].
  • Split slow tests into separate, parallel jobs for PHP <= 5.6 [50444].
  • Better branch and path scoping for GitHub Action workflows when running on pull_request [50432,50479].
  • Several devDependency updates.

Merges [50379,50387,50416,50432,50435-50436,50444,50446,50473-50474,50476,50479,50485-50487,50545,50590] to the 4.1 branch.
See #50401, #51801, #51802, #52548, #52612, #52624, #52625, #52645, #52653, #52658, #52660, #52667.

Location:
branches/4.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.1

  • branches/4.1/.github/workflows/phpunit-tests.yml

    r50325 r50643  
    55    branches:
    66      - master
     7      - trunk
    78      - '3.[7-9]'
    89      - '[4-9].[0-9]'
     
    1112      - '[4-9].[0-9]*'
    1213  pull_request:
     14    branches:
     15      - master
     16      - trunk
     17      - '3.[7-9]'
     18      - '[4-9].[0-9]'
     19  workflow_dispatch:
    1320  # Once weekly On Sundays at 00:00 UTC.
    1421  schedule:
     
    4451      - name: Cancel previous runs of this workflow (pull requests only)
    4552        if: ${{ github.event_name == 'pull_request' }}
    46         uses: styfle/cancel-workflow-action@0.5.0
    47         with:
    48           access_token: ${{ github.token }}
     53        uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0
    4954
    5055      - name: Checkout repository
    51         uses: actions/checkout@v2
     56        uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
    5257
    5358      - name: Log debug information
     
    6570
    6671      - name: Install NodeJS
    67         uses: actions/setup-node@v1
     72        uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
    6873        with:
    6974          node-version: 14
    7075
    7176      - name: Cache NodeJS modules
    72         uses: actions/cache@v2
     77        uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
    7378        env:
    7479          cache-name: cache-node-modules
     
    7782          path: ~/.npm
    7883          key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
    79           restore-keys: |
    80             ${{ runner.os }}-npm-
    8184
    8285      - name: Install Dependencies
    83         run: npx install-changed --install-command="npm ci"
     86        run: npm ci
    8487
    8588      - name: Build WordPress
     
    8790
    8891      - name: Create ZIP artifact
    89         uses: thedoctor0/zip-release@0.4.1
     92        uses: thedoctor0/zip-release@a1afcab9c664c9976ac398fa831eac67bed1eb0e # v0.4.1
    9093        with:
    9194          filename: built-wp-${{ github.sha }}.zip
     
    9396
    9497      - name: Upload build artifact
    95         uses: actions/upload-artifact@v2
     98        uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2
    9699        with:
    97100          name: built-wp-${{ github.sha }}
     
    125128  # - todo: Configure Slack notifications for failing tests.
    126129  test-php:
    127     name: ${{ matrix.php }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
     130    name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }} ${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
    128131    needs: setup-wordpress
    129132    runs-on: ${{ matrix.os }}
    130133    strategy:
     134      fail-fast: false
    131135      matrix:
    132         php: [ '5.6' ]
    133         phpunit: [ '4-php-5.6' ]
     136        php: [ '5.3', '5.4', '5.5' ]
    134137        os: [ ubuntu-latest ]
     138        split_slow: [ false, true ]
     139        multisite: [ false, true ]
    135140        memcached: [ false ]
    136141        include:
    137           - php: '5.5'
    138             phpunit: '5.5'
     142          - php: '5.6'
     143            phpunit: '4-php-5.6'
    139144            os: ubuntu-latest
     145            split_slow: false
     146            multisite: false
    140147            memcached: false
    141           - php: '5.4'
    142             phpunit: '5.4'
     148          - php: '5.6'
     149            phpunit: '4-php-5.6'
    143150            os: ubuntu-latest
     151            split_slow: false
     152            multisite: true
    144153            memcached: false
    145           - php: '5.3'
    146             phpunit: '5.3'
     154          - php: '5.6'
     155            phpunit: '4-php-5.6'
    147156            os: ubuntu-latest
     157            split_slow: true
     158            multisite: false
     159            memcached: false
     160          - php: '5.6'
     161            phpunit: '4-php-5.6'
     162            os: ubuntu-latest
     163            split_slow: true
     164            multisite: true
    148165            memcached: false
    149166    env:
    150167      LOCAL_PHP: ${{ matrix.php }}-fpm
    151       LOCAL_PHPUNIT: ${{ matrix.phpunit }}-fpm
     168      LOCAL_PHPUNIT: ${{ matrix.phpunit && matrix.phpunit || matrix.php }}-fpm
    152169      LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }}
     170      PHPUNIT_CONFIG: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
     171      SLOW_TESTS: 'external-http,media'
    153172
    154173    steps:
     
    159178
    160179      - name: Download the built WordPress artifact
    161         uses: actions/download-artifact@v2
     180        uses: actions/download-artifact@4a7a711286f30c025902c28b541c10e147a9b843 # v2.0.8
    162181        with:
    163182          name: built-wp-${{ github.sha }}
     
    167186
    168187      - name: Install NodeJS
    169         uses: actions/setup-node@v1
     188        uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
    170189        with:
    171190          node-version: 14
    172191
    173192      - name: Use cached Node modules
    174         uses: actions/cache@v2
     193        uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
    175194        env:
    176195          cache-name: cache-node-modules
     
    179198          path: ~/.npm
    180199          key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
    181           restore-keys: |
    182             ${{ runner.os }}-npm-
    183200
    184201      - name: Install Dependencies
    185         run: npx install-changed --install-command="npm ci"
     202        run: npm ci
    186203
    187204      - name: Cache Composer dependencies
    188205        if: ${{ env.COMPOSER_INSTALL == true }}
    189         uses: actions/cache@v2
     206        uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
    190207        env:
    191208          cache-name: cache-composer-dependencies
     
    193210          path: ${{ steps.composer-cache.outputs.dir }}
    194211          key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
    195           restore-keys: |
    196             ${{ runner.os }}-php-${{ matrix.php }}-composer-
    197212
    198213      - name: Install Composer dependencies
     
    240255        run: npm run env:install
    241256
     257      - name: Run slow PHPUnit tests
     258        if: ${{ matrix.split_slow }}
     259        run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}
     260
     261      - name: Run PHPUnit tests for single site excluding slow tests
     262        if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }}
     263        run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required
     264
     265      - name: Run PHPUnit tests for Multisite excluding slow tests
     266        if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }}
     267        run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers
     268
    242269      - name: Run PHPUnit tests
    243         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist
     270        if: ${{ matrix.php >= '7.0' }}
     271        run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }}
    244272
    245273      - name: Run AJAX tests
    246         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group ajax
    247 
    248       - name: Run tests as a multisite install
    249         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml
    250 
    251       - name: Run ms-files tests as a multisite install
    252         run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files
     274        if: ${{ ! matrix.multisite && ! matrix.split_slow }}
     275        run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
    253276
    254277      - name: Run external HTTP tests
     278        if: ${{ ! matrix.multisite && ! matrix.split_slow }}
    255279        run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group external-http
    256280
    257281      - name: Checkout the WordPress Test Reporter
    258282        if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }}
    259         uses: actions/checkout@v2
     283        uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
    260284        with:
    261285          repository: 'WordPress/phpunit-test-runner'
Note: See TracChangeset for help on using the changeset viewer.