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

This backports several build and test tool improvements to the 4.3 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,50486,50487,50545,50579,50590] to the 4.3 branch.
See #50401, #51801, #51802, #52548, #52612, #52624, #52625, #52645, #52653, #52658, #52660, #52667.

git-svn-id: https://develop.svn.wordpress.org/branches/4.3@50640 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers 2021-04-02 15:46:33 +00:00
parent fbffe079aa
commit 61fe1073bf
10 changed files with 677 additions and 374 deletions

View File

@ -1,17 +1,38 @@
name: Coding Standards name: Coding Standards
on: on:
# JSHint was introduced in WordPress 3.8.
# PHPCS checking was introduced in WordPress 5.1.
push: push:
branches: branches:
- master - master
# JSHint was introduced in WordPress 3.8. - trunk
# PHPCS checking was introduced in WordPress 5.1.
- '3.[89]' - '3.[89]'
- '[4-9].[0-9]' - '[4-9].[0-9]'
tags: tags:
- '3.[89]*' - '3.[89]*'
- '[4-9].[0-9]*' - '[4-9].[0-9]*'
pull_request: pull_request:
branches:
- master
- trunk
- '3.[89]'
- '[4-9].[0-9]'
paths:
# Any change to a PHP or JavaScript file should run checks.
- '**.js'
- '**.php'
# These files configure NPM. Changes could affect the outcome.
- 'package*.json'
# These files configure Composer. Changes could affect the outcome.
- 'composer.*'
# This file configures JSHint. Changes could affect the outcome.
- '.jshintrc'
# This file configures PHPCS. Changes could affect the outcome.
- 'phpcs.xml.dist'
# Changes to workflow files should always verify all workflows are successful.
- '.github/workflows/*.yml'
workflow_dispatch:
jobs: jobs:
# Runs the JavaScript coding standards checks. # Runs the JavaScript coding standards checks.
@ -36,7 +57,7 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: Log debug information - name: Log debug information
run: | run: |
@ -46,20 +67,18 @@ jobs:
svn --version svn --version
- name: Install NodeJS - name: Install NodeJS
uses: actions/setup-node@v1 uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
with: with:
node-version: 14 node-version: 14
- name: Cache NodeJS modules - name: Cache NodeJS modules
uses: actions/cache@v2 uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
env: env:
cache-name: cache-node-modules cache-name: cache-node-modules
with: with:
# npm cache files are stored in `~/.npm` on Linux/macOS # npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Log debug information - name: Log debug information
run: | run: |
@ -67,7 +86,7 @@ jobs:
node --version node --version
- name: Install Dependencies - name: Install Dependencies
run: npx install-changed --install-command="npm ci" run: npm ci
- name: Run JSHint - name: Run JSHint
run: npm run grunt jshint run: npm run grunt jshint

View File

@ -1,16 +1,23 @@
name: End-to-end Tests name: End-to-end Tests
on: on:
# The end to end test suite was introduced in WordPress 5.3.
push: push:
branches: branches:
- master - master
# The end to end test suite was introduced in WordPress 5.3. - trunk
- '5.[3-9]' - '5.[3-9]'
- '[6-9].[0-9]' - '[6-9].[0-9]'
tags: tags:
- '5.[3-9]*' - '5.[3-9]*'
- '[6-9].[0-9]*' - '[6-9].[0-9]*'
pull_request: pull_request:
branches:
- master
- trunk
- '5.[3-9]'
- '[6-9].[0-9]'
workflow_dispatch:
env: env:
LOCAL_DIR: build LOCAL_DIR: build
@ -42,9 +49,7 @@ jobs:
steps: steps:
- name: Cancel previous runs of this workflow (pull requests only) - name: Cancel previous runs of this workflow (pull requests only)
if: ${{ github.event_name == 'pull_request' }} if: ${{ github.event_name == 'pull_request' }}
uses: styfle/cancel-workflow-action@0.5.0 uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0
with:
access_token: ${{ github.token }}
- name: Configure environment variables - name: Configure environment variables
run: | run: |
@ -52,7 +57,7 @@ jobs:
echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: Log debug information - name: Log debug information
run: | run: |
@ -66,23 +71,21 @@ jobs:
locale -a locale -a
- name: Install NodeJS - name: Install NodeJS
uses: actions/setup-node@v1 uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
with: with:
node-version: 14 node-version: 14
- name: Cache NodeJS modules - name: Cache NodeJS modules
uses: actions/cache@v2 uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
env: env:
cache-name: cache-node-modules cache-name: cache-node-modules
with: with:
# npm cache files are stored in `~/.npm` on Linux/macOS # npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install Dependencies - name: Install Dependencies
run: npx install-changed --install-command="npm ci" run: npm ci
- name: Build WordPress - name: Build WordPress
run: npm run build run: npm run build

