Ticket #61213: 61213.diff
| File 61213.diff, 64.8 KB (added by , 2 years ago) |
|---|
-
.github/workflows/coding-standards.yml
diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 0f70aa565b2e..4bd79089e25a 100644
a b concurrency: 45 45 permissions: {} 46 46 47 47 jobs: 48 # Runs PHP coding standards checks. 49 # 50 # Violations are reported inline with annotations. 51 # 52 # Performs the following steps: 53 # - Checks out the repository. 54 # - Sets up PHP. 55 # - Configures caching for PHPCS scans. 56 # - Installs Composer dependencies. 57 # - Make Composer packages available globally. 58 # - Runs PHPCS on the full codebase with warnings suppressed. 59 # - Generate a report for displaying issues as pull request annotations. 60 # - Runs PHPCS on the `tests` directory without warnings suppressed. 61 # - Generate a report for displaying `test` directory issues as pull request annotations. 62 # - Ensures version-controlled files are not modified or deleted. 48 # Runs the PHP coding standards checks. 63 49 phpcs: 64 50 name: PHP coding standards 65 runs-on: ubuntu-latest51 uses: desrosj/wordpress-develop/.github/workflows/reusable-coding-standards-php.yml@try/make-workflows-callable 66 52 permissions: 67 53 contents: read 68 timeout-minutes: 2069 54 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} 70 55 71 steps:72 - name: Checkout repository73 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.174 with:75 show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}76 77 - name: Set up PHP78 uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2.30.079 with:80 php-version: 'latest'81 coverage: none82 tools: cs2pr83 84 # This date is used to ensure that the PHPCS cache is cleared at least once every week.85 # http://man7.org/linux/man-pages/man1/date.1.html86 - name: "Get last Monday's date"87 id: get-date88 run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT89 90 - name: Cache PHPCS scan cache91 uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.192 with:93 path: |94 .cache/phpcs-src.json95 .cache/phpcs-tests.json96 key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }}97 98 # Since Composer dependencies are installed using `composer update` and no lock file is in version control,99 # passing a custom cache suffix ensures that the cache is flushed at least once per week.100 - name: Install Composer dependencies101 uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a # v3.0.0102 with:103 custom-cache-suffix: ${{ steps.get-date.outputs.date }}104 105 - name: Make Composer packages available globally106 run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH107 108 - name: Run PHPCS on all Core files109 id: phpcs-core110 run: phpcs -n --report-full --cache=./.cache/phpcs-src.json --report-checkstyle=./.cache/phpcs-report.xml111 112 - name: Show PHPCS results in PR113 if: ${{ always() && steps.phpcs-core.outcome == 'failure' }}114 run: cs2pr ./.cache/phpcs-report.xml115 116 - name: Check test suite files for warnings117 id: phpcs-tests118 run: phpcs tests --report-full --cache=./.cache/phpcs-tests.json --report-checkstyle=./.cache/phpcs-tests-report.xml119 120 - name: Show test suite scan results in PR121 if: ${{ always() && steps.phpcs-tests.outcome == 'failure' }}122 run: cs2pr ./.cache/phpcs-tests-report.xml123 124 - name: Ensure version-controlled files are not modified during the tests125 run: git diff --exit-code126 127 56 # Runs the JavaScript coding standards checks. 128 #129 # JSHint violations are not currently reported inline with annotations.130 #131 # Performs the following steps:132 # - Checks out the repository.133 # - Sets up Node.js.134 # - Logs debug information about the GitHub Action runner.135 # - Installs npm dependencies.136 # - Run the WordPress JSHint checks.137 # - Ensures version-controlled files are not modified or deleted.138 57 jshint: 139 58 name: JavaScript coding standards 140 runs-on: ubuntu-latest59 uses: desrosj/wordpress-develop/.github/workflows/reusable-coding-standards-javascript.yml@try/make-workflows-callable 141 60 permissions: 142 61 contents: read 143 timeout-minutes: 20144 62 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} 145 env:146 PUPPETEER_SKIP_DOWNLOAD: ${{ true }}147 148 steps:149 - name: Checkout repository150 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1151 with:152 show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}153 154 - name: Set up Node.js155 uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2156 with:157 node-version-file: '.nvmrc'158 cache: npm159 160 - name: Log debug information161 run: |162 npm --version163 node --version164 git --version165 166 - name: Install npm Dependencies167 run: npm ci168 169 - name: Run JSHint170 run: npm run grunt jshint171 172 - name: Ensure version-controlled files are not modified or deleted173 run: git diff --exit-code174 63 175 64 slack-notifications: 176 65 name: Slack Notifications -
.github/workflows/end-to-end-tests.yml
diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index 757de1f9a42a..6b73b6358a63 100644
a b env: 36 36 37 37 jobs: 38 38 # Runs the end-to-end test suite. 39 #40 # Performs the following steps:41 # - Sets environment variables.42 # - Checks out the repository.43 # - Sets up Node.js.44 # - Logs debug information about the GitHub Action runner.45 # - Installs npm dependencies.46 # - Install Playwright browsers.47 # - Builds WordPress to run from the `build` directory.48 # - Starts the WordPress Docker container.49 # - Logs the running Docker containers.50 # - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container).51 # - Install WordPress within the Docker container.52 # - Install Gutenberg.53 # - Run the E2E tests.54 # - Ensures version-controlled files are not modified or deleted.55 39 e2e-tests: 56 name: E2E Testswith SCRIPT_DEBUG ${{ matrix.LOCAL_SCRIPT_DEBUG && 'enabled' || 'disabled' }}57 runs-on: ubuntu-latest40 name: Test with SCRIPT_DEBUG ${{ matrix.LOCAL_SCRIPT_DEBUG && 'enabled' || 'disabled' }} 41 uses: desrosj/wordpress-develop/.github/workflows/reusable-end-to-end-tests.yml@try/make-workflows-callable 58 42 permissions: 59 43 contents: read 60 timeout-minutes: 2061 44 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} 62 45 strategy: 63 46 fail-fast: false 64 47 matrix: 65 48 LOCAL_SCRIPT_DEBUG: [ true, false ] 66 67 steps: 68 - name: Configure environment variables 69 run: | 70 echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV 71 echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV 72 73 - name: Checkout repository 74 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 75 with: 76 show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} 77 78 - name: Set up Node.js 79 uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 80 with: 81 node-version-file: '.nvmrc' 82 cache: npm 83 84 - name: Log debug information 85 run: | 86 npm --version 87 node --version 88 curl --version 89 git --version 90 locale -a 91 92 - name: Install npm Dependencies 93 run: npm ci 94 95 - name: Install Playwright browsers 96 run: npx playwright install --with-deps 97 98 - name: Build WordPress 99 run: npm run build 100 101 - name: Start Docker environment 102 run: | 103 npm run env:start 104 105 - name: Log running Docker containers 106 run: docker ps -a 107 108 - name: Docker debug information 109 run: | 110 docker -v 111 docker compose run --rm mysql mysql --version 112 docker compose run --rm php php --version 113 docker compose run --rm php php -m 114 docker compose run --rm php php -i 115 docker compose run --rm php locale -a 116 117 - name: Install WordPress 118 env: 119 LOCAL_SCRIPT_DEBUG: ${{ matrix.LOCAL_SCRIPT_DEBUG }} 120 run: npm run env:install 121 122 - name: Install Gutenberg 123 run: npm run env:cli -- plugin install gutenberg --path=/var/www/${{ env.LOCAL_DIR }} 124 125 - name: Run E2E tests 126 run: npm run test:e2e 127 128 - name: Archive debug artifacts (screenshots, HTML snapshots) 129 uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 130 if: always() 131 with: 132 name: failures-artifacts${{ matrix.LOCAL_SCRIPT_DEBUG && '-SCRIPT_DEBUG' || '' }}-${{ github.run_id }} 133 path: artifacts 134 if-no-files-found: ignore 135 136 - name: Ensure version-controlled files are not modified or deleted 137 run: git diff --exit-code 49 with: 50 LOCAL_SCRIPT_DEBUG: ${{ matrix.LOCAL_SCRIPT_DEBUG }} 138 51 139 52 slack-notifications: 140 53 name: Slack Notifications -
.github/workflows/javascript-tests.yml
diff --git a/.github/workflows/javascript-tests.yml b/.github/workflows/javascript-tests.yml index b301866834ef..f61d10a7d62a 100644
a b concurrency: 43 43 permissions: {} 44 44 45 45 jobs: 46 # Runs the QUnit tests for WordPress. 47 # 48 # Performs the following steps: 49 # - Checks out the repository. 50 # - Sets up Node.js. 51 # - Logs debug information about the GitHub Action runner. 52 # - Installs npm dependencies. 53 # - Run the WordPress QUnit tests. 54 # - Ensures version-controlled files are not modified or deleted. 46 # Runs the WordPress Core JavaScript tests. 55 47 test-js: 56 48 name: QUnit Tests 57 runs-on: ubuntu-latest49 uses: desrosj/wordpress-develop/.github/workflows/reusable-javascript-tests.yml@try/make-workflows-callable 58 50 permissions: 59 51 contents: read 60 timeout-minutes: 2061 52 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} 62 53 63 steps:64 - name: Checkout repository65 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.166 with:67 show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}68 69 - name: Set up Node.js70 uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.271 with:72 node-version-file: '.nvmrc'73 cache: npm74 75 - name: Log debug information76 run: |77 npm --version78 node --version79 git --version80 81 - name: Install npm Dependencies82 run: npm ci83 84 - name: Run QUnit tests85 run: npm run grunt qunit:compiled86 87 - name: Ensure version-controlled files are not modified or deleted88 run: git diff --exit-code89 90 54 slack-notifications: 91 55 name: Slack Notifications 92 56 uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk -
.github/workflows/performance.yml
diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index d79ae5f8012e..5c6987e87b6a 100644
a b concurrency: 29 29 # Any needed permissions should be configured at the job level. 30 30 permissions: {} 31 31 32 env:33 PUPPETEER_SKIP_DOWNLOAD: ${{ true }}34 35 # Performance testing should be performed in an environment reflecting a standard production environment.36 LOCAL_WP_DEBUG: false37 LOCAL_SCRIPT_DEBUG: false38 LOCAL_SAVEQUERIES: false39 LOCAL_WP_DEVELOPMENT_MODE: "''"40 41 # This workflow takes two sets of measurements — one for the current commit,42 # and another against a consistent version that is used as a baseline measurement.43 # This is done to isolate variance in measurements caused by the GitHub runners44 # from differences caused by code changes between commits. The BASE_TAG value here45 # represents the version being used for baseline measurements. It should only be46 # changed if we want to normalize results against a different baseline.47 BASE_TAG: '6.1.1'48 LOCAL_DIR: build49 TARGET_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || '' }}50 TARGET_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}51 52 32 jobs: 53 33 # Runs the performance test suite. 54 #55 # Performs the following steps:56 # - Configure environment variables.57 # - Checkout repository.58 # - Set up Node.js.59 # - Log debug information.60 # - Install npm dependencies.61 # - Install Playwright browsers.62 # - Build WordPress.63 # - Start Docker environment.64 # - Log running Docker containers.65 # - Docker debug information.66 # - Install WordPress.67 # - Install WordPress Importer plugin.68 # - Import mock data.69 # - Deactivate WordPress Importer plugin.70 # - Update permalink structure.71 # - Install additional languages.72 # - Disable external HTTP requests.73 # - Disable cron.74 # - List defined constants.75 # - Install MU plugin.76 # - Run performance tests (current commit).77 # - Download previous build artifact (target branch or previous commit).78 # - Download artifact.79 # - Unzip the build.80 # - Run any database upgrades.81 # - Flush cache.82 # - Delete expired transients.83 # - Run performance tests (previous/target commit).84 # - Set the environment to the baseline version.85 # - Run any database upgrades.86 # - Flush cache.87 # - Delete expired transients.88 # - Run baseline performance tests.89 # - Archive artifacts.90 # - Compare results.91 # - Add workflow summary.92 # - Set the base sha.93 # - Set commit details.94 # - Publish performance results.95 # - Ensure version-controlled files are not modified or deleted.96 34 performance: 97 name: Run performance tests ${{ matrix.memcached && '(with memcached)' || '' }}98 runs-on: ubuntu-latest35 name: Performance tests ${{ matrix.memcached && '(with memcached)' || '' }} 36 uses: desrosj/wordpress-develop/.github/workflows/reusable-performance.yml@try/make-workflows-callable 99 37 permissions: 100 38 contents: read 101 39 if: ${{ ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) && ! contains( github.event.before, '00000000' ) }} … … jobs: 103 41 fail-fast: false 104 42 matrix: 105 43 memcached: [ true, false ] 106 env: 107 LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }} 108 steps: 109 - name: Configure environment variables 110 run: | 111 echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV 112 echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV 113 114 - name: Checkout repository 115 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 116 with: 117 show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} 118 119 - name: Set up Node.js 120 uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 121 with: 122 node-version-file: '.nvmrc' 123 cache: npm 124 125 - name: Log debug information 126 run: | 127 npm --version 128 node --version 129 curl --version 130 git --version 131 locale -a 132 133 - name: Install npm dependencies 134 run: npm ci 135 136 - name: Install Playwright browsers 137 run: npx playwright install --with-deps chromium 138 139 - name: Build WordPress 140 run: npm run build 141 142 - name: Start Docker environment 143 run: npm run env:start 144 145 - name: Install object cache drop-in 146 if: ${{ matrix.memcached }} 147 run: cp src/wp-content/object-cache.php build/wp-content/object-cache.php 148 149 - name: Log running Docker containers 150 run: docker ps -a 151 152 - name: Docker debug information 153 run: | 154 docker -v 155 docker compose run --rm mysql mysql --version 156 docker compose run --rm php php --version 157 docker compose run --rm php php -m 158 docker compose run --rm php php -i 159 docker compose run --rm php locale -a 160 161 - name: Install WordPress 162 run: npm run env:install 163 164 - name: Install WordPress Importer plugin 165 run: npm run env:cli -- plugin install wordpress-importer --activate --path=/var/www/${{ env.LOCAL_DIR }} 166 167 - name: Import mock data 168 run: | 169 curl -O https://raw.githubusercontent.com/WordPress/theme-test-data/b9752e0533a5acbb876951a8cbb5bcc69a56474c/themeunittestdata.wordpress.xml 170 npm run env:cli -- import themeunittestdata.wordpress.xml --authors=create --path=/var/www/${{ env.LOCAL_DIR }} 171 rm themeunittestdata.wordpress.xml 172 173 - name: Deactivate WordPress Importer plugin 174 run: npm run env:cli -- plugin deactivate wordpress-importer --path=/var/www/${{ env.LOCAL_DIR }} 175 176 - name: Update permalink structure 177 run: npm run env:cli -- rewrite structure '/%year%/%monthnum%/%postname%/' --path=/var/www/${{ env.LOCAL_DIR }} 178 179 - name: Install additional languages 180 run: | 181 npm run env:cli -- language core install de_DE --path=/var/www/${{ env.LOCAL_DIR }} 182 npm run env:cli -- language plugin install de_DE --all --path=/var/www/${{ env.LOCAL_DIR }} 183 npm run env:cli -- language theme install de_DE --all --path=/var/www/${{ env.LOCAL_DIR }} 184 185 # Prevent background update checks from impacting test stability. 186 - name: Disable external HTTP requests 187 run: npm run env:cli -- config set WP_HTTP_BLOCK_EXTERNAL true --raw --type=constant --path=/var/www/${{ env.LOCAL_DIR }} 188 189 # Prevent background tasks from impacting test stability. 190 - name: Disable cron 191 run: npm run env:cli -- config set DISABLE_WP_CRON true --raw --type=constant --path=/var/www/${{ env.LOCAL_DIR }} 192 193 - name: List defined constants 194 run: npm run env:cli -- config list --path=/var/www/${{ env.LOCAL_DIR }} 195 196 - name: Install MU plugin 197 run: | 198 mkdir ./${{ env.LOCAL_DIR }}/wp-content/mu-plugins 199 cp ./tests/performance/wp-content/mu-plugins/server-timing.php ./${{ env.LOCAL_DIR }}/wp-content/mu-plugins/server-timing.php 200 201 - name: Run performance tests (current commit) 202 run: npm run test:performance 203 204 - name: Download previous build artifact (target branch or previous commit) 205 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 206 id: get-previous-build 207 with: 208 script: | 209 const artifacts = await github.rest.actions.listArtifactsForRepo({ 210 owner: context.repo.owner, 211 repo: context.repo.repo, 212 name: 'wordpress-build-' + process.env.TARGET_SHA, 213 }); 214 215 const matchArtifact = artifacts.data.artifacts[0]; 216 217 if ( ! matchArtifact ) { 218 core.setFailed( 'No artifact found!' ); 219 return false; 220 } 221 222 const download = await github.rest.actions.downloadArtifact( { 223 owner: context.repo.owner, 224 repo: context.repo.repo, 225 artifact_id: matchArtifact.id, 226 archive_format: 'zip', 227 } ); 228 229 const fs = require( 'fs' ); 230 fs.writeFileSync( '${{ github.workspace }}/before.zip', Buffer.from( download.data ) ) 231 232 return true; 233 234 - name: Unzip the build 235 if: ${{ steps.get-previous-build.outputs.result }} 236 run: | 237 unzip ${{ github.workspace }}/before.zip 238 unzip -o ${{ github.workspace }}/wordpress.zip 239 240 - name: Run any database upgrades 241 if: ${{ steps.get-previous-build.outputs.result }} 242 run: npm run env:cli -- core update-db --path=/var/www/${{ env.LOCAL_DIR }} 243 244 - name: Flush cache 245 if: ${{ steps.get-previous-build.outputs.result }} 246 run: npm run env:cli -- cache flush --path=/var/www/${{ env.LOCAL_DIR }} 247 248 - name: Delete expired transients 249 if: ${{ steps.get-previous-build.outputs.result }} 250 run: npm run env:cli -- transient delete --expired --path=/var/www/${{ env.LOCAL_DIR }} 251 252 - name: Run target performance tests (previous/target commit) 253 if: ${{ steps.get-previous-build.outputs.result }} 254 env: 255 TEST_RESULTS_PREFIX: before 256 run: npm run test:performance 257 258 - name: Set the environment to the baseline version 259 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' }} 260 run: | 261 npm run env:cli -- core update --version=${{ env.BASE_TAG }} --force --path=/var/www/${{ env.LOCAL_DIR }} 262 npm run env:cli -- core version --path=/var/www/${{ env.LOCAL_DIR }} 263 264 - name: Run any database upgrades 265 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' }} 266 run: npm run env:cli -- core update-db --path=/var/www/${{ env.LOCAL_DIR }} 267 268 - name: Flush cache 269 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' }} 270 run: npm run env:cli -- cache flush --path=/var/www/${{ env.LOCAL_DIR }} 271 272 - name: Delete expired transients 273 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' }} 274 run: npm run env:cli -- transient delete --expired --path=/var/www/${{ env.LOCAL_DIR }} 275 276 - name: Run baseline performance tests 277 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' }} 278 env: 279 TEST_RESULTS_PREFIX: base 280 run: npm run test:performance 281 282 - name: Archive artifacts 283 uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 284 if: always() 285 with: 286 name: performance-artifacts${{ matrix.memcached && '-memcached' || '' }}-${{ github.run_id }} 287 path: artifacts 288 if-no-files-found: ignore 289 290 - name: Compare results 291 run: node ./tests/performance/compare-results.js ${{ runner.temp }}/summary.md 292 293 - name: Add workflow summary 294 run: cat ${{ runner.temp }}/summary.md >> $GITHUB_STEP_SUMMARY 295 296 - name: Set the base sha 297 # Only needed when publishing results. 298 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' && ! matrix.memcached }} 299 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 300 id: base-sha 301 with: 302 github-token: ${{ secrets.GITHUB_TOKEN }} 303 script: | 304 const baseRef = await github.rest.git.getRef({ owner: context.repo.owner, repo: context.repo.repo, ref: 'tags/${{ env.BASE_TAG }}' }); 305 return baseRef.data.object.sha; 306 307 - name: Set commit details 308 # Only needed when publishing results. 309 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' && ! matrix.memcached }} 310 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 311 id: commit-timestamp 312 with: 313 github-token: ${{ secrets.GITHUB_TOKEN }} 314 script: | 315 const commit_details = await github.rest.git.getCommit({ owner: context.repo.owner, repo: context.repo.repo, commit_sha: context.sha }); 316 return parseInt((new Date( commit_details.data.author.date ).getTime() / 1000).toFixed(0)) 317 318 - name: Publish performance results 319 # Only publish results on pushes to trunk. 320 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' && ! matrix.memcached }} 321 env: 322 BASE_SHA: ${{ steps.base-sha.outputs.result }} 323 COMMITTED_AT: ${{ steps.commit-timestamp.outputs.result }} 324 CODEVITALS_PROJECT_TOKEN: ${{ secrets.CODEVITALS_PROJECT_TOKEN }} 325 HOST_NAME: "www.codevitals.run" 326 run: node ./tests/performance/log-results.js $CODEVITALS_PROJECT_TOKEN trunk $GITHUB_SHA $BASE_SHA $COMMITTED_AT $HOST_NAME 327 328 - name: Ensure version-controlled files are not modified or deleted 329 run: git diff --exit-code 44 with: 45 memcached: ${{ matrix.memcached }} 330 46 331 47 slack-notifications: 332 48 name: Slack Notifications -
.github/workflows/php-compatibility.yml
diff --git a/.github/workflows/php-compatibility.yml b/.github/workflows/php-compatibility.yml index bc3363aee8f5..d4586c3bbb31 100644
a b concurrency: 40 40 permissions: {} 41 41 42 42 jobs: 43 44 43 # Runs PHP compatibility testing. 45 #46 # Violations are reported inline with annotations.47 #48 # Performs the following steps:49 # - Checks out the repository.50 # - Sets up PHP.51 # - Logs debug information.52 # - Configures caching for PHP compatibility scans.53 # - Installs Composer dependencies.54 # - Make Composer packages available globally.55 # - Runs the PHP compatibility tests.56 # - Generate a report for displaying issues as pull request annotations.57 # - Ensures version-controlled files are not modified or deleted.58 44 php-compatibility: 59 45 name: Check PHP compatibility 60 runs-on: ubuntu-latest46 uses: desrosj/wordpress-develop/.github/workflows/reusable-php-compatibility.yml@try/make-workflows-callable 61 47 permissions: 62 48 contents: read 63 timeout-minutes: 2064 49 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} 65 50 66 steps:67 - name: Checkout repository68 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.169 with:70 show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}71 72 - name: Set up PHP73 uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2.30.074 with:75 php-version: '7.4'76 coverage: none77 tools: cs2pr78 79 - name: Log debug information80 run: |81 composer --version82 83 # This date is used to ensure that the PHP compatibility cache is cleared at least once every week.84 # http://man7.org/linux/man-pages/man1/date.1.html85 - name: "Get last Monday's date"86 id: get-date87 run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT88 89 - name: Cache PHP compatibility scan cache90 uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.191 with:92 path: .cache/phpcompat.json93 key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcompat-cache-${{ hashFiles('**/composer.json', 'phpcompat.xml.dist') }}94 95 # Since Composer dependencies are installed using `composer update` and no lock file is in version control,96 # passing a custom cache suffix ensures that the cache is flushed at least once per week.97 - name: Install Composer dependencies98 uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a # v3.0.099 with:100 custom-cache-suffix: ${{ steps.get-date.outputs.date }}101 102 - name: Make Composer packages available globally103 run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH104 105 - name: Run PHP compatibility tests106 id: phpcs107 run: phpcs --standard=phpcompat.xml.dist --report-full --report-checkstyle=./.cache/phpcs-compat-report.xml108 109 - name: Show PHPCompatibility results in PR110 if: ${{ always() && steps.phpcs.outcome == 'failure' }}111 run: cs2pr ./.cache/phpcs-compat-report.xml112 113 - name: Ensure version-controlled files are not modified or deleted114 run: git diff --exit-code115 116 51 slack-notifications: 117 52 name: Slack Notifications 118 53 uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk -
.github/workflows/phpunit-tests.yml
diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index 3bc72f8e8c52..4d13ed2ec19f 100644
a b jobs: 36 36 # 37 37 test-with-mysql: 38 38 name: PHP ${{ matrix.php }} 39 uses: WordPress/wordpress-develop/.github/workflows/phpunit-tests-run.yml@trunk39 uses: desrosj/wordpress-develop/.github/workflows/reusable-phpunit-tests.yml@try/make-workflows-callable 40 40 permissions: 41 41 contents: read 42 42 secrets: inherit … … jobs: 108 108 # 109 109 test-with-mariadb: 110 110 name: PHP ${{ matrix.php }} 111 uses: WordPress/wordpress-develop/.github/workflows/phpunit-tests-run.yml@trunk111 uses: desrosj/wordpress-develop/.github/workflows/reusable-phpunit-tests.yml@try/make-workflows-callable 112 112 permissions: 113 113 contents: read 114 114 secrets: inherit -
new file .github/workflows/reusable-coding-standards-javascript.yml
diff --git a/.github/workflows/reusable-coding-standards-javascript.yml b/.github/workflows/reusable-coding-standards-javascript.yml new file mode 100644 index 000000000000..a424f8063088
- + 1 ## 2 # A reusable workflow that checks the JavaScript coding standards. 3 ## 4 name: JavaScript coding standards 5 6 on: 7 workflow_call: 8 9 env: 10 PUPPETEER_SKIP_DOWNLOAD: ${{ true }} 11 12 jobs: 13 # Runs the JavaScript coding standards checks. 14 # 15 # JSHint violations are not currently reported inline with annotations. 16 # 17 # Performs the following steps: 18 # - Checks out the repository. 19 # - Sets up Node.js. 20 # - Logs debug information about the GitHub Action runner. 21 # - Installs npm dependencies. 22 # - Run the WordPress JSHint checks. 23 # - Ensures version-controlled files are not modified or deleted. 24 jshint: 25 name: Run coding standards checks 26 runs-on: ubuntu-latest 27 permissions: 28 contents: read 29 timeout-minutes: 20 30 31 steps: 32 - name: Checkout repository 33 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 34 with: 35 show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} 36 37 - name: Set up Node.js 38 uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 39 with: 40 node-version-file: '.nvmrc' 41 cache: npm 42 43 - name: Log debug information 44 run: | 45 npm --version 46 node --version 47 git --version 48 49 - name: Install npm Dependencies 50 run: npm ci 51 52 - name: Run JSHint 53 run: npm run grunt jshint 54 55 - name: Ensure version-controlled files are not modified or deleted 56 run: git diff --exit-code -
new file .github/workflows/reusable-coding-standards-php.yml
diff --git a/.github/workflows/reusable-coding-standards-php.yml b/.github/workflows/reusable-coding-standards-php.yml new file mode 100644 index 000000000000..1d3802e20900
- + 1 ## 2 # A reusable workflow that checks the PHP coding standards. 3 ## 4 name: PHP coding standards 5 6 on: 7 workflow_call: 8 inputs: 9 php-version: 10 description: 'The PHP version to use.' 11 required: false 12 type: 'string' 13 default: 'latest' 14 15 jobs: 16 # Runs the PHP coding standards checks. 17 # 18 # Violations are reported inline with annotations. 19 # 20 # Performs the following steps: 21 # - Checks out the repository. 22 # - Sets up PHP. 23 # - Configures caching for PHPCS scans. 24 # - Installs Composer dependencies. 25 # - Make Composer packages available globally. 26 # - Runs PHPCS on the full codebase (warnings excluded). 27 # - Generate a report for displaying issues as pull request annotations. 28 # - Runs PHPCS on the `tests` directory without (warnings included). 29 # - Generate a report for displaying `test` directory issues as pull request annotations. 30 # - Ensures version-controlled files are not modified or deleted. 31 phpcs: 32 name: Run coding standards checks 33 runs-on: ubuntu-latest 34 permissions: 35 contents: read 36 timeout-minutes: 20 37 38 steps: 39 - name: Checkout repository 40 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 41 with: 42 show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} 43 44 - name: Set up PHP 45 uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2.30.0 46 with: 47 php-version: ${{ inputs.php-version }} 48 coverage: none 49 tools: cs2pr 50 51 # This date is used to ensure that the PHPCS cache is cleared at least once every week. 52 # http://man7.org/linux/man-pages/man1/date.1.html 53 - name: "Get last Monday's date" 54 id: get-date 55 run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT 56 57 - name: Cache PHPCS scan cache 58 uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1 59 with: 60 path: | 61 .cache/phpcs-src.json 62 .cache/phpcs-tests.json 63 key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-php-${{ inputs.php }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }} 64 65 # Since Composer dependencies are installed using `composer update` and no lock file is in version control, 66 # passing a custom cache suffix ensures that the cache is flushed at least once per week. 67 - name: Install Composer dependencies 68 uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a # v3.0.0 69 with: 70 custom-cache-suffix: ${{ steps.get-date.outputs.date }} 71 72 - name: Make Composer packages available globally 73 run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH 74 75 - name: Run PHPCS on all Core files 76 id: phpcs-core 77 run: phpcs -n --report-full --cache=./.cache/phpcs-src.json --report-checkstyle=./.cache/phpcs-report.xml 78 79 - name: Show PHPCS results in PR 80 if: ${{ always() && steps.phpcs-core.outcome == 'failure' }} 81 run: cs2pr ./.cache/phpcs-report.xml 82 83 - name: Check test suite files for warnings 84 id: phpcs-tests 85 run: phpcs tests --report-full --cache=./.cache/phpcs-tests.json --report-checkstyle=./.cache/phpcs-tests-report.xml 86 87 - name: Show test suite scan results in PR 88 if: ${{ always() && steps.phpcs-tests.outcome == 'failure' }} 89 run: cs2pr ./.cache/phpcs-tests-report.xml 90 91 - name: Ensure version-controlled files are not modified during the tests 92 run: git diff --exit-code -
new file .github/workflows/reusable-end-to-end-tests.yml
diff --git a/.github/workflows/reusable-end-to-end-tests.yml b/.github/workflows/reusable-end-to-end-tests.yml new file mode 100644 index 000000000000..70609e8a6535
- + 1 ## 2 # A reusable workflow that runs end-to-end tests. 3 # 4 # Branches 6.3 and earlier used Puppeteer instead of Playwright. 5 # Use https://github.com/WordPress/wordpress-develop/tree/6.3/.github/workflows/reusable-end-to-end-tests.yml instead. 6 ## 7 name: End-to-end Tests 8 9 on: 10 workflow_call: 11 inputs: 12 LOCAL_SCRIPT_DEBUG: 13 description: 'Whether to enable script debugging.' 14 required: false 15 type: 'boolean' 16 default: false 17 install-gutenberg: 18 description: 'Whether to install the Gutenberg plugin.' 19 required: false 20 type: 'boolean' 21 default: true 22 23 env: 24 LOCAL_DIR: build 25 26 jobs: 27 # Runs the end-to-end test suite. 28 # 29 # Performs the following steps: 30 # - Sets environment variables. 31 # - Checks out the repository. 32 # - Sets up Node.js. 33 # - Logs debug information about the GitHub Action runner. 34 # - Installs npm dependencies. 35 # - Install Playwright browsers. 36 # - Builds WordPress to run from the `build` directory. 37 # - Starts the WordPress Docker container. 38 # - Logs the running Docker containers. 39 # - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container). 40 # - Install WordPress within the Docker container. 41 # - Install Gutenberg. 42 # - Run the E2E tests. 43 # - Uploads screenshots and HTML snapshots as an artifact. 44 # - Ensures version-controlled files are not modified or deleted. 45 e2e-tests: 46 name: Run E2E tests 47 runs-on: ubuntu-latest 48 permissions: 49 contents: read 50 timeout-minutes: 20 51 52 steps: 53 - name: Configure environment variables 54 run: | 55 echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV 56 echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV 57 58 - name: Checkout repository 59 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 60 with: 61 show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} 62 63 - name: Set up Node.js 64 uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 65 with: 66 node-version-file: '.nvmrc' 67 cache: npm 68 69 - name: Log debug information 70 run: | 71 npm --version 72 node --version 73 curl --version 74 git --version 75 locale -a 76 77 - name: Install npm Dependencies 78 run: npm ci 79 80 - name: Install Playwright browsers 81 run: npx playwright install --with-deps 82 83 - name: Build WordPress 84 run: npm run build 85 86 - name: Start Docker environment 87 run: | 88 npm run env:start 89 90 - name: Log running Docker containers 91 run: docker ps -a 92 93 - name: Docker debug information 94 run: | 95 docker -v 96 docker compose run --rm mysql mysql --version 97 docker compose run --rm php php --version 98 docker compose run --rm php php -m 99 docker compose run --rm php php -i 100 docker compose run --rm php locale -a 101 102 - name: Install WordPress 103 env: 104 LOCAL_SCRIPT_DEBUG: ${{ inputs.LOCAL_SCRIPT_DEBUG }} 105 run: npm run env:install 106 107 - name: Install Gutenberg 108 if: ${{ inputs.install-gutenberg }} 109 run: npm run env:cli -- plugin install gutenberg --path=/var/www/${{ env.LOCAL_DIR }} 110 111 - name: Run E2E tests 112 run: npm run test:e2e 113 114 - name: Archive debug artifacts (screenshots, HTML snapshots) 115 uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 116 if: always() 117 with: 118 name: failures-artifacts${{ inputs.LOCAL_SCRIPT_DEBUG && '-SCRIPT_DEBUG' || '' }}-${{ github.run_id }} 119 path: artifacts 120 if-no-files-found: ignore 121 122 - name: Ensure version-controlled files are not modified or deleted 123 run: git diff --exit-code -
new file .github/workflows/reusable-javascript-tests.yml
diff --git a/.github/workflows/reusable-javascript-tests.yml b/.github/workflows/reusable-javascript-tests.yml new file mode 100644 index 000000000000..0d7b674fb932
- + 1 ## 2 # A reusable workflow that runs JavaScript tests. 3 ## 4 name: JavaScript tests 5 6 on: 7 workflow_call: 8 9 jobs: 10 # Runs the QUnit test suite. 11 # 12 # Performs the following steps: 13 # - Checks out the repository. 14 # - Sets up Node.js. 15 # - Logs debug information about the GitHub Action runner. 16 # - Installs npm dependencies. 17 # - Run the WordPress QUnit tests. 18 # - Ensures version-controlled files are not modified or deleted. 19 test-js: 20 name: Run QUnit tests 21 runs-on: ubuntu-latest 22 permissions: 23 contents: read 24 timeout-minutes: 20 25 26 steps: 27 - name: Checkout repository 28 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 29 with: 30 show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} 31 32 - name: Set up Node.js 33 uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 34 with: 35 node-version-file: '.nvmrc' 36 cache: npm 37 38 - name: Log debug information 39 run: | 40 npm --version 41 node --version 42 git --version 43 44 - name: Install npm Dependencies 45 run: npm ci 46 47 - name: Run QUnit tests 48 run: npm run grunt qunit:compiled 49 50 - name: Ensure version-controlled files are not modified or deleted 51 run: git diff --exit-code -
new file .github/workflows/reusable-performance.yml
diff --git a/.github/workflows/reusable-performance.yml b/.github/workflows/reusable-performance.yml new file mode 100644 index 000000000000..0eb3f30543eb
- + 1 ## 2 # A reusable workflow that runs the performance test suite. 3 ## 4 name: Performance Tests 5 6 on: 7 workflow_call: 8 inputs: 9 LOCAL_DIR: 10 description: 'Where to run WordPress from.' 11 required: false 12 type: 'string' 13 default: 'build' 14 BASE_TAG: 15 description: 'The version being used for baseline measurements.' 16 required: false 17 type: 'string' 18 default: '6.1.1' 19 memcached: 20 description: 'Whether to enable memcached.' 21 required: false 22 type: 'boolean' 23 default: false 24 25 env: 26 PUPPETEER_SKIP_DOWNLOAD: ${{ true }} 27 28 # Performance testing should be performed in an environment reflecting a standard production environment. 29 LOCAL_WP_DEBUG: false 30 LOCAL_SCRIPT_DEBUG: false 31 LOCAL_SAVEQUERIES: false 32 LOCAL_WP_DEVELOPMENT_MODE: "''" 33 34 # This workflow takes two sets of measurements — one for the current commit, 35 # and another against a consistent version that is used as a baseline measurement. 36 # This is done to isolate variance in measurements caused by the GitHub runners 37 # from differences caused by code changes between commits. The BASE_TAG value here 38 # represents the version being used for baseline measurements. It should only be 39 # changed if we want to normalize results against a different baseline. 40 BASE_TAG: ${{ inputs.BASE_TAG }} 41 LOCAL_DIR: ${{ inputs.LOCAL_DIR }} 42 TARGET_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || '' }} 43 TARGET_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} 44 45 LOCAL_PHP_MEMCACHED: ${{ inputs.memcached }} 46 47 jobs: 48 # Performs the following steps: 49 # - Configure environment variables. 50 # - Checkout repository. 51 # - Set up Node.js. 52 # - Log debug information. 53 # - Install npm dependencies. 54 # - Install Playwright browsers. 55 # - Build WordPress. 56 # - Start Docker environment. 57 # - Log running Docker containers. 58 # - Docker debug information. 59 # - Install WordPress. 60 # - Install WordPress Importer plugin. 61 # - Import mock data. 62 # - Deactivate WordPress Importer plugin. 63 # - Update permalink structure. 64 # - Install additional languages. 65 # - Disable external HTTP requests. 66 # - Disable cron. 67 # - List defined constants. 68 # - Install MU plugin. 69 # - Run performance tests (current commit). 70 # - Download previous build artifact (target branch or previous commit). 71 # - Download artifact. 72 # - Unzip the build. 73 # - Run any database upgrades. 74 # - Flush cache. 75 # - Delete expired transients. 76 # - Run performance tests (previous/target commit). 77 # - Set the environment to the baseline version. 78 # - Run any database upgrades. 79 # - Flush cache. 80 # - Delete expired transients. 81 # - Run baseline performance tests. 82 # - Archive artifacts. 83 # - Compare results. 84 # - Add workflow summary. 85 # - Set the base sha. 86 # - Set commit details. 87 # - Publish performance results. 88 # - Ensure version-controlled files are not modified or deleted. 89 performance: 90 name: Run tests 91 runs-on: ubuntu-latest 92 permissions: 93 contents: read 94 if: ${{ ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) && ! contains( github.event.before, '00000000' ) }} 95 96 steps: 97 - name: Configure environment variables 98 run: | 99 echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV 100 echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV 101 102 - name: Checkout repository 103 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 104 with: 105 show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} 106 107 - name: Set up Node.js 108 uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 109 with: 110 node-version-file: '.nvmrc' 111 cache: npm 112 113 - name: Log debug information 114 run: | 115 npm --version 116 node --version 117 curl --version 118 git --version 119 locale -a 120 121 - name: Install npm dependencies 122 run: npm ci 123 124 - name: Install Playwright browsers 125 run: npx playwright install --with-deps chromium 126 127 - name: Build WordPress 128 run: npm run build 129 130 - name: Start Docker environment 131 run: npm run env:start 132 133 - name: Install object cache drop-in 134 if: ${{ inputs.memcached }} 135 run: cp src/wp-content/object-cache.php build/wp-content/object-cache.php 136 137 - name: Log running Docker containers 138 run: docker ps -a 139 140 - name: Docker debug information 141 run: | 142 docker -v 143 docker compose run --rm mysql mysql --version 144 docker compose run --rm php php --version 145 docker compose run --rm php php -m 146 docker compose run --rm php php -i 147 docker compose run --rm php locale -a 148 149 - name: Install WordPress 150 run: npm run env:install 151 152 - name: Install WordPress Importer plugin 153 run: npm run env:cli -- plugin install wordpress-importer --activate --path=/var/www/${{ env.LOCAL_DIR }} 154 155 - name: Import mock data 156 run: | 157 curl -O https://raw.githubusercontent.com/WordPress/theme-test-data/b9752e0533a5acbb876951a8cbb5bcc69a56474c/themeunittestdata.wordpress.xml 158 npm run env:cli -- import themeunittestdata.wordpress.xml --authors=create --path=/var/www/${{ env.LOCAL_DIR }} 159 rm themeunittestdata.wordpress.xml 160 161 - name: Deactivate WordPress Importer plugin 162 run: npm run env:cli -- plugin deactivate wordpress-importer --path=/var/www/${{ env.LOCAL_DIR }} 163 164 - name: Update permalink structure 165 run: npm run env:cli -- rewrite structure '/%year%/%monthnum%/%postname%/' --path=/var/www/${{ env.LOCAL_DIR }} 166 167 - name: Install additional languages 168 run: | 169 npm run env:cli -- language core install de_DE --path=/var/www/${{ env.LOCAL_DIR }} 170 npm run env:cli -- language plugin install de_DE --all --path=/var/www/${{ env.LOCAL_DIR }} 171 npm run env:cli -- language theme install de_DE --all --path=/var/www/${{ env.LOCAL_DIR }} 172 173 # Prevent background update checks from impacting test stability. 174 - name: Disable external HTTP requests 175 run: npm run env:cli -- config set WP_HTTP_BLOCK_EXTERNAL true --raw --type=constant --path=/var/www/${{ env.LOCAL_DIR }} 176 177 # Prevent background tasks from impacting test stability. 178 - name: Disable cron 179 run: npm run env:cli -- config set DISABLE_WP_CRON true --raw --type=constant --path=/var/www/${{ env.LOCAL_DIR }} 180 181 - name: List defined constants 182 run: npm run env:cli -- config list --path=/var/www/${{ env.LOCAL_DIR }} 183 184 - name: Install MU plugin 185 run: | 186 mkdir ./${{ env.LOCAL_DIR }}/wp-content/mu-plugins 187 cp ./tests/performance/wp-content/mu-plugins/server-timing.php ./${{ env.LOCAL_DIR }}/wp-content/mu-plugins/server-timing.php 188 189 - name: Run performance tests (current commit) 190 run: npm run test:performance 191 192 - name: Download previous build artifact (target branch or previous commit) 193 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 194 id: get-previous-build 195 with: 196 script: | 197 const artifacts = await github.rest.actions.listArtifactsForRepo({ 198 owner: context.repo.owner, 199 repo: context.repo.repo, 200 name: 'wordpress-build-' + process.env.TARGET_SHA, 201 }); 202 203 const matchArtifact = artifacts.data.artifacts[0]; 204 205 if ( ! matchArtifact ) { 206 core.setFailed( 'No artifact found!' ); 207 return false; 208 } 209 210 const download = await github.rest.actions.downloadArtifact( { 211 owner: context.repo.owner, 212 repo: context.repo.repo, 213 artifact_id: matchArtifact.id, 214 archive_format: 'zip', 215 } ); 216 217 const fs = require( 'fs' ); 218 fs.writeFileSync( '${{ github.workspace }}/before.zip', Buffer.from( download.data ) ) 219 220 return true; 221 222 - name: Unzip the build 223 if: ${{ steps.get-previous-build.outputs.result }} 224 run: | 225 unzip ${{ github.workspace }}/before.zip 226 unzip -o ${{ github.workspace }}/wordpress.zip 227 228 - name: Run any database upgrades 229 if: ${{ steps.get-previous-build.outputs.result }} 230 run: npm run env:cli -- core update-db --path=/var/www/${{ env.LOCAL_DIR }} 231 232 - name: Flush cache 233 if: ${{ steps.get-previous-build.outputs.result }} 234 run: npm run env:cli -- cache flush --path=/var/www/${{ env.LOCAL_DIR }} 235 236 - name: Delete expired transients 237 if: ${{ steps.get-previous-build.outputs.result }} 238 run: npm run env:cli -- transient delete --expired --path=/var/www/${{ env.LOCAL_DIR }} 239 240 - name: Run target performance tests (previous/target commit) 241 if: ${{ steps.get-previous-build.outputs.result }} 242 env: 243 TEST_RESULTS_PREFIX: before 244 run: npm run test:performance 245 246 - name: Set the environment to the baseline version 247 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' }} 248 run: | 249 npm run env:cli -- core update --version=${{ env.BASE_TAG }} --force --path=/var/www/${{ env.LOCAL_DIR }} 250 npm run env:cli -- core version --path=/var/www/${{ env.LOCAL_DIR }} 251 252 - name: Run any database upgrades 253 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' }} 254 run: npm run env:cli -- core update-db --path=/var/www/${{ env.LOCAL_DIR }} 255 256 - name: Flush cache 257 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' }} 258 run: npm run env:cli -- cache flush --path=/var/www/${{ env.LOCAL_DIR }} 259 260 - name: Delete expired transients 261 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' }} 262 run: npm run env:cli -- transient delete --expired --path=/var/www/${{ env.LOCAL_DIR }} 263 264 - name: Run baseline performance tests 265 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' }} 266 env: 267 TEST_RESULTS_PREFIX: base 268 run: npm run test:performance 269 270 - name: Archive artifacts 271 uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 272 if: always() 273 with: 274 name: performance-artifacts${{ inputs.memcached && '-memcached' || '' }}-${{ github.run_id }} 275 path: artifacts 276 if-no-files-found: ignore 277 278 - name: Compare results 279 run: node ./tests/performance/compare-results.js ${{ runner.temp }}/summary.md 280 281 - name: Add workflow summary 282 run: cat ${{ runner.temp }}/summary.md >> $GITHUB_STEP_SUMMARY 283 284 - name: Set the base sha 285 # Only needed when publishing results. 286 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' && ! inputs.memcached }} 287 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 288 id: base-sha 289 with: 290 github-token: ${{ secrets.GITHUB_TOKEN }} 291 script: | 292 const baseRef = await github.rest.git.getRef({ owner: context.repo.owner, repo: context.repo.repo, ref: 'tags/${{ env.BASE_TAG }}' }); 293 return baseRef.data.object.sha; 294 295 - name: Set commit details 296 # Only needed when publishing results. 297 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' && ! inputs.memcached }} 298 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 299 id: commit-timestamp 300 with: 301 github-token: ${{ secrets.GITHUB_TOKEN }} 302 script: | 303 const commit_details = await github.rest.git.getCommit({ owner: context.repo.owner, repo: context.repo.repo, commit_sha: context.sha }); 304 return parseInt((new Date( commit_details.data.author.date ).getTime() / 1000).toFixed(0)) 305 306 - name: Publish performance results 307 # Only publish results on pushes to trunk. 308 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' && ! inputs.memcached }} 309 env: 310 BASE_SHA: ${{ steps.base-sha.outputs.result }} 311 COMMITTED_AT: ${{ steps.commit-timestamp.outputs.result }} 312 CODEVITALS_PROJECT_TOKEN: ${{ secrets.CODEVITALS_PROJECT_TOKEN }} 313 HOST_NAME: "www.codevitals.run" 314 run: node ./tests/performance/log-results.js $CODEVITALS_PROJECT_TOKEN trunk $GITHUB_SHA $BASE_SHA $COMMITTED_AT $HOST_NAME 315 316 - name: Ensure version-controlled files are not modified or deleted 317 run: git diff --exit-code -
new file .github/workflows/reusable-php-compatibility.yml
diff --git a/.github/workflows/reusable-php-compatibility.yml b/.github/workflows/reusable-php-compatibility.yml new file mode 100644 index 000000000000..7aaa42d26547
- + 1 ## 2 # A reusable workflow that runs PHP compatibility tests. 3 ## 4 name: PHP Compatibility 5 6 on: 7 workflow_call: 8 inputs: 9 php-version: 10 description: 'The PHP version to use.' 11 required: false 12 type: 'string' 13 default: 'latest' 14 15 jobs: 16 # Runs PHP compatibility tests. 17 # 18 # Violations are reported inline with annotations. 19 # 20 # Performs the following steps: 21 # - Checks out the repository. 22 # - Sets up PHP. 23 # - Logs debug information. 24 # - Configures caching for PHP compatibility scans. 25 # - Installs Composer dependencies. 26 # - Make Composer packages available globally. 27 # - Runs the PHP compatibility tests. 28 # - Generate a report for displaying issues as pull request annotations. 29 # - Ensures version-controlled files are not modified or deleted. 30 php-compatibility: 31 name: Run compatibility checks 32 runs-on: ubuntu-latest 33 permissions: 34 contents: read 35 timeout-minutes: 20 36 37 steps: 38 - name: Checkout repository 39 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 40 with: 41 show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} 42 43 - name: Set up PHP 44 uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2.30.0 45 with: 46 php-version: ${{ inputs.php-version }} 47 coverage: none 48 tools: cs2pr 49 50 - name: Log debug information 51 run: | 52 composer --version 53 54 # This date is used to ensure that the PHP compatibility cache is cleared at least once every week. 55 # http://man7.org/linux/man-pages/man1/date.1.html 56 - name: "Get last Monday's date" 57 id: get-date 58 run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT 59 60 - name: Cache PHP compatibility scan cache 61 uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1 62 with: 63 path: .cache/phpcompat.json 64 key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcompat-cache-${{ hashFiles('**/composer.json', 'phpcompat.xml.dist') }} 65 66 # Since Composer dependencies are installed using `composer update` and no lock file is in version control, 67 # passing a custom cache suffix ensures that the cache is flushed at least once per week. 68 - name: Install Composer dependencies 69 uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a # v3.0.0 70 with: 71 custom-cache-suffix: ${{ steps.get-date.outputs.date }} 72 73 - name: Make Composer packages available globally 74 run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH 75 76 - name: Run PHP compatibility tests 77 id: phpcs 78 run: phpcs --standard=phpcompat.xml.dist --report-full --report-checkstyle=./.cache/phpcs-compat-report.xml 79 80 - name: Show PHPCompatibility results in PR 81 if: ${{ always() && steps.phpcs.outcome == 'failure' }} 82 run: cs2pr ./.cache/phpcs-compat-report.xml 83 84 - name: Ensure version-controlled files are not modified or deleted 85 run: git diff --exit-code -
.yml
diff --git a/.github/workflows/phpunit-tests-run.yml b/.github/workflows/reusable-phpunit-tests.yml similarity index 99% rename from .github/workflows/phpunit-tests-run.yml rename to .github/workflows/reusable-phpunit-tests.yml index 9978fd9bf70f..60949915e4d1 100644
old new 1 1 ## 2 # A callable workflow that runs the PHPUnit test suite with the specified configuration.2 # A reusable workflow that runs the PHPUnit test suite with the specified configuration. 3 3 ## 4 4 name: Run PHPUnit tests 5 5 -
.yml
diff --git a/.github/workflows/callable-test-core-build-process.yml b/.github/workflows/reusable-test-core-build-process.yml similarity index 92% rename from .github/workflows/callable-test-core-build-process.yml rename to .github/workflows/reusable-test-core-build-process.yml index 7c2bd9c80c75..caeb7afab755 100644
old new 1 1 ## 2 # A callable workflow that tests the WordPress Core build process.2 # A reusable workflow that tests the WordPress Core build process. 3 3 ## 4 4 name: Test the WordPress Build Process 5 5 … … on: 16 16 required: false 17 17 type: 'string' 18 18 default: 'src' 19 test-emoji: 20 description: 'Whether to run the grunt precommit:emoji script.' 21 required: false 22 type: 'boolean' 23 default: true 19 24 20 25 env: 21 26 PUPPETEER_SKIP_DOWNLOAD: ${{ true }} … … jobs: 62 67 run: npm ci 63 68 64 69 - name: Run Emoji precommit task 70 if: ${{ inputs.test-emoji }} 65 71 run: npm run grunt precommit:emoji 66 72 env: 67 73 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} -
.yml
diff --git a/.github/workflows/callable-test-gutenberg-build-process.yml b/.github/workflows/reusable-test-gutenberg-build-process.yml similarity index 98% rename from .github/workflows/callable-test-gutenberg-build-process.yml rename to .github/workflows/reusable-test-gutenberg-build-process.yml index 755b169caee9..150e40d10911 100644
old new 1 1 ## 2 # A callable workflow that tests the Gutenberg plugin build process when run within a wordpress-develop checkout.2 # A reusable workflow that tests the Gutenberg plugin build process when run within a wordpress-develop checkout. 3 3 ## 4 4 name: Test the Gutenberg plugin Build Process 5 5 -
.yml
diff --git a/.github/workflows/upgrade-testing-run.yml b/.github/workflows/reusable-upgrade-testing.yml similarity index 98% rename from .github/workflows/upgrade-testing-run.yml rename to .github/workflows/reusable-upgrade-testing.yml index 0235d38f95b7..8e467c20ccbc 100644
old new 1 # A callable workflow that runs WordPress upgrade testing under the conditions provided.1 # A reusable workflow that runs WordPress upgrade testing under the conditions provided. 2 2 name: Upgrade Tests 3 3 4 4 on: -
.github/workflows/test-build-processes.yml
diff --git a/.github/workflows/test-build-processes.yml b/.github/workflows/test-build-processes.yml index e768c01a0b3e..587d5389c6b1 100644
a b jobs: 31 31 # Tests the WordPress Core build process on multiple operating systems. 32 32 test-core-build-process: 33 33 name: Core running from ${{ matrix.directory }} 34 uses: WordPress/wordpress-develop/.github/workflows/callable-test-core-build-process.yml@trunk34 uses: desrosj/wordpress-develop/.github/workflows/reusable-test-core-build-process.yml@try/make-workflows-callable 35 35 permissions: 36 36 contents: read 37 37 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} … … jobs: 54 54 # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability. 55 55 test-core-build-process-macos: 56 56 name: Core running from ${{ matrix.directory }} 57 uses: WordPress/wordpress-develop/.github/workflows/callable-test-core-build-process.yml@trunk57 uses: desrosj/wordpress-develop/.github/workflows/reusable-test-core-build-process.yml@try/make-workflows-callable 58 58 permissions: 59 59 contents: read 60 60 if: ${{ github.repository == 'WordPress/wordpress-develop' }} … … jobs: 70 70 # Tests the Gutenberg plugin build process on multiple operating systems when run within a wordpress-develop checkout. 71 71 test-gutenberg-build-process: 72 72 name: Gutenberg running from ${{ matrix.directory }} 73 uses: WordPress/wordpress-develop/.github/workflows/callable-test-gutenberg-build-process.yml@trunk73 uses: desrosj/wordpress-develop/.github/workflows/reusable-test-gutenberg-build-process.yml@try/make-workflows-callable 74 74 permissions: 75 75 contents: read 76 76 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} … … jobs: 93 93 # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability. 94 94 test-gutenberg-build-process-macos: 95 95 name: Gutenberg running from ${{ matrix.directory }} 96 uses: WordPress/wordpress-develop/.github/workflows/callable-test-gutenberg-build-process.yml@trunk96 uses: desrosj/wordpress-develop/.github/workflows/reusable-test-gutenberg-build-process.yml@try/make-workflows-callable 97 97 permissions: 98 98 contents: read 99 99 if: ${{ github.repository == 'WordPress/wordpress-develop' }} -
.github/workflows/upgrade-testing.yml
diff --git a/.github/workflows/upgrade-testing.yml b/.github/workflows/upgrade-testing.yml index fe2d4dc24fae..54ddb6d507d4 100644
a b jobs: 35 35 # Spawns upgrade testing from WordPress 6.x versions with MySQL. 36 36 upgrade-tests-wp-6x-mysql: 37 37 name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }} 38 uses: WordPress/wordpress-develop/.github/workflows/upgrade-testing-run.yml@trunk38 uses: desrosj/wordpress-develop/.github/workflows/reusable-upgrade-testing.yml@try/make-workflows-callable 39 39 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} 40 40 permissions: 41 41 contents: read … … jobs: 60 60 # Spawns upgrade testing from WordPress 5.x versions on PHP 7.x with MySQL. 61 61 upgrade-tests-wp-5x-php-7x-mysql: 62 62 name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }} 63 uses: WordPress/wordpress-develop/.github/workflows/upgrade-testing-run.yml@trunk63 uses: desrosj/wordpress-develop/.github/workflows/reusable-upgrade-testing.yml@try/make-workflows-callable 64 64 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} 65 65 strategy: 66 66 fail-fast: false … … jobs: 87 87 # - array/string offset with curly braces. 88 88 upgrade-tests-wp-5x-php-8x-mysql: 89 89 name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }} 90 uses: WordPress/wordpress-develop/.github/workflows/upgrade-testing-run.yml@trunk90 uses: desrosj/wordpress-develop/.github/workflows/reusable-upgrade-testing.yml@try/make-workflows-callable 91 91 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} 92 92 strategy: 93 93 fail-fast: false … … jobs: 110 110 # Spawns upgrade testing from WordPress 4.x versions on PHP 7.x with MySQL. 111 111 upgrade-tests-wp-4x-php-7x-mysql: 112 112 name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }} 113 uses: WordPress/wordpress-develop/.github/workflows/upgrade-testing-run.yml@trunk113 uses: desrosj/wordpress-develop/.github/workflows/reusable-upgrade-testing.yml@try/make-workflows-callable 114 114 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} 115 115 strategy: 116 116 fail-fast: false … … jobs: 137 137 # - array/string offset with curly braces. 138 138 upgrade-tests-wp-4x-php-8x-mysql: 139 139 name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }} 140 uses: WordPress/wordpress-develop/.github/workflows/upgrade-testing-run.yml@trunk140 uses: desrosj/wordpress-develop/.github/workflows/reusable-upgrade-testing.yml@try/make-workflows-callable 141 141 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} 142 142 strategy: 143 143 fail-fast: false
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)