Changeset 50309 for branches/4.8/.github/workflows/phpunit-tests.yml
- Timestamp:
- 02/12/2021 07:34:39 PM (4 years ago)
- Location:
- branches/4.8
- Files:
-
- 1 added
- 2 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/4.8
- 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/4.8/.github/workflows/phpunit-tests.yml
r49162 r50309 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: [ '7.1' ] 133 phpunit: [ '6-php-7.1' ] 127 134 os: [ ubuntu-latest ] 135 memcached: [ false ] 136 include: 137 # Include job for PHP 7.1 with memcached. 138 - php: '7.1' 139 phpunit: '6-php-7.1' 140 os: ubuntu-latest 141 memcached: true 142 - php: '7.0' 143 phpunit: '6-php-7.0' 144 os: ubuntu-latest 145 memcached: false 146 - php: '5.6' 147 phpunit: '4-php-5.6' 148 os: ubuntu-latest 149 memcached: false 150 - php: '5.5' 151 phpunit: '5.5' 152 os: ubuntu-latest 153 memcached: false 154 - php: '5.4' 155 phpunit: '5.4' 156 os: ubuntu-latest 157 memcached: false 158 - php: '5.3' 159 phpunit: '5.3' 160 os: ubuntu-latest 161 memcached: false 128 162 env: 129 LOCAL_PHP: ${{ matrix.php_versions }}-fpm 163 LOCAL_PHP: ${{ matrix.php }}-fpm 164 LOCAL_PHPUNIT: ${{ matrix.phpunit }}-fpm 165 LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }} 130 166 131 167 steps: … … 135 171 echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV 136 172 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 173 - name: Download the built WordPress artifact 144 174 uses: actions/download-artifact@v2 … … 152 182 uses: actions/setup-node@v1 153 183 with: 154 node-version: 1 2184 node-version: 14 155 185 156 186 - name: Use cached Node modules … … 166 196 167 197 - 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)" 198 run: npx install-changed --install-command="npm ci" 174 199 175 200 - name: Cache Composer dependencies 176 if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm'}}201 if: ${{ env.COMPOSER_INSTALL == true }} 177 202 uses: actions/cache@v2 178 203 env: … … 180 205 with: 181 206 path: ${{ steps.composer-cache.outputs.dir }} 182 key: ${{ runner.os }}- composer-${{ hashFiles('**/composer.lock') }}207 key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} 183 208 restore-keys: | 184 ${{ runner.os }}- composer-209 ${{ runner.os }}-php-${{ matrix.php }}-composer- 185 210 186 211 - name: Install Composer dependencies 187 if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm'}}212 if: ${{ env.COMPOSER_INSTALL == true }} 188 213 run: | 189 214 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 215 docker-compose run --rm php composer install 200 216 201 217 - name: Docker debug information … … 210 226 # The memcached server needs to start after the Docker network has been set up with `npm run env:start`. 211 227 - name: Start the Memcached server. 212 if: ${{ contains( matrix.php_versions, 'memcached' )}}228 if: ${{ matrix.memcached }} 213 229 run: | 214 230 cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php … … 228 244 - name: WordPress Docker container debug information 229 245 run: | 230 docker -v231 docker-compose -v232 246 docker-compose run --rm mysql mysql --version 233 247 docker-compose run --rm php php --version … … 248 262 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml 249 263 250 - name: Run m utlisite file tests264 - name: Run ms-files tests as a multisite install 251 265 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files 252 266 … … 257 271 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group restapi-jsclient 258 272 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 273 # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist. 262 274 - name: Run (xDebug) tests 263 if: ${{ env.LOCAL_PHP != '8.0-fpm' }}264 275 run: LOCAL_PHP_XDEBUG=true npm run test:php -- -v --group xdebug --exclude-group __fakegroup__ 265 276 266 - name: WordPress Test Reporter267 if: ${{ matrix.php_versions == '7.4'}}277 - name: Checkout the WordPress Test Reporter 278 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }} 268 279 uses: actions/checkout@v2 269 280 with: 270 281 repository: 'WordPress/phpunit-test-runner' 271 282 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 283 284 - name: Set up the Git repository 285 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }} 286 run: | 287 git init 288 git remote add origin https://github.com/WordPress/wordpress-develop.git 289 git fetch 290 git reset origin/master 291 292 - name: Submit test results to the WordPress.org host test results 293 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }} 294 env: 295 WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}" 296 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.