View File

@ -1,16 +1,36 @@
name: JavaScript Tests name: JavaScript Tests
on: on:
# JavaScript testing was introduced in WordPress 3.8.
push: push:
branches: branches:
- master - master
# JavaScript testing was introduced in WordPress 3.8. - trunk
- '3.[89]' - '3.[89]'
- '[4-9].[0-9]' - '[4-9].[0-9]'
tags: tags:
- '3.[89]*' - '3.[89]*'
- '[4-9].[0-9]*' - '[4-9].[0-9]*'
pull_request: pull_request:
branches:
- master
- trunk
- '3.[89]'
- '[4-9].[0-9]'
paths:
# Any change to a JavaScript file should run tests.
- '**.js'
# These files configure NPM. Changes could affect the outcome.
- 'package*.json'
# This file configures ESLint. Changes could affect the outcome.
- '.eslintignore'
# This file configures JSHint. Changes could affect the outcome.
- '.jshintrc'
# Any change to the QUnit directory should run tests.
- 'tests/qunit/**'
# Changes to workflow files should always verify all workflows are successful.
- '.github/workflows/*.yml'
workflow_dispatch:
jobs: jobs:
# Runs the QUnit tests for WordPress. # Runs the QUnit tests for WordPress.
@ -33,12 +53,10 @@ jobs:
steps: steps:
- name: Cancel previous runs of this workflow (pull requests only) - name: Cancel previous runs of this workflow (pull requests only)
if: ${{ github.event_name == 'pull_request' }} if: ${{ github.event_name == 'pull_request' }}
uses: styfle/cancel-workflow-action@0.5.0 uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0
with:
access_token: ${{ github.token }}
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: Log debug information - name: Log debug information
run: | run: |
@ -48,20 +66,18 @@ jobs:
svn --version svn --version
- name: Install NodeJS - name: Install NodeJS
uses: actions/setup-node@v1 uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
with: with:
node-version: 14 node-version: 14
- name: Cache NodeJS modules - name: Cache NodeJS modules
uses: actions/cache@v2 uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
env: env:
cache-name: cache-node-modules cache-name: cache-node-modules
with: with:
# npm cache files are stored in `~/.npm` on Linux/macOS # npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Log debug information - name: Log debug information
run: | run: |
@ -69,7 +85,7 @@ jobs:
node --version node --version
- name: Install Dependencies - name: Install Dependencies
run: npx install-changed --install-command="npm ci" run: npm ci
- name: Run QUnit tests - name: Run QUnit tests
run: npm run grunt qunit:compiled run: npm run grunt qunit:compiled

View File

