Changeset 50606 for branches/5.2/.github/workflows/phpunit-tests.yml
- Timestamp:
- 03/26/2021 08:02:01 PM (4 years ago)
- Location:
- branches/5.2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.2
-
branches/5.2/.github/workflows/phpunit-tests.yml
r50336 r50606 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.m emcached && ' with memcached' || '' }} on ${{ matrix.os }}128 needs: setup-wor dpress71 name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }} ${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }} 72 needs: setup-workflow 129 73 runs-on: ${{ matrix.os }} 130 74 strategy: 131 75 matrix: 132 php: [ ' 7.3', '7.2', '7.1', '7.0', '5.6' ]76 php: [ '5.6', '7.0', '7.1', '7.2', '7.3' ] 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.3 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.3 with memcached. 137 94 - php: '7.3' 138 95 os: ubuntu-latest 139 96 memcached: true 97 multisite: false 98 - php: '7.3' 99 os: ubuntu-latest 100 memcached: true 101 multisite: true 140 102 # Report the results of the PHP 7.3 without memcached job. 141 103 - php: '7.3' 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: npx install-changed --install-command="npm ci" 137 run: npm ci 138 139 - name: Get composer cache directory 140 id: composer-cache 141 if: ${{ env.COMPOSER_INSTALL == true }} 142 run: echo "::set-output name=dir::$(composer config cache-files-dir)" 181 143 182 144 - name: Cache Composer dependencies 183 145 if: ${{ env.COMPOSER_INSTALL == true }} 184 uses: actions/cache@ v2146 uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 185 147 env: 186 148 cache-name: cache-composer-dependencies … … 188 150 path: ${{ steps.composer-cache.outputs.dir }} 189 151 key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} 190 restore-keys: |191 ${{ runner.os }}-php-${{ matrix.php }}-composer-192 152 193 153 - name: Install Composer dependencies … … 210 170 if: ${{ matrix.memcached }} 211 171 run: | 212 cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php172 cp tests/phpunit/includes/object-cache.php src/wp-content/object-cache.php 213 173 docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached 214 174 … … 235 195 run: npm run env:install 236 196 197 - name: Run slow PHPUnit tests 198 if: ${{ matrix.split_slow }} 199 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }} 200 201 - name: Run PHPUnit tests for single site excluding slow tests 202 if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }} 203 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required 204 205 - name: Run PHPUnit tests for Multisite excluding slow tests 206 if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }} 207 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers 208 237 209 - name: Run PHPUnit tests 238 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist 210 if: ${{ matrix.php >= '7.0' }} 211 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} 239 212 240 213 - name: Run AJAX tests 241 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group ajax 214 if: ${{ ! matrix.split_slow && ! matrix.multisite }} 215 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax 242 216 243 217 - name: Run tests as a multisite install … … 245 219 246 220 - name: Run ms-files tests as a multisite install 221 if: ${{ matrix.multisite && ! matrix.split_slow }} 247 222 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files 248 223 249 224 - name: Run external HTTP tests 225 if: ${{ ! matrix.multisite && ! matrix.split_slow }} 250 226 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group external-http 251 252 - name: Run REST API tests253 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group restapi-jsclient254 227 255 228 - name: Checkout the WordPress Test Reporter 256 229 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }} 257 uses: actions/checkout@ v2230 uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 258 231 with: 259 232 repository: 'WordPress/phpunit-test-runner' 260 233 path: 'test-runner' 261 262 - name: Set up the Git repository263 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }}264 run: |265 git init266 git remote add origin https://github.com/WordPress/wordpress-develop.git267 git fetch268 git reset origin/master269 234 270 235 - name: Submit test results to the WordPress.org host test results
Note: See TracChangeset
for help on using the changeset viewer.