Changeset 58611 for branches/5.4/.github/workflows/phpunit-tests.yml
- Timestamp:
- 07/01/2024 07:17:07 PM (5 months ago)
- Location:
- branches/5.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.4
- Property svn:mergeinfo changed
/trunk merged: 49264,51673,52179,53552,53895,56464,57124-57125,57249,57918,58157
- Property svn:mergeinfo changed
-
branches/5.4/.github/workflows/phpunit-tests.yml
r55521 r58611 27 27 cancel-in-progress: true 28 28 29 env: 30 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }} 31 # Controls which npm script to use for running PHPUnit tests. Options ar `php` and `php-composer`. 32 PHPUNIT_SCRIPT: php 33 LOCAL_PHP_MEMCACHED: ${{ false }} 34 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: {} 35 32 36 33 jobs: 37 # Runs the PHPUnit tests for WordPress. 38 # 39 # Performs the following steps: 40 # - Sets environment variables. 41 # - Sets up the environment variables needed for testing with memcached (if desired). 42 # - Installs Node.js. 43 # - Installs npm dependencies 44 # - Configures caching for Composer. 45 # - Installs Composer dependencies. 46 # - Logs Docker debug information (about the Docker installation within the runner). 47 # - Starts the WordPress Docker container. 48 # - Starts the Memcached server after the Docker network has been created (if desired). 49 # - Logs general debug information about the runner. 50 # - Logs the running Docker containers. 51 # - Logs debug information from inside the WordPress Docker container. 52 # - Logs debug information about what's installed within the WordPress Docker containers. 53 # - Install WordPress within the Docker container. 54 # - Run the PHPUnit tests. 55 # - Checks out the WordPress Test reporter repository. 56 # - Reconnect the directory to the Git repository. 57 # - Submit the test results to the WordPress.org host test results. 34 # Creates PHPUnit test jobs. 58 35 test-php: 59 name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }} 60 runs-on: ${{ matrix.os }} 61 timeout-minutes: 20 36 name: PHP ${{ matrix.php }} 37 uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests-v2.yml@trunk 38 permissions: 39 contents: read 40 secrets: inherit 62 41 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} 63 42 strategy: 64 43 fail-fast: false 65 44 matrix: 45 os: [ ubuntu-latest ] 66 46 php: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4' ] 67 os: [ ubuntu-latest ] 47 multisite: [ false, true ] 48 split_slow: [ false ] 68 49 memcached: [ false ] 69 split_slow: [ false ]70 multisite: [ false, true ]71 50 include: 72 51 # Additional "slow" jobs for PHP 5.6. 73 - php: '5.6 .20'52 - php: '5.6' 74 53 os: ubuntu-latest 75 54 memcached: false 76 55 multisite: false 77 56 split_slow: true 78 - php: '5.6 .20'57 - php: '5.6' 79 58 os: ubuntu-latest 80 59 memcached: false … … 86 65 memcached: true 87 66 multisite: false 67 split_slow: false 88 68 - php: '7.4' 89 69 os: ubuntu-latest 90 70 memcached: true 91 71 multisite: true 92 # Report the results of the PHP 7.4 without memcached job. 93 - php: '7.4' 94 os: ubuntu-latest 95 memcached: false 96 multisite: false 97 report: true 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: Install Node.js 113 uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 114 with: 115 node-version-file: '.nvmrc' 116 cache: npm 117 118 119 - name: Install npm dependencies 120 run: npm ci 121 122 - name: Get Composer cache directory 123 id: composer-cache 124 run: echo "composer_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT 125 126 - name: Cache Composer dependencies 127 uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 128 env: 129 cache-name: cache-composer-dependencies 130 with: 131 path: ${{ steps.composer-cache.outputs.composer_dir }} 132 key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} 133 134 - name: Install Composer dependencies 135 run: | 136 if [ ${{ env.LOCAL_PHP }} == '7.1-fpm' ]; then 137 docker-compose run --rm php composer update 138 git checkout -- composer.lock 139 elif [[ ${{ env.LOCAL_PHP }} == '5.6.20-fpm' || ${{ env.LOCAL_PHP }} == '5.6-fpm' || ${{ env.LOCAL_PHP }} == '7.0-fpm' ]]; then 140 docker-compose run --rm php composer require --dev phpunit/phpunit:"^5.7" --update-with-dependencies 141 git checkout -- composer.lock composer.json 142 else 143 docker-compose run --rm php composer install 144 fi 145 146 - name: Docker debug information 147 run: | 148 docker -v 149 docker-compose -v 150 151 - name: Start Docker environment 152 run: | 153 npm run env:start 154 155 # The memcached server needs to start after the Docker network has been set up with `npm run env:start`. 156 - name: Start the Memcached server. 157 if: ${{ matrix.memcached }} 158 run: | 159 cp tests/phpunit/includes/object-cache.php src/wp-content/object-cache.php 160 docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached 161 162 - name: General debug information 163 run: | 164 npm --version 165 node --version 166 curl --version 167 git --version 168 svn --version 169 170 - name: Log running Docker containers 171 run: docker ps -a 172 173 - name: WordPress Docker container debug information 174 run: | 175 docker-compose run --rm mysql mysql --version 176 docker-compose run --rm php php --version 177 docker-compose run --rm php php -m 178 docker-compose run --rm php php -i 179 docker-compose run --rm php locale -a 180 181 - name: Install WordPress 182 run: npm run env:install 183 184 - name: Run slow PHPUnit tests 185 if: ${{ matrix.split_slow }} 186 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }} 187 188 - name: Run PHPUnit tests for single site excluding slow tests 189 if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }} 190 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required 191 192 - name: Run PHPUnit tests for Multisite excluding slow tests 193 if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }} 194 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers 195 196 - name: Run PHPUnit tests 197 if: ${{ matrix.php >= '7.0' }} 198 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} 199 200 - name: Run AJAX tests 201 if: ${{ ! matrix.split_slow && ! matrix.multisite }} 202 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax 203 204 - name: Run ms-files tests as a multisite install 205 if: ${{ matrix.multisite && ! matrix.split_slow }} 206 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files 207 208 - name: Run external HTTP tests 209 if: ${{ ! matrix.multisite && ! matrix.split_slow }} 210 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group external-http 211 212 # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist. 213 - name: Run (xDebug) tests 214 if: ${{ ! matrix.split_slow }} 215 run: LOCAL_PHP_XDEBUG=true npm run test:${{ env.PHPUNIT_SCRIPT }} -- -v --group xdebug --exclude-group __fakegroup__ 216 217 - name: Checkout the WordPress Test Reporter 218 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }} 219 uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 220 with: 221 repository: 'WordPress/phpunit-test-runner' 222 path: 'test-runner' 223 224 - name: Submit test results to the WordPress.org host test results 225 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }} 226 env: 227 WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}" 228 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 72 split_slow: false 73 with: 74 os: ${{ matrix.os }} 75 php: ${{ matrix.php }} 76 multisite: ${{ matrix.multisite }} 77 split_slow: ${{ matrix.split_slow }} 78 test_ajax: ${{ ! matrix.multisite }} 79 memcached: ${{ matrix.memcached }} 80 phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }} 229 81 230 82 slack-notifications: 231 83 name: Slack Notifications 232 84 uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk 85 permissions: 86 actions: read 87 contents: read 233 88 needs: [ test-php ] 234 89 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} 235 90 with: 236 calling_status: ${{ needs.test-php.result == 'success' && 'success' || needs.test-php.result == 'cancelled' && 'cancelled' || 'failure' }}91 calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }} 237 92 secrets: 238 93 SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }} … … 244 99 name: Failed workflow tasks 245 100 runs-on: ubuntu-latest 246 needs: [ test-php, slack-notifications ] 101 permissions: 102 actions: write 103 needs: [ slack-notifications ] 247 104 if: | 248 105 always() && … … 251 108 github.run_attempt < 2 && 252 109 ( 253 needs.test-php.result == 'cancelled' || needs.test-php.result == 'failure' 110 contains( needs.*.result, 'cancelled' ) || 111 contains( needs.*.result, 'failure' ) 254 112 ) 255 113 256 114 steps: 257 115 - name: Dispatch workflow run 258 uses: actions/github-script@ 98814c53be79b1d30f795b907e553d8679345975 # v6.4.0116 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 259 117 with: 260 118 retries: 2
Note: See TracChangeset
for help on using the changeset viewer.