@ -1,16 +1,32 @@
name: PHP Compatibility name: PHP Compatibility
on: on:
# PHP compatibility testing was introduced in WordPress 5.5.
push: push:
branches: branches:
- master - master
# The PHP compatibility testing was introduced in WordPress 5.5. - trunk
- '5.[5-9]' - '5.[5-9]'
- '[6-9].[0-9]' - '[6-9].[0-9]'
tags: tags:
- '5.[5-9]*' - '5.[5-9]*'
- '[6-9].[0-9]*' - '[6-9].[0-9]*'
pull_request: pull_request:
branches:
- master
- trunk
- '5.[5-9]'
- '[6-9].[0-9]'
paths:
# This workflow only scans PHP files.
- '**.php'
# These files configure Composer. Changes could affect the outcome.
- 'composer.*'
# This file configures PHP Compatibility scanning. Changes could affect the outcome.
- 'phpcompat.xml.dist'
# Changes to workflow files should always verify all workflows are successful.
- '.github/workflows/*.yml'
workflow_dispatch:
jobs: jobs:
@ -34,10 +50,10 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: Set up PHP - name: Set up PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@afefcaf556d98dc7896cca380e181decb609ca44 # v2.10.0
with: with:
php-version: '7.4' php-version: '7.4'
coverage: none coverage: none
@ -49,7 +65,7 @@ jobs:
composer --version composer --version
- name: Install Composer dependencies - name: Install Composer dependencies
uses: ramsey/composer-install@v1 uses: ramsey/composer-install@92a7904348d4ad30236f3611e33b7f0c6f9edd70 # v1.1.0
with: with:
composer-options: "--no-progress --no-ansi --no-interaction" composer-options: "--no-progress --no-ansi --no-interaction"

View File

