Changeset 58626 for branches/5.1/.github/workflows/phpunit-tests.yml
- Timestamp:
- 07/02/2024 07:43:50 PM (23 months ago)
- Location:
- branches/5.1
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
.github/workflows/phpunit-tests.yml (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/5.1
- Property svn:mergeinfo changed
/trunk merged: 49264,51673,52179,53552,53895,56464,57124-57125,57249,57918,58157
- Property svn:mergeinfo changed
-
branches/5.1/.github/workflows/phpunit-tests.yml
r55524 r58626 22 22 # Cancels all previous workflow runs for pull requests that have not completed. 23 23 concurrency: 24 # The concurrency group contains the workflow name and the branch name for pull requests25 # or the commit hash for any other events.24 # The concurrency group contains the workflow name and the branch name for pull requests 25 # or the commit hash for any other events. 26 26 group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} 27 27 cancel-in-progress: true 28 28 29 env: 30 LOCAL_DIR: build 31 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }} 32 COMPOSER_INSTALL: ${{ false }} 33 # Controls which npm script to use for running PHPUnit tests. Options ar `php` and `php-composer`. 34 PHPUNIT_SCRIPT: php 35 LOCAL_PHP_MEMCACHED: ${{ false }} 36 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: {} 37 32 38 33 jobs: 39 # Sets up WordPress for testing or development use.40 34 # 41 # Performs the following steps: 42 # - Cancels all previous workflow runs for pull requests that have not completed. 43 # - Checks out the repository. 44 # - Logs debug information about the GitHub Action runner. 45 # - Installs NodeJS. 46 # _ Installs npm dependencies. 47 # - Builds WordPress to run from the `build` directory. 48 # - Creates a ZIP file of compiled WordPress. 49 # - Uploads ZIP file as an artifact. 50 setup-wordpress: 51 name: Setup WordPress 52 runs-on: ubuntu-latest 35 # Creates a PHPUnit test job for each PHP combination. 36 # 37 test-php: 38 name: PHP ${{ matrix.php }} 39 uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests-v1.yml@trunk 40 permissions: 41 contents: read 42 secrets: inherit 53 43 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} 54 55 steps:56 - name: Checkout repository57 uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.058 59 - name: Log debug information60 run: |61 echo "$GITHUB_REF"62 echo "$GITHUB_EVENT_NAME"63 npm --version64 node --version65 curl --version66 git --version67 svn --version68 php --version69 php -i70 locale -a71 72 - name: Set up Node.js73 uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.074 with:75 node-version-file: '.nvmrc'76 cache: npm77 78 - name: Install Dependencies79 run: npm ci80 81 - name: Build WordPress82 run: npm run build83 84 - name: Create ZIP artifact85 uses: thedoctor0/zip-release@a24011d8d445e4da5935a7e73c1f98e22a439464 # v0.7.186 with:87 filename: built-wp-${{ github.sha }}.zip88 exclusions: '*.git* /*node_modules/* packagehash.txt'89 90 - name: Upload build artifact91 uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.292 with:93 name: built-wp-${{ github.sha }}94 path: built-wp-${{ github.sha }}.zip95 if-no-files-found: error96 97 # Runs the PHPUnit tests for WordPress.98 #99 # Performs the following steps:100 # - Sets environment variables.101 # - Sets up the environment variables needed for testing with memcached (if desired).102 # - Downloads the built WordPress artifact from the previous job.103 # - Unzips the artifact.104 # - Installs NodeJS.105 # _ Installs npm dependencies.106 # - Configures caching for Composer.107 # _ Installs Composer dependencies (if desired).108 # - Logs Docker debug information (about the Docker installation within the runner).109 # - Starts the WordPress Docker container.110 # - Starts the Memcached server after the Docker network has been created (if desired).111 # - Logs general debug information about the runner.112 # - Logs the running Docker containers.113 # - Logs debug information from inside the WordPress Docker container.114 # - Logs debug information about what's installed within the WordPress Docker containers.115 # - Install WordPress within the Docker container.116 # - Run the PHPUnit tests.117 # - Checks out the WordPress Test reporter repository.118 # - Reconnect the directory to the Git repository.119 # - Submit the test results to the WordPress.org host test results.120 test-php:121 name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}122 needs: setup-wordpress123 runs-on: ${{ matrix.os }}124 timeout-minutes: 20125 44 strategy: 126 45 fail-fast: false 127 46 matrix: 47 os: [ ubuntu-latest ] 128 48 php: [ '5.3', '5.4', '5.5', '7.1', '7.2', '7.3' ] 129 os: [ ubuntu-latest ]130 memcached: [ false ]131 49 split_slow: [ false ] 132 50 multisite: [ false, true ] 51 memcached: [ false ] 52 133 53 include: 134 54 # Include jobs for PHP 7.3 with memcached. … … 143 63 split_slow: false 144 64 multisite: true 145 # Include jobs when specific PHPUnit versions are required.65 # Include jobs that require specific versions of PHPUnit. 146 66 - php: '7.0' 147 67 phpunit: '6-php-7.0' 148 68 os: ubuntu-latest 149 69 memcached: false 70 split_slow: false 150 71 multisite: false 151 72 - php: '7.0' … … 153 74 os: ubuntu-latest 154 75 memcached: false 76 split_slow: false 155 77 multisite: true 156 78 - php: '5.6' … … 158 80 os: ubuntu-latest 159 81 memcached: false 82 split_slow: false 160 83 multisite: false 161 84 - php: '5.6' … … 163 86 os: ubuntu-latest 164 87 memcached: false 88 split_slow: false 165 89 multisite: true 166 90 # Additional "slow" jobs for PHP <= 5.6. … … 207 131 split_slow: true 208 132 multisite: true 209 210 env: 211 LOCAL_PHP: ${{ matrix.php }}-fpm 212 LOCAL_PHPUNIT: ${{ matrix.phpunit && matrix.phpunit || matrix.php }}-fpm 213 LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }} 214 PHPUNIT_CONFIG: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }} 215 216 steps: 217 - name: Configure environment variables 218 run: | 219 echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV 220 echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV 221 222 - name: Download the built WordPress artifact 223 uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 224 with: 225 name: built-wp-${{ github.sha }} 226 227 - name: Unzip built artifact 228 run: unzip built-wp-${{ github.sha }}.zip 229 230 - name: Set up Node.js 231 uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 232 with: 233 node-version-file: '.nvmrc' 234 cache: npm 235 236 - name: Install Dependencies 237 run: npm ci 238 239 - name: Cache Composer dependencies 240 if: ${{ env.COMPOSER_INSTALL == true }} 241 uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6 242 env: 243 cache-name: cache-composer-dependencies 244 with: 245 path: ${{ steps.composer-cache.outputs.dir }} 246 key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} 247 248 - name: Install Composer dependencies 249 if: ${{ env.COMPOSER_INSTALL == true }} 250 run: | 251 docker-compose run --rm php composer --version 252 docker-compose run --rm php composer install 253 254 - name: Docker debug information 255 run: | 256 docker -v 257 docker-compose -v 258 259 - name: Start Docker environment 260 run: | 261 npm run env:start 262 263 # The memcached server needs to start after the Docker network has been set up with `npm run env:start`. 264 - name: Start the Memcached server. 265 if: ${{ matrix.memcached }} 266 run: | 267 cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php 268 docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached 269 270 - name: General debug information 271 run: | 272 npm --version 273 node --version 274 curl --version 275 git --version 276 svn --version 277 278 - name: Log running Docker containers 279 run: docker ps -a 280 281 - name: WordPress Docker container debug information 282 run: | 283 docker-compose run --rm mysql mysql --version 284 docker-compose run --rm php php --version 285 docker-compose run --rm php php -m 286 docker-compose run --rm php php -i 287 docker-compose run --rm php locale -a 288 289 - name: Install WordPress 290 run: npm run env:install 291 292 - name: Run slow PHPUnit tests 293 if: ${{ matrix.split_slow }} 294 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }} 295 296 - name: Run PHPUnit tests for single site excluding slow tests 297 if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }} 298 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required 299 300 - name: Run PHPUnit tests for Multisite excluding slow tests 301 if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }} 302 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers 303 304 - name: Run PHPUnit tests 305 if: ${{ matrix.php >= '7.0' }} 306 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} 307 308 - name: Run AJAX tests 309 if: ${{ ! matrix.multisite && ! matrix.split_slow }} 310 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax 311 312 - name: Run ms-files tests as a multisite install 313 if: ${{ matrix.multisite && ! matrix.split_slow }} 314 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files 315 316 - name: Run external HTTP tests 317 if: ${{ ! matrix.multisite && ! matrix.split_slow }} 318 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group external-http 319 320 - name: Checkout the WordPress Test Reporter 321 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }} 322 uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 323 with: 324 repository: 'WordPress/phpunit-test-runner' 325 path: 'test-runner' 326 327 - name: Set up the Git repository 328 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }} 329 run: | 330 git init 331 git remote add origin https://github.com/WordPress/wordpress-develop.git 332 git fetch 333 git reset origin/trunk 334 335 - name: Submit test results to the WordPress.org host test results 336 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }} 337 env: 338 WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}" 339 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 133 with: 134 os: ${{ matrix.os }} 135 php: ${{ matrix.php }} 136 phpunit: ${{ matrix.phpunit && matrix.phpunit || matrix.php }} 137 multisite: ${{ matrix.multisite }} 138 split_slow: ${{ matrix.split_slow }} 139 memcached: ${{ matrix.memcached }} 140 phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }} 340 141 341 142 slack-notifications: 342 143 name: Slack Notifications 343 144 uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk 344 needs: [ setup-wordpress, test-php ] 145 permissions: 146 actions: read 147 contents: read 148 needs: [ test-php ] 345 149 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} 346 150 with: … … 355 159 name: Failed workflow tasks 356 160 runs-on: ubuntu-latest 161 permissions: 162 actions: write 357 163 needs: [ test-php, slack-notifications ] 358 164 if: | … … 367 173 steps: 368 174 - name: Dispatch workflow run 369 uses: actions/github-script@ 98814c53be79b1d30f795b907e553d8679345975 # v6.4.0175 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 370 176 with: 371 177 retries: 2
Note: See TracChangeset
for help on using the changeset viewer.