From 6c31412a70a4c1bab139851da043a870ecbc0da4 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 19 Oct 2020 18:22:21 +0000 Subject: [PATCH] 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 --- .github/workflows/phpunit-tests.yml | 30 +++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index 8db3446f44..b024a1979b 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -112,15 +112,27 @@ jobs: # - Reports test results to the Distributed Hosting Tests. # - todo: Configure Slack notifications for failing tests. test-php: - name: ${{ matrix.php_versions }} on ${{ matrix.os }} + name: ${{ matrix.php }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }} needs: setup-wordpress runs-on: ${{ matrix.os }} strategy: 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 ] + 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: - LOCAL_PHP: ${{ matrix.php_versions }}-fpm + LOCAL_PHP: ${{ matrix.php }}-fpm + LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }} steps: - name: Configure environment variables @@ -128,12 +140,6 @@ jobs: echo "PHP_FPM_UID=$(id -u)" >> $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 uses: actions/download-artifact@v2 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`. - name: Start the Memcached server. - if: ${{ contains( matrix.php_versions, 'memcached' ) }} + if: ${{ matrix.memcached }} run: | cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached @@ -241,7 +247,7 @@ jobs: - name: Run tests as a multisite install 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 - 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__ - name: WordPress Test Reporter - if: ${{ matrix.php_versions == '7.4' }} + if: ${{ matrix.report }} uses: actions/checkout@v2 with: repository: 'WordPress/phpunit-test-runner'