@ -4,12 +4,19 @@ on:
push: push:
branches: branches:
- master - master
- trunk
- '3.[7-9]' - '3.[7-9]'
- '[4-9].[0-9]' - '[4-9].[0-9]'
tags: tags:
- '3.[7-9]*' - '3.[7-9]*'
- '[4-9].[0-9]*' - '[4-9].[0-9]*'
pull_request: pull_request:
branches:
- master
- trunk
- '3.[7-9]'
- '[4-9].[0-9]'
workflow_dispatch:
# Once weekly On Sundays at 00:00 UTC. # Once weekly On Sundays at 00:00 UTC.
schedule: schedule:
- cron: '0 0 * * 0' - cron: '0 0 * * 0'
@ -21,6 +28,7 @@ env:
# Controls which NPM script to use for running PHPUnit tests. Options ar `php` and `php-composer`. # Controls which NPM script to use for running PHPUnit tests. Options ar `php` and `php-composer`.
PHPUNIT_SCRIPT: php PHPUNIT_SCRIPT: php
LOCAL_PHP_MEMCACHED: ${{ false }} LOCAL_PHP_MEMCACHED: ${{ false }}
SLOW_TESTS: 'external-http,media'
jobs: jobs:
# Sets up WordPress for testing or development use. # Sets up WordPress for testing or development use.
@ -43,12 +51,10 @@ jobs:
steps: steps:
- name: Cancel previous runs of this workflow (pull requests only) - name: Cancel previous runs of this workflow (pull requests only)
if: ${{ github.event_name == 'pull_request' }} if: ${{ github.event_name == 'pull_request' }}
uses: styfle/cancel-workflow-action@0.5.0 uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0
with:
access_token: ${{ github.token }}
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: Log debug information - name: Log debug information
run: | run: |
@ -64,35 +70,33 @@ jobs:
locale -a locale -a
- name: Install NodeJS - name: Install NodeJS
uses: actions/setup-node@v1 uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
with: with:
node-version: 14 node-version: 14
- name: Cache NodeJS modules - name: Cache NodeJS modules
uses: actions/cache@v2 uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
env: env:
cache-name: cache-node-modules cache-name: cache-node-modules
with: with:
# npm cache files are stored in `~/.npm` on Linux/macOS # npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install Dependencies - name: Install Dependencies
run: npx install-changed --install-command="npm ci" run: npm ci
- name: Build WordPress - name: Build WordPress
run: npm run build run: npm run build
- name: Create ZIP artifact - name: Create ZIP artifact
uses: thedoctor0/zip-release@0.4.1 uses: thedoctor0/zip-release@a1afcab9c664c9976ac398fa831eac67bed1eb0e # v0.4.1
with: with:
filename: built-wp-${{ github.sha }}.zip filename: built-wp-${{ github.sha }}.zip
exclusions: '*.git* /*node_modules/* packagehash.txt' exclusions: '*.git* /*node_modules/* packagehash.txt'
- name: Upload build artifact - name: Upload build artifact
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2
with: with:
name: built-wp-${{ github.sha }} name: built-wp-${{ github.sha }}
path: built-wp-${{ github.sha }}.zip path: built-wp-${{ github.sha }}.zip
@ -124,32 +128,50 @@ jobs:
# - Submit the test results to the WordPress.org host test results. # - Submit the test results to the WordPress.org host test results.
# - todo: Configure Slack notifications for failing tests. # - todo: Configure Slack notifications for failing tests.
test-php: test-php:
name: ${{ matrix.php }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }} name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }} ${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
needs: setup-wordpress needs: setup-wordpress
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false
matrix: matrix:
php: [ '5.6' ] php: [ '5.3', '5.4', '5.5' ]
phpunit: [ '4-php-5.6' ]
os: [ ubuntu-latest ] os: [ ubuntu-latest ]
memcached: [ false ] memcached: [ false ]
split_slow: [ false, true ]
multisite: [ false, true ]
include: include:
- php: '5.5' # Additional "slow" jobs for PHP 5.6.
phpunit: '5.5' - php: '5.6'
phpunit: '4-php-5.6'
os: ubuntu-latest os: ubuntu-latest
memcached: false memcached: false
- php: '5.4' multisite: false
phpunit: '5.4' split_slow: true
- php: '5.6'
phpunit: '4-php-5.6'
os: ubuntu-latest os: ubuntu-latest
memcached: false memcached: false
- php: '5.3' multisite: true
phpunit: '5.3' split_slow: true
# Include job for specific PHPUnit versions.
- php: '5.6'
phpunit: '4-php-5.6'
os: ubuntu-latest os: ubuntu-latest
memcached: false memcached: false
multisite: false
split_slow: false
- php: '5.6'
phpunit: '4-php-5.6'
os: ubuntu-latest
memcached: false
multisite: true
split_slow: false
env: env:
LOCAL_PHP: ${{ matrix.php }}-fpm LOCAL_PHP: ${{ matrix.php }}-fpm
LOCAL_PHPUNIT: ${{ matrix.phpunit }}-fpm LOCAL_PHPUNIT: ${{ matrix.phpunit && matrix.phpunit || matrix.php }}-fpm
LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }} LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }}
PHPUNIT_CONFIG: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
steps: steps:
- name: Configure environment variables - name: Configure environment variables
@ -158,7 +180,7 @@ jobs:
echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
- name: Download the built WordPress artifact - name: Download the built WordPress artifact
uses: actions/download-artifact@v2 uses: actions/download-artifact@4a7a711286f30c025902c28b541c10e147a9b843 # v2.0.8
with: with:
name: built-wp-${{ github.sha }} name: built-wp-${{ github.sha }}
@ -166,34 +188,30 @@ jobs:
run: unzip built-wp-${{ github.sha }}.zip run: unzip built-wp-${{ github.sha }}.zip
- name: Install NodeJS - name: Install NodeJS
uses: actions/setup-node@v1 uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
with: with:
node-version: 14 node-version: 14
- name: Use cached Node modules - name: Use cached Node modules
uses: actions/cache@v2 uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
env: env:
cache-name: cache-node-modules cache-name: cache-node-modules
with: with:
# npm cache files are stored in `~/.npm` on Linux/macOS # npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install Dependencies - name: Install Dependencies
run: npx install-changed --install-command="npm ci" run: npm ci
- name: Cache Composer dependencies - name: Cache Composer dependencies
if: ${{ env.COMPOSER_INSTALL == true }} if: ${{ env.COMPOSER_INSTALL == true }}
uses: actions/cache@v2 uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
env: env:
cache-name: cache-composer-dependencies cache-name: cache-composer-dependencies
with: with:
path: ${{ steps.composer-cache.outputs.dir }} path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php }}-composer-
- name: Install Composer dependencies - name: Install Composer dependencies
if: ${{ env.COMPOSER_INSTALL == true }} if: ${{ env.COMPOSER_INSTALL == true }}
@ -239,24 +257,37 @@ jobs:
- name: Install WordPress - name: Install WordPress
run: npm run env:install run: npm run env:install
- name: Run slow PHPUnit tests
if: ${{ matrix.split_slow }}
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}
- name: Run PHPUnit tests for single site excluding slow tests
if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }}
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required
- name: Run PHPUnit tests for Multisite excluding slow tests
if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }}
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers
- name: Run PHPUnit tests - name: Run PHPUnit tests
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist if: ${{ matrix.php >= '7.0' }}
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }}
- name: Run AJAX tests - name: Run AJAX tests
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group ajax if: ${{ ! matrix.multisite && ! matrix.split_slow }}
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
- name: Run tests as a multisite install
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml
- name: Run ms-files tests as a multisite install - name: Run ms-files tests as a multisite install
if: ${{ matrix.multisite && ! matrix.split_slow }}
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files
- name: Run external HTTP tests - name: Run external HTTP tests
if: ${{ ! matrix.multisite && ! matrix.split_slow }}
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group external-http run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group external-http
- name: Checkout the WordPress Test Reporter - name: Checkout the WordPress Test Reporter
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }} if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }}
uses: actions/checkout@v2 uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
with: with:
repository: 'WordPress/phpunit-test-runner' repository: 'WordPress/phpunit-test-runner'
path: 'test-runner' path: 'test-runner'

