Changeset 58357 for branches/6.0/.github/workflows/phpunit-tests.yml
- Timestamp:
- 06/06/2024 03:27:31 PM (11 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/6.0/.github/workflows/phpunit-tests.yml
r55490 r58357 8 8 - '[4-9].[0-9]' 9 9 tags: 10 - ' 3.[7-9]*'11 - '[ 4-9].[0-9]*'10 - '[0-9]+.[0-9]' 11 - '[0-9]+.[0-9].[0-9]+' 12 12 pull_request: 13 13 branches: … … 27 27 cancel-in-progress: true 28 28 29 env: 30 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }} 31 LOCAL_PHP_MEMCACHED: ${{ false }}32 SLOW_TESTS: 'external-http,media,restapi' 29 # Disable permissions for all available scopes by default. 30 # Any needed permissions should be configured at the job level. 31 permissions: {} 32 33 33 34 34 jobs: 35 # Runs the PHPUnit tests for WordPress.36 35 # 37 # Note: Steps running tests for PHP 8.1 jobs are allowed to "continue-on-error". 38 # This prevents workflow runs from being marked as "failed" when only PHP 8.1 fails. 36 # Creates a PHPUnit test job for each PHP/MySQL combination. 39 37 # 40 # Performs the following steps:41 # - Sets environment variables.42 # - Checks out the repository.43 # - Sets up Node.js.44 # - Sets up PHP.45 # - Installs Composer dependencies.46 # - Installs npm dependencies47 # - Logs general debug information about the runner.48 # - Logs Docker debug information (about the Docker installation within the runner).49 # - Starts the WordPress Docker container.50 # - Logs the running Docker containers.51 # - Logs debug information about what's installed within the WordPress Docker containers.52 # - Install WordPress within the Docker container.53 # - Run the PHPUnit tests.54 # - Ensures version-controlled files are not modified or deleted.55 # - Checks out the WordPress Test reporter repository.56 # - Submit the test results to the WordPress.org host test results.57 38 test-php: 58 name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }} 59 runs-on: ${{ matrix.os }} 60 timeout-minutes: 20 39 name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }} 40 uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests.yml@trunk 41 permissions: 42 contents: read 43 secrets: inherit 61 44 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} 62 45 strategy: 63 46 fail-fast: false 64 47 matrix: 48 os: [ ubuntu-latest ] 65 49 php: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' ] 66 os: [ ubuntu-latest ] 50 db-type: [ 'mysql' ] 51 db-version: [ '5.7' ] 52 multisite: [ false, true ] 67 53 memcached: [ false ] 68 split_slow: [ false ] 69 multisite: [ false, true ] 54 70 55 include: 71 # Additional "slow" jobs for PHP 5.6. 72 - php: '5.6' 73 os: ubuntu-latest 56 # Allow PHP 8.1 tests to have errors. 57 - php: '8.1' 58 allow-errors: true 59 # Include jobs for PHP 7.4 with memcached. 60 - os: ubuntu-latest 61 php: '7.4' 62 db-type: 'mysql' 63 db-version: '5.7' 64 multisite: false 65 memcached: true 66 - os: ubuntu-latest 67 php: '7.4' 68 db-type: 'mysql' 69 db-version: '5.7' 70 multisite: true 71 memcached: true 72 # Report the results of the PHP 7.4 without memcached job. 73 - os: ubuntu-latest 74 php: '7.4' 75 db-type: 'mysql' 76 db-version: '5.7' 77 multisite: false 74 78 memcached: false 75 multisite: false76 split_slow: true77 - php: '5.6'78 os: ubuntu-latest79 memcached: false80 multisite: true81 split_slow: true82 # Include jobs for PHP 7.4 with memcached.83 - php: '7.4'84 os: ubuntu-latest85 memcached: true86 multisite: false87 - php: '7.4'88 os: ubuntu-latest89 memcached: true90 multisite: true91 # Report the results of the PHP 7.4 without memcached job.92 - php: '7.4'93 os: ubuntu-latest94 memcached: false95 multisite: false96 79 report: true 97 98 env: 99 LOCAL_PHP: ${{ matrix.php }}-fpm 100 LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }} 101 PHPUNIT_CONFIG: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }} 102 103 steps: 104 - name: Configure environment variables 105 run: | 106 echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV 107 echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV 108 109 - name: Checkout repository 110 uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 111 112 - name: Set up Node.js 113 uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 114 with: 115 node-version-file: '.nvmrc' 116 cache: npm 117 118 ## 119 # This allows Composer dependencies to be installed using a single step. 120 # 121 # Since the tests are currently run within the Docker containers where the PHP version varies, 122 # the same PHP version needs to be configured for the action runner machine so that the correct 123 # dependency versions are installed and cached. 124 ## 125 - name: Set up PHP 126 uses: shivammathur/setup-php@d30ad8b1843ace22e6698ab99bbafaa747b6bd0d # v2.24.0 127 with: 128 php-version: '${{ matrix.php }}' 129 coverage: none 130 131 # Since Composer dependencies are installed using `composer update` and no lock file is in version control, 132 # passing a custom cache suffix ensures that the cache is flushed at least once per week. 133 - name: Install Composer dependencies 134 uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0 135 with: 136 custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F") 137 138 - name: Install npm dependencies 139 run: npm ci 140 141 - name: General debug information 142 run: | 143 npm --version 144 node --version 145 curl --version 146 git --version 147 svn --version 148 composer --version 149 locale -a 150 151 - name: Docker debug information 152 run: | 153 docker -v 154 docker-compose -v 155 156 - name: Start Docker environment 157 run: | 158 npm run env:start 159 160 - name: Log running Docker containers 161 run: docker ps -a 162 163 - name: WordPress Docker container debug information 164 run: | 165 docker-compose run --rm mysql mysql --version 166 docker-compose run --rm php php --version 167 docker-compose run --rm php php -m 168 docker-compose run --rm php php -i 169 docker-compose run --rm php locale -a 170 171 - name: Install WordPress 172 run: npm run env:install 173 174 - name: Run slow PHPUnit tests 175 if: ${{ matrix.split_slow }} 176 run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }} 177 178 - name: Run PHPUnit tests for single site excluding slow tests 179 if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }} 180 run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required 181 182 - name: Run PHPUnit tests for Multisite excluding slow tests 183 if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }} 184 run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers 185 186 - name: Run PHPUnit tests 187 if: ${{ matrix.php >= '7.0' }} 188 continue-on-error: ${{ matrix.php == '8.1' }} 189 run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} 190 191 - name: Run AJAX tests 192 if: ${{ ! matrix.split_slow }} 193 continue-on-error: ${{ matrix.php == '8.1' }} 194 run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax 195 196 - name: Run ms-files tests as a multisite install 197 if: ${{ matrix.multisite && ! matrix.split_slow }} 198 continue-on-error: ${{ matrix.php == '8.1' }} 199 run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c tests/phpunit/multisite.xml --group ms-files 200 201 - name: Run external HTTP tests 202 if: ${{ ! matrix.multisite && ! matrix.split_slow }} 203 continue-on-error: ${{ matrix.php == '8.1' }} 204 run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group external-http 205 206 # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist. 207 - name: Run (xDebug) tests 208 if: ${{ ! matrix.split_slow }} 209 continue-on-error: ${{ matrix.php == '8.1' }} 210 run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__ 211 212 - name: Ensure version-controlled files are not modified or deleted 213 run: git diff --exit-code 214 215 - name: Checkout the WordPress Test Reporter 216 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }} 217 uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 218 with: 219 repository: 'WordPress/phpunit-test-runner' 220 path: 'test-runner' 221 222 - name: Submit test results to the WordPress.org host test results 223 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }} 224 env: 225 WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}" 226 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 80 with: 81 os: ${{ matrix.os }} 82 php: ${{ matrix.php }} 83 db-type: ${{ matrix.db-type }} 84 db-version: ${{ matrix.db-version }} 85 multisite: ${{ matrix.multisite }} 86 memcached: ${{ matrix.memcached }} 87 phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }} 88 report: ${{ matrix.report || false }} 89 allow-errors: ${{ matrix.allow-errors || false }} 227 90 228 91 slack-notifications: 229 92 name: Slack Notifications 230 93 uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk 94 permissions: 95 actions: read 96 contents: read 231 97 needs: [ test-php ] 232 98 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} … … 242 108 name: Failed workflow tasks 243 109 runs-on: ubuntu-latest 110 permissions: 111 actions: write 244 112 needs: [ test-php, slack-notifications ] 245 113 if: | … … 254 122 steps: 255 123 - name: Dispatch workflow run 256 uses: actions/github-script@ 98814c53be79b1d30f795b907e553d8679345975 # v6.4.0124 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 257 125 with: 258 126 retries: 2
Note: See TracChangeset
for help on using the changeset viewer.