Changeset 58605 for branches/5.6/.github/workflows/phpunit-tests.yml
- Timestamp:
- 07/01/2024 05:51:16 PM (21 months ago)
- Location:
- branches/5.6
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
.github/workflows/phpunit-tests.yml (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/5.6
- Property svn:mergeinfo changed
/trunk merged: 51673,52179,53552,53895,56113-56114,56464,57124-57125,57249,57918,58157
- Property svn:mergeinfo changed
-
branches/5.6/.github/workflows/phpunit-tests.yml
r55519 r58605 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', '8.0' ] 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. … … 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 - name: Install npm dependencies 119 run: npm ci 120 121 - name: Get Composer cache directory 122 id: composer-cache 123 run: echo "composer_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT 124 125 - name: Cache Composer dependencies 126 uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3 127 env: 128 cache-name: cache-composer-dependencies 129 with: 130 path: ${{ steps.composer-cache.outputs.composer_dir }} 131 key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} 132 133 - name: Install Composer dependencies 134 run: | 135 docker-compose run --rm php composer --version 136 137 # The PHPUnit 7.x phar is not compatible with PHP 8 and won't be updated, 138 # as PHPUnit 7 is no longer supported. The Composer-installed PHPUnit should be 139 # used for PHP 8 testing instead. 140 if [ ${{ env.LOCAL_PHP }} == '8.0-fpm' ]; then 141 docker-compose run --rm php composer install --ignore-platform-reqs 142 echo "PHPUNIT_SCRIPT=php-composer" >> $GITHUB_ENV 143 elif [ ${{ env.LOCAL_PHP }} == '7.1-fpm' ]; then 144 docker-compose run --rm php composer update 145 git checkout -- composer.lock 146 elif [[ ${{ env.LOCAL_PHP }} == '5.6-fpm' || ${{ env.LOCAL_PHP }} == '7.0-fpm' ]]; then 147 docker-compose run --rm php composer require --dev phpunit/phpunit:"^5.7" --update-with-dependencies 148 git checkout -- composer.lock composer.json 149 else 150 docker-compose run --rm php composer install 151 fi 152 153 - name: Docker debug information 154 run: | 155 docker -v 156 docker-compose -v 157 158 - name: Start Docker environment 159 run: | 160 npm run env:start 161 162 # The memcached server needs to start after the Docker network has been set up with `npm run env:start`. 163 - name: Start the Memcached server. 164 if: ${{ matrix.memcached }} 165 run: | 166 cp tests/phpunit/includes/object-cache.php src/wp-content/object-cache.php 167 docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached 168 169 - name: General debug information 170 run: | 171 npm --version 172 node --version 173 curl --version 174 git --version 175 svn --version 176 177 - name: Log running Docker containers 178 run: docker ps -a 179 180 - name: WordPress Docker container debug information 181 run: | 182 docker-compose run --rm mysql mysql --version 183 docker-compose run --rm php php --version 184 docker-compose run --rm php php -m 185 docker-compose run --rm php php -i 186 docker-compose run --rm php locale -a 187 188 - name: Install WordPress 189 run: npm run env:install 190 191 - name: Run slow PHPUnit tests 192 if: ${{ matrix.split_slow }} 193 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }} 194 195 - name: Run PHPUnit tests for single site excluding slow tests 196 if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }} 197 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required 198 199 - name: Run PHPUnit tests for Multisite excluding slow tests 200 if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }} 201 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers 202 203 - name: Run PHPUnit tests 204 if: ${{ matrix.php >= '7.0' }} 205 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} 206 207 - name: Run AJAX tests 208 if: ${{ ! matrix.split_slow && ! matrix.multisite }} 209 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax 210 211 - name: Run ms-files tests as a multisite install 212 if: ${{ matrix.multisite && ! matrix.split_slow }} 213 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files 214 215 - name: Run external HTTP tests 216 if: ${{ ! matrix.multisite && ! matrix.split_slow }} 217 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group external-http 218 219 # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist. 220 - name: Run (xDebug) tests 221 if: ${{ ! matrix.split_slow }} 222 run: LOCAL_PHP_XDEBUG=true npm run test:${{ env.PHPUNIT_SCRIPT }} -- -v --group xdebug --exclude-group __fakegroup__ 223 224 - name: Checkout the WordPress Test Reporter 225 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }} 226 uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 227 with: 228 repository: 'WordPress/phpunit-test-runner' 229 path: 'test-runner' 230 231 - name: Submit test results to the WordPress.org host test results 232 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }} 233 env: 234 WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}" 235 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' }} 236 81 237 82 slack-notifications: 238 83 name: Slack Notifications 239 84 uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk 85 permissions: 86 actions: read 87 contents: read 240 88 needs: [ test-php ] 241 89 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} 242 90 with: 243 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' }} 244 92 secrets: 245 93 SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }} … … 251 99 name: Failed workflow tasks 252 100 runs-on: ubuntu-latest 253 needs: [ test-php, slack-notifications ] 101 permissions: 102 actions: write 103 needs: [ slack-notifications ] 254 104 if: | 255 105 always() && … … 258 108 github.run_attempt < 2 && 259 109 ( 260 needs.test-php.result == 'cancelled' || needs.test-php.result == 'failure' 110 contains( needs.*.result, 'cancelled' ) || 111 contains( needs.*.result, 'failure' ) 261 112 ) 262 113 263 114 steps: 264 115 - name: Dispatch workflow run 265 uses: actions/github-script@ 98814c53be79b1d30f795b907e553d8679345975 # v6.4.0116 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 266 117 with: 267 118 retries: 2
Note: See TracChangeset
for help on using the changeset viewer.