159
.github/workflows/test-npm.yml vendored Normal file
View File

@ -0,0 +1,159 @@
name: Test NPM
on:
push:
branches:
- master
- trunk
- '3.[7-9]'
- '[4-9].[0-9]'
pull_request:
branches:
- master
- trunk
- '3.[7-9]'
- '[4-9].[0-9]'
paths:
# These files configure NPM. Changes could affect the outcome.
- 'package*.json'
# JavaScript files are built using NPM.
- '**.js'
# CSS and SCSS files are built using NPM.
- '**.scss'
- '**.css'
# Changes to workflow files should always verify all workflows are successful.
- '.github/workflows/**.yml'
workflow_dispatch:
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
jobs:
# Prepares the workflow.
#
# Performs the following steps:
# - Cancels all previous workflow runs for pull requests that have not completed.
prepare-workflow:
name: Prepare the workflow
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
steps:
- name: Cancel previous runs of this workflow (pull requests only)
if: ${{ github.event_name == 'pull_request' }}
uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0
# Verifies that installing NPM dependencies and building WordPress works as expected.
#
# Performs the following steps:
# - Checks out the repository.
# - Logs debug information about the runner container.
# - Installs NodeJS 14.
# - Sets up caching for NPM.
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
# - Builds WordPress to run from the `build` directory.
# - Cleans up after building WordPress to the `build` directory.
test-npm:
name: Test NPM on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
needs: prepare-workflow
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest ]
steps:
- name: Checkout repository
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: Log debug information
run: |
npm --version
node --version
curl --version
git --version
svn --version
- name: Install NodeJS
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
with:
node-version: 14
- name: Cache NodeJS modules (Ubuntu & MacOS)
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
if: ${{ matrix.os != 'windows-latest' }}
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
- name: Get NPM cache directory (Windows only)
if: ${{ matrix.os == 'windows-latest' }}
id: npm-cache
run: echo "::set-output name=dir::$(npm config get cache)"
- name: Cache NodeJS modules (Windows only)
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
if: ${{ matrix.os == 'windows-latest' }}
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
- name: Install Dependencies
run: npm ci
- name: Build WordPress
run: npm run build
- name: Clean after building
run: npm run grunt clean
# Verifies that installing NPM dependencies and building WordPress works as expected on MacOS.
#
# This is a separate job in order to that more strict conditions can be used.
#
# Performs the following steps:
# - Checks out the repository.
# - Logs debug information about the runner container.
# - Installs NodeJS 14.
# - Sets up caching for NPM.
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
# - Builds WordPress to run from the `build` directory.
# - Cleans up after building WordPress to the `build` directory.
test-npm-macos:
name: Test NPM on MacOS
runs-on: macos-latest
if: ${{ github.repository == 'WordPress/wordpress-develop' }}
needs: prepare-workflow
steps:
- name: Checkout repository
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: Log debug information
run: |
npm --version
node --version
curl --version
git --version
svn --version
- name: Install NodeJS
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
with:
node-version: 14
- name: Cache NodeJS modules
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
if: ${{ matrix.os != 'windows-latest' }}
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
- name: Install Dependencies
run: npm ci
- name: Build WordPress
run: npm run build
- name: Clean after building
run: npm run grunt clean

