Build/Test Tools: Improve the clarity for PHPUnit workflow strategy.
This change makes better use of the job strategy matrix for workflows. By using `include`, the memcached and test reporting job can be configured more clearly. Props ocean90. See #50401. git-svn-id: https://develop.svn.wordpress.org/trunk@49204 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c25f1719bf
commit
6c31412a70
30
.github/workflows/phpunit-tests.yml
vendored
30
.github/workflows/phpunit-tests.yml
vendored
@ -112,15 +112,27 @@ jobs:
|
|||||||
# - Reports test results to the Distributed Hosting Tests.
|
# - Reports test results to the Distributed Hosting Tests.
|
||||||
# - todo: Configure Slack notifications for failing tests.
|
# - todo: Configure Slack notifications for failing tests.
|
||||||
test-php:
|
test-php:
|
||||||
name: ${{ matrix.php_versions }} on ${{ matrix.os }}
|
name: ${{ matrix.php }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
|
||||||
needs: setup-wordpress
|
needs: setup-wordpress
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
php_versions: [ '8.0', 7.4, '7.4 with memcached', 7.3, 7.2, 7.1, '7.0', 5.6.20 ]
|
php: [ '8.0', '7.4', '7.3', '7.2', '7.1', '7.0', '5.6.20' ]
|
||||||
os: [ ubuntu-latest ]
|
os: [ ubuntu-latest ]
|
||||||
|
memcached: [ false ]
|
||||||
|
include:
|
||||||
|
# Include job for PHP 7.4 with memcached.
|
||||||
|
- php: '7.4'
|
||||||
|
os: ubuntu-latest
|
||||||
|
memcached: true
|
||||||
|
# Report the results of the PHP 7.4 without memcached job.
|
||||||
|
- php: '7.4'
|
||||||
|
os: ubuntu-latest
|
||||||
|
memcached: false
|
||||||
|
report: true
|
||||||
env:
|
env:
|
||||||
LOCAL_PHP: ${{ matrix.php_versions }}-fpm
|
LOCAL_PHP: ${{ matrix.php }}-fpm
|
||||||
|
LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Configure environment variables
|
- name: Configure environment variables
|
||||||
@ -128,12 +140,6 @@ jobs:
|
|||||||
echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
|
echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
|
||||||
echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
|
echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Configure memcached
|
|
||||||
if: ${{ contains( matrix.php_versions, 'memcached' ) }}
|
|
||||||
run: |
|
|
||||||
echo "LOCAL_PHP=$(echo ${{ matrix.php_versions }} | cut -c1-3)-fpm" >> $GITHUB_ENV
|
|
||||||
echo "LOCAL_PHP_MEMCACHED=true" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Download the built WordPress artifact
|
- name: Download the built WordPress artifact
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
@ -203,7 +209,7 @@ jobs:
|
|||||||
|
|
||||||
# The memcached server needs to start after the Docker network has been set up with `npm run env:start`.
|
# The memcached server needs to start after the Docker network has been set up with `npm run env:start`.
|
||||||
- name: Start the Memcached server.
|
- name: Start the Memcached server.
|
||||||
if: ${{ contains( matrix.php_versions, 'memcached' ) }}
|
if: ${{ matrix.memcached }}
|
||||||
run: |
|
run: |
|
||||||
cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php
|
cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php
|
||||||
docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached
|
docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached
|
||||||
@ -241,7 +247,7 @@ jobs:
|
|||||||
- name: Run tests as a multisite install
|
- name: Run tests as a multisite install
|
||||||
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml
|
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml
|
||||||
|
|
||||||
- name: Run mutlisite file tests
|
- name: Run ms-files tests as a multisite install
|
||||||
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
|
||||||
@ -258,7 +264,7 @@ jobs:
|
|||||||
run: LOCAL_PHP_XDEBUG=true npm run test:php -- -v --group xdebug --exclude-group __fakegroup__
|
run: LOCAL_PHP_XDEBUG=true npm run test:php -- -v --group xdebug --exclude-group __fakegroup__
|
||||||
|
|
||||||
- name: WordPress Test Reporter
|
- name: WordPress Test Reporter
|
||||||
if: ${{ matrix.php_versions == '7.4' }}
|
if: ${{ matrix.report }}
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
repository: 'WordPress/phpunit-test-runner'
|
repository: 'WordPress/phpunit-test-runner'
|
||||||
|
Loading…
Reference in New Issue
Block a user