WordPress.org

Make WordPress Core

Changeset 49204


Ignore:
Timestamp:
10/19/2020 06:22:21 PM (6 weeks ago)
Author:
desrosj
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/phpunit-tests.yml

    r49168 r49204  
    113113  # - todo: Configure Slack notifications for failing tests.
    114114  test-php:
    115     name: ${{ matrix.php_versions }} on ${{ matrix.os }}
     115    name: ${{ matrix.php }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
    116116    needs: setup-wordpress
    117117    runs-on: ${{ matrix.os }}
    118118    strategy:
    119119      matrix:
    120         php_versions: [ '8.0', 7.4, '7.4 with memcached', 7.3, 7.2, 7.1, '7.0', 5.6.20 ]
     120        php: [ '8.0', '7.4', '7.3', '7.2', '7.1', '7.0', '5.6.20' ]
    121121        os: [ ubuntu-latest ]
     122        memcached: [ false ]
     123        include:
     124          # Include job for PHP 7.4 with memcached.
     125          - php: '7.4'
     126            os: ubuntu-latest
     127            memcached: true
     128          # Report the results of the PHP 7.4 without memcached job.
     129          - php: '7.4'
     130            os: ubuntu-latest
     131            memcached: false
     132            report: true
    122133    env:
    123       LOCAL_PHP: ${{ matrix.php_versions }}-fpm
     134      LOCAL_PHP: ${{ matrix.php }}-fpm
     135      LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }}
    124136
    125137    steps:
     
    128140          echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
    129141          echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
    130 
    131       - name: Configure memcached
    132         if: ${{ contains( matrix.php_versions, 'memcached' ) }}
    133         run: |
    134           echo "LOCAL_PHP=$(echo ${{ matrix.php_versions }} | cut -c1-3)-fpm" >> $GITHUB_ENV
    135           echo "LOCAL_PHP_MEMCACHED=true" >> $GITHUB_ENV
    136142
    137143      - name: Download the built WordPress artifact
     
    204210      # The memcached server needs to start after the Docker network has been set up with `npm run env:start`.
    205211      - name: Start the Memcached server.
    206         if: ${{ contains( matrix.php_versions, 'memcached' ) }}
     212        if: ${{ matrix.memcached }}
    207213        run: |
    208214          cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php
     
    242248        run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml
    243249
    244       - name: Run mutlisite file tests
     250      - name: Run ms-files tests as a multisite install
    245251        run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files
    246252
     
    259265
    260266      - name: WordPress Test Reporter
    261         if: ${{ matrix.php_versions == '7.4' }}
     267        if: ${{ matrix.report }}
    262268        uses: actions/checkout@v2
    263269        with:
Note: See TracChangeset for help on using the changeset viewer.