View File

@ -1,71 +0,0 @@
name: Test NPM on Windows
on:
push:
branches:
- master
- '3.[7-9]'
- '[4-9].[0-9]'
pull_request:
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
jobs:
# Verifies that installing NPM dependencies and building WordPress works on Windows.
#
# Performs the following steps:
# - Cancels all previous workflow runs for pull requests that have not completed.
# - Checks out the repository.
# - Logs debug information about the runner container.
# - Installs NodeJS 14.
# - Sets up caching for NPM.
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
# - Builds WordPress to run from the `build` directory.
test-npm:
name: Tests NPM on Windows
runs-on: windows-latest
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
steps:
- name: Cancel previous runs of this workflow (pull requests only)
if: ${{ github.event_name == 'pull_request' }}
uses: styfle/cancel-workflow-action@0.5.0
with:
access_token: ${{ github.token }}
- name: Checkout repository
uses: actions/checkout@v2
- name: Log debug information
run: |
npm --version
node --version
curl --version
git --version
svn --version
- name: Install NodeJS
uses: actions/setup-node@v1
with:
node-version: 14
- name: Get NPM cache directory
id: npm-cache
run: echo "::set-output name=dir::$(npm config get cache)"
- name: Cache NodeJS modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install Dependencies
run: npx install-changed --install-command="npm ci"
- name: Build WordPress
run: npm run build

View File

@ -11,7 +11,7 @@ jobs:
if: ${{ github.repository == 'WordPress/wordpress-develop' }} if: ${{ github.repository == 'WordPress/wordpress-develop' }}
steps: steps:
- uses: bubkoo/welcome-action@v1 - uses: bubkoo/welcome-action@8dbbac2540d155744c90e4e37da6b05ffc9c5e2c # v1.0.3
with: with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FIRST_PR_COMMENT: > FIRST_PR_COMMENT: >

590
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -25,12 +25,12 @@
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"dotenv-expand": "^5.1.0", "dotenv-expand": "^5.1.0",
"grunt": "~1.3.0", "grunt": "~1.3.0",
"grunt-browserify": "~5.3.0", "grunt-browserify": "~6.0.0",
"grunt-contrib-clean": "~2.0.0", "grunt-contrib-clean": "~2.0.0",
"grunt-contrib-compress": "~2.0.0", "grunt-contrib-compress": "~2.0.0",
"grunt-contrib-concat": "1.0.1", "grunt-contrib-concat": "1.0.1",
"grunt-contrib-copy": "~1.0.0", "grunt-contrib-copy": "~1.0.0",
"grunt-contrib-cssmin": "~3.0.0", "grunt-contrib-cssmin": "~4.0.0",
"grunt-contrib-imagemin": "~4.0.0", "grunt-contrib-imagemin": "~4.0.0",
"grunt-contrib-jshint": "3.0.0", "grunt-contrib-jshint": "3.0.0",
"grunt-contrib-qunit": "^4.0.0", "grunt-contrib-qunit": "^4.0.0",
@ -44,8 +44,8 @@
"grunt-rtlcss": "~2.0.2", "grunt-rtlcss": "~2.0.2",
"grunt-sass": "~3.1.0", "grunt-sass": "~3.1.0",
"matchdep": "~2.0.0", "matchdep": "~2.0.0",
"sass": "^1.32.6", "sass": "^1.32.8",
"wait-on": "5.2.1" "wait-on": "^5.3.0"
}, },
"scripts": { "scripts": {
"build": "grunt build", "build": "grunt build",