Changeset 50322 for branches/3.9/.github/workflows/phpunit-tests.yml
- Timestamp:
- 02/12/2021 08:49:41 PM (4 years ago)
- Location:
- branches/3.9
- Files:
-
- 1 added
- 2 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.9
- Property svn:mergeinfo changed
/trunk merged: 49162,49168-49169,49175,49204,49227-49228,49244,49369,49371,49548,49781-49784,49786,49836,49938,50268,50285,50298
- Property svn:mergeinfo changed
-
branches/3.9/.github/workflows/phpunit-tests.yml
r49162 r50322 5 5 branches: 6 6 - master 7 - '*.*' 7 - '3.[7-9]' 8 - '[4-9].[0-9]' 9 tags: 10 - '3.[7-9]*' 11 - '[4-9].[0-9]*' 8 12 pull_request: 9 13 # Once weekly On Sundays at 00:00 UTC. … … 23 27 # 24 28 # Performs the following steps: 25 # - Cancels all previous workflow runs that have not completed.29 # - Cancels all previous workflow runs for pull requests that have not completed. 26 30 # - Checks out the repository. 27 # - Checks out the WordPress Importer plugin (needed for the Core PHPUnit tests).28 31 # - Logs debug information about the runner container. 29 # - Installs NodeJS 1 2 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches)32 # - Installs NodeJS 14. 30 33 # - Sets up caching for NPM. 31 # _ Installs NPM dependencies .34 # _ Installs NPM dependencies using install-changed to hash the `package.json` file. 32 35 # - Builds WordPress to run from the `build` directory. 33 # - Creates a ZIP file of compiled WordPress 36 # - Creates a ZIP file of compiled WordPress. 34 37 # - Uploads ZIP file as an artifact. 35 38 setup-wordpress: 36 39 name: Setup WordPress 37 40 runs-on: ubuntu-latest 41 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} 38 42 39 43 steps: 40 - name: Cancel previous runs of this workflow 44 - name: Cancel previous runs of this workflow (pull requests only) 45 if: ${{ github.event_name == 'pull_request' }} 41 46 uses: styfle/cancel-workflow-action@0.5.0 42 47 with: … … 46 51 uses: actions/checkout@v2 47 52 48 - name: Checkout the WordPress Importer plugin49 run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer50 51 53 - name: Log debug information 52 54 run: | 55 echo "$GITHUB_REF" 56 echo "$GITHUB_EVENT_NAME" 53 57 npm --version 54 58 node --version … … 63 67 uses: actions/setup-node@v1 64 68 with: 65 node-version: 1 269 node-version: 14 66 70 67 71 - name: Cache NodeJS modules … … 77 81 78 82 - name: Install Dependencies 79 run: np m ci83 run: npx install-changed --install-command="npm ci" 80 84 81 85 - name: Build WordPress … … 86 90 with: 87 91 filename: built-wp-${{ github.sha }}.zip 88 exclusions: ' /*node_modules/*'92 exclusions: '*.git* /*node_modules/* packagehash.txt' 89 93 90 94 - name: Upload build artifact … … 102 106 # - Downloads the built WordPress artifact from the previous job. 103 107 # - Unzips the artifact. 104 # - Installs NodeJS 1 2 (todo: install the version of NPM specified in the `nvmrc` file to support older branches)108 # - Installs NodeJS 14. 105 109 # - Sets up caching for NPM. 106 # _ Installs NPM dependencies .110 # _ Installs NPM dependencies using install-changed to hash the `package.json` file. 107 111 # - Configures caching for Composer. 108 # _ Installs Composer dependencies (if desired) 109 # - Logs Docker debug information (about both the Docker installation within the runner) 112 # _ Installs Composer dependencies (if desired). 113 # - Logs Docker debug information (about both the Docker installation within the runner). 110 114 # - Starts the WordPress Docker container. 111 115 # - Starts the memcached server after the Docker network has been created (if desired). … … 113 117 # - Logs debug general information. 114 118 # - Logs the running Docker containers. 115 # - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container)119 # - Logs debug information about what's installed within the WordPress Docker containers. 116 120 # - Install WordPress within the Docker container. 117 121 # - Run the PHPUnit tests. 118 # - Reports test results to the Distributed Hosting Tests. 122 # - Checks out the WordPress Test reporter repository. 123 # - Reconnect the directory to the Git repository. 124 # - Submit the test results to the WordPress.org host test results. 119 125 # - todo: Configure Slack notifications for failing tests. 120 126 test-php: 121 name: ${{ matrix.php _versions}} on ${{ matrix.os }}127 name: ${{ matrix.php }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }} 122 128 needs: setup-wordpress 123 129 runs-on: ${{ matrix.os }} 124 130 strategy: 125 131 matrix: 126 php _versions: [ '8.0', 7.4, '7.4 with memcached', 7.3, 7.2, 7.1, '7.0', 5.6.20]132 php: [ '5.5', '5.4', '5.3' ] 127 133 os: [ ubuntu-latest ] 128 134 env: 129 LOCAL_PHP: ${{ matrix.php_versions }}-fpm 135 LOCAL_PHP: ${{ matrix.php }}-fpm 136 LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }} 130 137 131 138 steps: … … 135 142 echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV 136 143 137 - name: Configure memcached138 if: ${{ contains( matrix.php_versions, 'memcached' ) }}139 run: |140 echo "LOCAL_PHP=$(echo ${{ matrix.php_versions }} | cut -c1-3)-fpm" >> $GITHUB_ENV141 echo "LOCAL_PHP_MEMCACHED=true" >> $GITHUB_ENV142 143 144 - name: Download the built WordPress artifact 144 145 uses: actions/download-artifact@v2 … … 152 153 uses: actions/setup-node@v1 153 154 with: 154 node-version: 1 2155 node-version: 14 155 156 156 157 - name: Use cached Node modules … … 166 167 167 168 - name: Install Dependencies 168 run: npm ci 169 170 - name: Get composer cache directory 171 id: composer-cache 172 if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm' }} 173 run: echo "::set-output name=dir::$(composer config cache-files-dir)" 169 run: npx install-changed --install-command="npm ci" 174 170 175 171 - name: Cache Composer dependencies 176 if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm'}}172 if: ${{ env.COMPOSER_INSTALL == true }} 177 173 uses: actions/cache@v2 178 174 env: … … 180 176 with: 181 177 path: ${{ steps.composer-cache.outputs.dir }} 182 key: ${{ runner.os }}- composer-${{ hashFiles('**/composer.lock') }}178 key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} 183 179 restore-keys: | 184 ${{ runner.os }}- composer-180 ${{ runner.os }}-php-${{ matrix.php }}-composer- 185 181 186 182 - name: Install Composer dependencies 187 if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm'}}183 if: ${{ env.COMPOSER_INSTALL == true }} 188 184 run: | 189 185 docker-compose run --rm php composer --version 190 191 # The PHPUnit 7.x phar is not compatible with PHP 8 and won't be updated, 192 # as PHPUnit 7 is no longer supported. The Composer-installed PHPUnit should be 193 # used for PHP 8 testing instead. 194 if [ ${{ env.LOCAL_PHP }} == '8.0-fpm' ]; then 195 docker-compose run --rm php composer install --ignore-platform-reqs 196 echo "PHPUNIT_SCRIPT=php-composer" >> $GITHUB_ENV 197 else 198 docker-compose run --rm php composer install 199 fi 186 docker-compose run --rm php composer install 200 187 201 188 - name: Docker debug information … … 210 197 # The memcached server needs to start after the Docker network has been set up with `npm run env:start`. 211 198 - name: Start the Memcached server. 212 if: ${{ contains( matrix.php_versions, 'memcached' )}}199 if: ${{ matrix.memcached }} 213 200 run: | 214 201 cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php … … 228 215 - name: WordPress Docker container debug information 229 216 run: | 230 docker -v231 docker-compose -v232 217 docker-compose run --rm mysql mysql --version 233 218 docker-compose run --rm php php --version … … 248 233 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml 249 234 250 - name: Run mutlisite file tests251 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files252 253 235 - name: Run external HTTP tests 254 236 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group external-http 255 237 256 - name: Run REST API tests 257 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group restapi-jsclient 258 259 # Xdebug supports PHP 8 only from version 3.0, which is not released yet. 260 # Once Xdebug 3.0 is released and included in the Docker image, the IF condition should be removed. 261 # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist. 262 - name: Run (xDebug) tests 263 if: ${{ env.LOCAL_PHP != '8.0-fpm' }} 264 run: LOCAL_PHP_XDEBUG=true npm run test:php -- -v --group xdebug --exclude-group __fakegroup__ 265 266 - name: WordPress Test Reporter 267 if: ${{ matrix.php_versions == '7.4' }} 238 - name: Checkout the WordPress Test Reporter 239 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }} 268 240 uses: actions/checkout@v2 269 241 with: 270 242 repository: 'WordPress/phpunit-test-runner' 271 243 path: 'test-runner' 272 # TODO: Configure hidden keys to successfully report test results. 273 # 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 244 245 - name: Set up the Git repository 246 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }} 247 run: | 248 git init 249 git remote add origin https://github.com/WordPress/wordpress-develop.git 250 git fetch 251 git reset origin/master 252 253 - name: Submit test results to the WordPress.org host test results 254 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }} 255 env: 256 WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}" 257 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
Note: See TracChangeset
for help on using the changeset viewer.