mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 12:58:25 +01:00
Build/Test Tools: Merge several automated testing improvements to the 5.6 branch.
This merges several refinements to GitHub Action workflow files to the 5.6 branch. It also includes [49836], which added the ability to replace `mysql` with `mariadb` when using the local Docker environment to ensure consistency of the tools across branches. Props johnbillion. Merges [49781-49784,49786,49836,49938,50268,50285] to the 5.6 branch. See #50401. git-svn-id: https://develop.svn.wordpress.org/branches/5.6@50296 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c96850536a
commit
7881f918b0
25
.env
25
.env
@ -45,8 +45,22 @@ LOCAL_PHP_XDEBUG=false
|
||||
# Whether or not to enable Memcached.
|
||||
LOCAL_PHP_MEMCACHED=false
|
||||
|
||||
# The MySQL version to use. See https://hub.docker.com/_/mysql/ for valid versions.
|
||||
LOCAL_MYSQL=5.7
|
||||
##
|
||||
# The database software to use.
|
||||
#
|
||||
# Supported values are `mysql` and `mariadb`.
|
||||
##
|
||||
LOCAL_DB_TYPE=mysql
|
||||
|
||||
##
|
||||
# The database version to use.
|
||||
#
|
||||
# Defaults to 5.7 with the assumption that LOCAL_DB_TYPE is set to `mysql` above.
|
||||
#
|
||||
# When using `mysql`, see https://hub.docker.com/_/mysql/ for valid versions.
|
||||
# When using `mariadb`, see https://hub.docker.com/_/mariadb for valid versions.
|
||||
##
|
||||
LOCAL_DB_VERSION=5.7
|
||||
|
||||
# The debug settings to add to `wp-config.php`.
|
||||
LOCAL_WP_DEBUG=true
|
||||
@ -57,3 +71,10 @@ LOCAL_WP_ENVIRONMENT_TYPE=local
|
||||
|
||||
# The URL to use when running e2e tests.
|
||||
WP_BASE_URL=http://localhost:${LOCAL_PORT}
|
||||
|
||||
##
|
||||
# The revision number of the WordPress Importer plugin to use when running unit tests.
|
||||
#
|
||||
# This should be an SVN revision number from the official plugin repository on wordpress.org.
|
||||
##
|
||||
WP_IMPORTER_REVISION=2387243
|
||||
|
37
.github/workflows/coding-standards.yml
vendored
37
.github/workflows/coding-standards.yml
vendored
@ -16,10 +16,10 @@ jobs:
|
||||
#
|
||||
# Performs the following steps:
|
||||
# - Checks out the repository.
|
||||
# - Configures caching for Composer.
|
||||
# - Sets up PHP.
|
||||
# - Logs debug information.
|
||||
# - Installs Composer dependencies (from cache if possible).
|
||||
# - Installs Composer dependencies (use cache if possible).
|
||||
# - Make Composer packages available globally.
|
||||
# - Logs PHP_CodeSniffer debug information.
|
||||
# - Runs PHPCS on the full codebase with warnings suppressed.
|
||||
# - Runs PHPCS on the `tests` directory without warnings suppressed.
|
||||
@ -27,24 +27,12 @@ jobs:
|
||||
phpcs:
|
||||
name: PHP coding standards
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Get Composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- name: Set up Composer caching
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-composer-dependencies
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-composer-
|
||||
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
@ -58,9 +46,12 @@ jobs:
|
||||
composer --version
|
||||
|
||||
- name: Install Composer dependencies
|
||||
run: |
|
||||
composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction
|
||||
echo "${PWD}/vendor/bin" >> $GITHUB_PATH
|
||||
uses: ramsey/composer-install@v1
|
||||
with:
|
||||
composer-options: "--no-progress --no-ansi --no-interaction"
|
||||
|
||||
- name: Make Composer packages available globally
|
||||
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Log PHPCS debug information
|
||||
run: phpcs -i
|
||||
@ -73,10 +64,12 @@ jobs:
|
||||
|
||||
# Runs the JavaScript coding standards checks.
|
||||
#
|
||||
# JSHint violations are not currently reported inline with annotations.
|
||||
#
|
||||
# Performs the following steps:
|
||||
# - Checks out the repository.
|
||||
# - Logs debug information about the runner container.
|
||||
# - Installs NodeJS 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches)
|
||||
# - Installs NodeJS 14.
|
||||
# - Sets up caching for NPM.
|
||||
# - Logs updated debug information.
|
||||
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
|
||||
@ -85,8 +78,10 @@ jobs:
|
||||
jshint:
|
||||
name: JavaScript coding standards
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
||||
env:
|
||||
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
@ -101,7 +96,7 @@ jobs:
|
||||
- name: Install NodeJS
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12
|
||||
node-version: 14
|
||||
|
||||
- name: Cache NodeJS modules
|
||||
uses: actions/cache@v2
|
||||
|
6
.github/workflows/javascript-tests.yml
vendored
6
.github/workflows/javascript-tests.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
||||
# - 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 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches).
|
||||
# - Installs NodeJS 14.
|
||||
# - Sets up caching for NPM.
|
||||
# - Logs updated debug information.
|
||||
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
|
||||
@ -23,6 +23,8 @@ jobs:
|
||||
test-js:
|
||||
name: QUnit Tests
|
||||
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' }}
|
||||
@ -43,7 +45,7 @@ jobs:
|
||||
- name: Install NodeJS
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12
|
||||
node-version: 14
|
||||
|
||||
- name: Cache NodeJS modules
|
||||
uses: actions/cache@v2
|
||||
|
28
.github/workflows/php-compatibility.yml
vendored
28
.github/workflows/php-compatibility.yml
vendored
@ -17,35 +17,22 @@ jobs:
|
||||
#
|
||||
# Performs the following steps:
|
||||
# - Checks out the repository.
|
||||
# - Configures caching for Composer.
|
||||
# - Sets up PHP.
|
||||
# - Logs debug information about the runner container.
|
||||
# - Installs Composer dependencies (from cache if possible).
|
||||
# - Installs Composer dependencies (use cache if possible).
|
||||
# - Make Composer packages available globally.
|
||||
# - Logs PHP_CodeSniffer debug information.
|
||||
# - Runs the PHP compatibility tests.
|
||||
# - todo: Configure Slack notifications for failing scans.
|
||||
php-comatibility:
|
||||
name: Check PHP compatibility
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Get Composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- name: Set up Composer caching
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-composer-dependencies
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-composer-
|
||||
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
@ -59,9 +46,12 @@ jobs:
|
||||
composer --version
|
||||
|
||||
- name: Install Composer dependencies
|
||||
run: |
|
||||
composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction
|
||||
echo "${PWD}/vendor/bin" >> $GITHUB_PATH
|
||||
uses: ramsey/composer-install@v1
|
||||
with:
|
||||
composer-options: "--no-progress --no-ansi --no-interaction"
|
||||
|
||||
- name: Make Composer packages available globally
|
||||
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Log PHPCS debug information
|
||||
run: phpcs -i
|
||||
|
41
.github/workflows/phpunit-tests.yml
vendored
41
.github/workflows/phpunit-tests.yml
vendored
@ -24,9 +24,8 @@ jobs:
|
||||
# Performs the following steps:
|
||||
# - Cancels all previous workflow runs for pull requests that have not completed.
|
||||
# - Checks out the repository.
|
||||
# - Checks out the WordPress Importer plugin (needed for the Core PHPUnit tests).
|
||||
# - Logs debug information about the runner container.
|
||||
# - Installs NodeJS 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches).
|
||||
# - 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.
|
||||
@ -35,6 +34,7 @@ jobs:
|
||||
setup-wordpress:
|
||||
name: Setup WordPress
|
||||
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)
|
||||
@ -46,9 +46,6 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Checkout the WordPress Importer plugin
|
||||
run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer
|
||||
|
||||
- name: Log debug information
|
||||
run: |
|
||||
echo "$GITHUB_REF"
|
||||
@ -65,7 +62,7 @@ jobs:
|
||||
- name: Install NodeJS
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12
|
||||
node-version: 14
|
||||
|
||||
- name: Cache NodeJS modules
|
||||
uses: actions/cache@v2
|
||||
@ -104,7 +101,7 @@ jobs:
|
||||
# - Sets up the environment variables needed for testing with memcached (if desired).
|
||||
# - Downloads the built WordPress artifact from the previous job.
|
||||
# - Unzips the artifact.
|
||||
# - Installs NodeJS 12 (todo: install the version of NPM specified in the `nvmrc` file to support older branches)
|
||||
# - Installs NodeJS 14.
|
||||
# - Sets up caching for NPM.
|
||||
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
|
||||
# - Configures caching for Composer.
|
||||
@ -118,7 +115,9 @@ jobs:
|
||||
# - Logs debug information about what's installed within the WordPress Docker containers.
|
||||
# - Install WordPress within the Docker container.
|
||||
# - Run the PHPUnit tests.
|
||||
# - Reports test results to the Distributed Hosting Tests.
|
||||
# - Checks out the WordPress Test reporter repository.
|
||||
# - Reconnect the directory to the Git repository.
|
||||
# - Submit the test results to the WordPress.org host test results.
|
||||
# - todo: Configure Slack notifications for failing tests.
|
||||
test-php:
|
||||
name: ${{ matrix.php }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
|
||||
@ -160,7 +159,7 @@ jobs:
|
||||
- name: Install NodeJS
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12
|
||||
node-version: 14
|
||||
|
||||
- name: Use cached Node modules
|
||||
uses: actions/cache@v2
|
||||
@ -188,9 +187,9 @@ jobs:
|
||||
cache-name: cache-composer-dependencies
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-composer-
|
||||
${{ runner.os }}-php-${{ matrix.php }}-composer-
|
||||
|
||||
- name: Install Composer dependencies
|
||||
if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm' }}
|
||||
@ -270,11 +269,23 @@ jobs:
|
||||
if: ${{ env.LOCAL_PHP != '8.0-fpm' }}
|
||||
run: LOCAL_PHP_XDEBUG=true npm run test:php -- -v --group xdebug --exclude-group __fakegroup__
|
||||
|
||||
- name: WordPress Test Reporter
|
||||
if: ${{ matrix.report }}
|
||||
- name: Checkout the WordPress Test Reporter
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }}
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: 'WordPress/phpunit-test-runner'
|
||||
path: 'test-runner'
|
||||
# TODO: Configure hidden keys to successfully report test results.
|
||||
# run: docker-compose run --rm -e WPT_REPORT_API_KEY -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php
|
||||
|
||||
- name: Set up the Git repository
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }}
|
||||
run: |
|
||||
git init
|
||||
git remote add origin https://github.com/WordPress/wordpress-develop.git
|
||||
git fetch
|
||||
git reset origin/master
|
||||
|
||||
- name: Submit test results to the WordPress.org host test results
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }}
|
||||
env:
|
||||
WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}"
|
||||
run: docker-compose run --rm -e WPT_REPORT_API_KEY -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php
|
||||
|
4
.github/workflows/verify-npm-on-windows.yml
vendored
4
.github/workflows/verify-npm-on-windows.yml
vendored
@ -17,13 +17,15 @@ jobs:
|
||||
# - 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 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches).
|
||||
# - 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' }}
|
||||
|
@ -8,6 +8,7 @@ jobs:
|
||||
# Comments on a pull request when the author is a new contributor.
|
||||
post-welcome-message:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' }}
|
||||
|
||||
steps:
|
||||
- uses: bubkoo/welcome-action@v1
|
||||
|
@ -53,7 +53,7 @@ services:
|
||||
# The MySQL container.
|
||||
##
|
||||
mysql:
|
||||
image: mysql:${LOCAL_MYSQL-latest}
|
||||
image: ${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-latest}
|
||||
|
||||
networks:
|
||||
- wpdevnet
|
||||
|
@ -20,6 +20,8 @@ wp_cli( `config set WP_ENVIRONMENT_TYPE ${process.env.LOCAL_WP_ENVIRONMENT_TYPE}
|
||||
// Move wp-config.php to the base directory, so it doesn't get mixed up in the src or build directories.
|
||||
renameSync( 'src/wp-config.php', 'wp-config.php' );
|
||||
|
||||
install_wp_importer();
|
||||
|
||||
// Read in wp-tests-config-sample.php, edit it to work with our config, then write it to wp-tests-config.php.
|
||||
const testConfig = readFileSync( 'wp-tests-config-sample.php', 'utf8' )
|
||||
.replace( 'youremptytestdbnamehere', 'wordpress_develop_tests' )
|
||||
@ -45,3 +47,12 @@ wait_on( { resources: [ `tcp:localhost:${process.env.LOCAL_PORT}`] } )
|
||||
function wp_cli( cmd ) {
|
||||
execSync( `docker-compose run --rm cli ${cmd}`, { stdio: 'inherit' } );
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads the WordPress Importer plugin for use in tests.
|
||||
*/
|
||||
function install_wp_importer() {
|
||||
const test_plugin_directory = 'tests/phpunit/data/plugins/wordpress-importer';
|
||||
|
||||
execSync( `docker-compose exec -T php rm -rf ${test_plugin_directory} && svn checkout -r ${process.env.WP_IMPORTER_REVISION} https://plugins.svn.wordpress.org/wordpress-importer/trunk/ ${test_plugin_directory}`, { stdio: 'inherit' } );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user