Changeset 50602 for branches/5.6/.github/workflows/phpunit-tests.yml
- Timestamp:
- 03/26/2021 05:21:35 PM (4 years ago)
- Location:
- branches/5.6
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.6
-
branches/5.6/.github/workflows/phpunit-tests.yml
r50301 r50602 5 5 branches: 6 6 - master 7 - trunk 7 8 - '3.[7-9]' 8 9 - '[4-9].[0-9]' … … 11 12 - '[4-9].[0-9]*' 12 13 pull_request: 14 branches: 15 - master 16 - trunk 17 - '3.[7-9]' 18 - '[4-9].[0-9]' 19 workflow_dispatch: 13 20 # Once weekly On Sundays at 00:00 UTC. 14 21 schedule: … … 16 23 17 24 env: 18 LOCAL_DIR: build19 25 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }} 20 26 COMPOSER_INSTALL: ${{ false }} … … 22 28 PHPUNIT_SCRIPT: php 23 29 LOCAL_PHP_MEMCACHED: ${{ false }} 30 SLOW_TESTS: 'external-http,media,restapi' 24 31 25 32 jobs: 26 # Sets up WordPress for testing or development use.33 # Sets up the workflow for testing. 27 34 # 28 35 # Performs the following steps: 29 36 # - Cancels all previous workflow runs for pull requests that have not completed. 30 # - Checks out the repository. 31 # - Logs debug information about the runner container. 32 # - Installs NodeJS 14. 33 # - Sets up caching for NPM. 34 # _ Installs NPM dependencies using install-changed to hash the `package.json` file. 35 # - Builds WordPress to run from the `build` directory. 36 # - Creates a ZIP file of compiled WordPress. 37 # - Uploads ZIP file as an artifact. 38 setup-wordpress: 39 name: Setup WordPress 37 setup-workflow: 38 name: Setup Workflow 40 39 runs-on: ubuntu-latest 41 40 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} … … 44 43 - name: Cancel previous runs of this workflow (pull requests only) 45 44 if: ${{ github.event_name == 'pull_request' }} 46 uses: styfle/cancel-workflow-action@0.5.0 47 with: 48 access_token: ${{ github.token }} 49 50 - name: Checkout repository 51 uses: actions/checkout@v2 52 53 - name: Log debug information 54 run: | 55 echo "$GITHUB_REF" 56 echo "$GITHUB_EVENT_NAME" 57 npm --version 58 node --version 59 curl --version 60 git --version 61 svn --version 62 php --version 63 php -i 64 locale -a 65 66 - name: Install NodeJS 67 uses: actions/setup-node@v1 68 with: 69 node-version: 14 70 71 - name: Cache NodeJS modules 72 uses: actions/cache@v2 73 env: 74 cache-name: cache-node-modules 75 with: 76 # npm cache files are stored in `~/.npm` on Linux/macOS 77 path: ~/.npm 78 key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} 79 restore-keys: | 80 ${{ runner.os }}-npm- 81 82 - name: Install Dependencies 83 run: npx install-changed --install-command="npm ci" 84 85 - name: Build WordPress 86 run: npm run build 87 88 - name: Create ZIP artifact 89 uses: thedoctor0/zip-release@0.4.1 90 with: 91 filename: built-wp-${{ github.sha }}.zip 92 exclusions: '*.git* /*node_modules/* packagehash.txt' 93 94 - name: Upload build artifact 95 uses: actions/upload-artifact@v2 96 with: 97 name: built-wp-${{ github.sha }} 98 path: built-wp-${{ github.sha }}.zip 99 if-no-files-found: error 45 uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0 100 46 101 47 # Runs the PHPUnit tests for WordPress. … … 104 50 # - Set environment variables. 105 51 # - Sets up the environment variables needed for testing with memcached (if desired). 106 # - Downloads the built WordPress artifact from the previous job.107 # - Unzips the artifact.108 52 # - Installs NodeJS 14. 109 53 # - Sets up caching for NPM. 110 # _ Installs NPM dependencies using install-changed to hash the `package.json` file.54 # - Installs NPM dependencies 111 55 # - Configures caching for Composer. 112 # _Installs Composer dependencies (if desired).56 # - Installs Composer dependencies (if desired). 113 57 # - Logs Docker debug information (about both the Docker installation within the runner). 114 58 # - Starts the WordPress Docker container. … … 125 69 # - todo: Configure Slack notifications for failing tests. 126 70 test-php: 127 name: ${{ matrix.php }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }} 128 needs: setup-wordpress 71 name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }} ${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }} 129 72 runs-on: ${{ matrix.os }} 130 73 strategy: 74 fail-fast: false 131 75 matrix: 132 php: [ ' 8.0', '7.4', '7.3', '7.2', '7.1', '7.0', '5.6.20' ]76 php: [ '5.6.20', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0' ] 133 77 os: [ ubuntu-latest ] 134 78 memcached: [ false ] 79 split_slow: [ false ] 80 multisite: [ false, true ] 135 81 include: 136 # Include job for PHP 7.4 with memcached. 82 # Additional "slow" jobs for PHP 5.6. 83 - php: '5.6.20' 84 os: ubuntu-latest 85 memcached: false 86 multisite: false 87 split_slow: true 88 - php: '5.6.20' 89 os: ubuntu-latest 90 memcached: false 91 multisite: true 92 split_slow: true 93 # Include jobs for PHP 7.4 with memcached. 137 94 - php: '7.4' 138 95 os: ubuntu-latest 139 96 memcached: true 97 multisite: false 98 - php: '7.4' 99 os: ubuntu-latest 100 memcached: true 101 multisite: true 140 102 # Report the results of the PHP 7.4 without memcached job. 141 103 - php: '7.4' 142 104 os: ubuntu-latest 143 105 memcached: false 106 multisite: false 144 107 report: true 145 108 env: 146 109 LOCAL_PHP: ${{ matrix.php }}-fpm 147 110 LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }} 111 PHPUNIT_CONFIG: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }} 148 112 149 113 steps: … … 153 117 echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV 154 118 155 - name: Download the built WordPress artifact 156 uses: actions/download-artifact@v2 157 with: 158 name: built-wp-${{ github.sha }} 159 160 - name: Unzip built artifact 161 run: unzip built-wp-${{ github.sha }}.zip 119 - name: Checkout repository 120 uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 162 121 163 122 - name: Install NodeJS 164 uses: actions/setup-node@ v1123 uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 165 124 with: 166 125 node-version: 14 167 126 168 127 - name: Use cached Node modules 169 uses: actions/cache@ v2128 uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 170 129 env: 171 130 cache-name: cache-node-modules … … 174 133 path: ~/.npm 175 134 key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} 176 restore-keys: |177 ${{ runner.os }}-npm-178 135 179 136 - name: Install Dependencies 180 run: np x install-changed --install-command="npm ci"137 run: npm ci 181 138 182 139 - name: Get composer cache directory … … 187 144 - name: Cache Composer dependencies 188 145 if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm' }} 189 uses: actions/cache@ v2146 uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 190 147 env: 191 148 cache-name: cache-composer-dependencies … … 193 150 path: ${{ steps.composer-cache.outputs.dir }} 194 151 key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} 195 restore-keys: |196 ${{ runner.os }}-php-${{ matrix.php }}-composer-197 152 198 153 - name: Install Composer dependencies … … 224 179 if: ${{ matrix.memcached }} 225 180 run: | 226 cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php181 cp tests/phpunit/includes/object-cache.php src/wp-content/object-cache.php 227 182 docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached 228 183 … … 249 204 run: npm run env:install 250 205 206 - name: Run slow PHPUnit tests 207 if: ${{ matrix.split_slow }} 208 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }} 209 210 - name: Run PHPUnit tests for single site excluding slow tests 211 if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }} 212 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required 213 214 - name: Run PHPUnit tests for Multisite excluding slow tests 215 if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }} 216 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers 217 251 218 - name: Run PHPUnit tests 252 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist 219 if: ${{ matrix.php >= '7.0' }} 220 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} 253 221 254 222 - name: Run AJAX tests 255 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group ajax 256 257 - name: Run tests as a multisite install 258 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml 223 if: ${{ ! matrix.split_slow && ! matrix.multisite }} 224 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax 259 225 260 226 - name: Run ms-files tests as a multisite install 227 if: ${{ matrix.multisite && ! matrix.split_slow }} 261 228 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files 262 229 263 230 - name: Run external HTTP tests 231 if: ${{ ! matrix.multisite && ! matrix.split_slow }} 264 232 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group external-http 265 233 266 - name: Run REST API tests267 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group restapi-jsclient268 269 # Xdebug supports PHP 8 only from version 3.0, which is not released yet.270 # Once Xdebug 3.0 is released and included in the Docker image, the IF condition should be removed.271 234 # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist. 272 235 - name: Run (xDebug) tests 273 if: ${{ env.LOCAL_PHP != '8.0-fpm'}}274 run: LOCAL_PHP_XDEBUG=true npm run test: php-- -v --group xdebug --exclude-group __fakegroup__236 if: ${{ ! matrix.split_slow }} 237 run: LOCAL_PHP_XDEBUG=true npm run test:${{ env.PHPUNIT_SCRIPT }} -- -v --group xdebug --exclude-group __fakegroup__ 275 238 276 239 - name: Checkout the WordPress Test Reporter 277 240 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }} 278 uses: actions/checkout@ v2241 uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 279 242 with: 280 243 repository: 'WordPress/phpunit-test-runner' 281 244 path: 'test-runner' 282 283 - name: Set up the Git repository284 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }}285 run: |286 git init287 git remote add origin https://github.com/WordPress/wordpress-develop.git288 git fetch289 git reset origin/master290 245 291 246 - name: Submit test results to the WordPress.org host test results
Note: See TracChangeset
for help on using the changeset viewer.