Changeset 58625 for branches/5.2/.github/workflows/phpunit-tests.yml
- Timestamp:
- 07/02/2024 07:23:50 PM (9 months ago)
- Location:
- branches/5.2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.2
- Property svn:mergeinfo changed
/trunk merged: 49264,51673,52179,53552,53895,56464,57124-57125,57249,57918,58157
- Property svn:mergeinfo changed
-
branches/5.2/.github/workflows/phpunit-tests.yml
r55523 r58625 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: 43 fail-fast: false 64 44 matrix: 45 os: [ ubuntu-latest ] 65 46 php: [ '5.6', '7.0', '7.1', '7.2', '7.3' ] 66 os: [ ubuntu-latest ] 47 multisite: [ false, true ] 48 split_slow: [ false ] 67 49 memcached: [ false ] 68 split_slow: [ false ]69 multisite: [ false, true ]70 50 include: 71 51 # Additional "slow" jobs for PHP 5.6. 72 - php: '5.6 .20'52 - php: '5.6' 73 53 os: ubuntu-latest 74 54 memcached: false 75 55 multisite: false 76 56 split_slow: true 77 - php: '5.6 .20'57 - php: '5.6' 78 58 os: ubuntu-latest 79 59 memcached: false … … 85 65 memcached: true 86 66 multisite: false 67 split_slow: false 87 68 - php: '7.3' 88 69 os: ubuntu-latest 89 70 memcached: true 90 71 multisite: true 91 # Report the results of the PHP 7.3 without memcached job. 92 - php: '7.3' 93 os: ubuntu-latest 94 memcached: false 95 multisite: false 96 report: true 97 env: 98 LOCAL_PHP: ${{ matrix.php }}-fpm 99 LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }} 100 PHPUNIT_CONFIG: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }} 101 102 steps: 103 - name: Configure environment variables 104 run: | 105 echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV 106 echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV 107 108 - name: Checkout repository 109 uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 110 111 - name: Install Node.js 112 uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 113 with: 114 node-version-file: '.nvmrc' 115 cache: npm 116 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 if [ ${{ env.LOCAL_PHP }} == '7.1-fpm' ]; then 136 docker-compose run --rm php composer update 137 git checkout -- composer.lock 138 elif [[ ${{ env.LOCAL_PHP }} == '5.6.20-fpm' || ${{ env.LOCAL_PHP }} == '5.6-fpm' || ${{ env.LOCAL_PHP }} == '7.0-fpm' ]]; then 139 docker-compose run --rm php composer require --dev phpunit/phpunit:"^5.7" --update-with-dependencies 140 git checkout -- composer.lock composer.json 141 else 142 docker-compose run --rm php composer install 143 fi 144 145 - name: Docker debug information 146 run: | 147 docker -v 148 docker-compose -v 149 150 - name: Start Docker environment 151 run: | 152 npm run env:start 153 154 # The memcached server needs to start after the Docker network has been set up with `npm run env:start`. 155 - name: Start the Memcached server. 156 if: ${{ matrix.memcached }} 157 run: | 158 cp tests/phpunit/includes/object-cache.php src/wp-content/object-cache.php 159 docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached 160 161 - name: General debug information 162 run: | 163 npm --version 164 node --version 165 curl --version 166 git --version 167 svn --version 168 169 - name: Log running Docker containers 170 run: docker ps -a 171 172 - name: WordPress Docker container debug information 173 run: | 174 docker-compose run --rm mysql mysql --version 175 docker-compose run --rm php php --version 176 docker-compose run --rm php php -m 177 docker-compose run --rm php php -i 178 docker-compose run --rm php locale -a 179 180 - name: Install WordPress 181 run: npm run env:install 182 183 - name: Run slow PHPUnit tests 184 if: ${{ matrix.split_slow }} 185 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }} 186 187 - name: Run PHPUnit tests for single site excluding slow tests 188 if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }} 189 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required 190 191 - name: Run PHPUnit tests for Multisite excluding slow tests 192 if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }} 193 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers 194 195 - name: Run PHPUnit tests 196 if: ${{ matrix.php >= '7.0' }} 197 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} 198 199 - name: Run AJAX tests 200 if: ${{ ! matrix.split_slow && ! matrix.multisite }} 201 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax 202 203 - name: Run tests as a multisite install 204 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml 205 206 - name: Run ms-files tests as a multisite install 207 if: ${{ matrix.multisite && ! matrix.split_slow }} 208 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files 209 210 - name: Run external HTTP tests 211 if: ${{ ! matrix.multisite && ! matrix.split_slow }} 212 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group external-http 213 214 - name: Checkout the WordPress Test Reporter 215 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }} 216 uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 217 with: 218 repository: 'WordPress/phpunit-test-runner' 219 path: 'test-runner' 220 221 - name: Submit test results to the WordPress.org host test results 222 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }} 223 env: 224 WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}" 225 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' }} 226 81 227 82 slack-notifications: 228 83 name: Slack Notifications 229 84 uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk 85 permissions: 86 actions: read 87 contents: read 230 88 needs: [ test-php ] 231 89 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} 232 90 with: 233 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' }} 234 92 secrets: 235 93 SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }} … … 241 99 name: Failed workflow tasks 242 100 runs-on: ubuntu-latest 243 needs: [ test-php, slack-notifications ] 101 permissions: 102 actions: write 103 needs: [ slack-notifications ] 244 104 if: | 245 105 always() && … … 248 108 github.run_attempt < 2 && 249 109 ( 250 needs.test-php.result == 'cancelled' || needs.test-php.result == 'failure' 110 contains( needs.*.result, 'cancelled' ) || 111 contains( needs.*.result, 'failure' ) 251 112 ) 252 113 253 114 steps: 254 115 - name: Dispatch workflow run 255 uses: actions/github-script@ 98814c53be79b1d30f795b907e553d8679345975 # v6.4.0116 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 256 117 with: 257 118 retries: 2
Note: See TracChangeset
for help on using the changeset viewer.