148 Commits

Author SHA1 Message Date
Jonathan Desrosiers
b6f9fff7c3 Build/Test Tools: Update third-party GitHub Actions.
This updates the following third-party GitHub Actions to their latest versions.

- `actions/cache`
- `actions/checkout`
- `actions/upload-artifact`
- `actions/setup-node`
- `actions/setup-php`
- `actions/github-script`

See #57572.

git-svn-id: https://develop.svn.wordpress.org/trunk@55152 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-27 19:23:20 +00:00
Peter Wilson
ac587db08b Build/Test tools: Remove 3.7-4.0 branches from scheduled test runs.
We're gonna teach 'em how to say goodbye (teach 'em how to say goodbye)
Teach 'em how
To say goodbye
To say goodbye (say goodbye)
Say goodbye (say goodbye)
One last time

Fixes #57228.



git-svn-id: https://develop.svn.wordpress.org/trunk@54995 602fd350-edb4-49c9-b593-d223f7449a82
2022-12-15 05:02:04 +00:00
Jonathan Desrosiers
40c097e0d0 Build/Test Tools: Run Xdebug tests on PHP 8.2.
Xdebug 3.2.0 (which adds support for PHP 8.2) has been released and is now included in the PHP 8.2 Docker container.

The tests in the `xdebug` group can now be run against all PHP versions currently supported by WordPress.

See https://github.com/WordPress/wpdev-docker-images/pull/92.

See #56009.

git-svn-id: https://develop.svn.wordpress.org/trunk@54967 602fd350-edb4-49c9-b593-d223f7449a82
2022-12-14 00:22:53 +00:00
Jonathan Desrosiers
1e65a9a78b Build/Test Tools: Improve caching for PHPCS.
This improves the speed of the PHPCS scans between workflow runs in GitHub Action by creating a scan cache file for each unique set of arguments passed to `phpcs`.

Props jrf.
Fixes #57148. See #53841.

git-svn-id: https://develop.svn.wordpress.org/trunk@54921 602fd350-edb4-49c9-b593-d223f7449a82
2022-12-01 20:11:48 +00:00
Jonathan Desrosiers
4b5931521b Build/Test Tools: Improve how Composer dependencies are installed.
To improve how Composer dependencies are installed and managed within GitHub Actions, the `ramsey/composer-install` third-party action is now used consistently throughout all workflows.

Previously, some workflows manually ran `composer` commands while others already used `ramsey/composer-install`.

The `ramsey/composer-install` action manages caching dependencies across workflow runs internally, which is something that was manually handled before this change.

Props jrf, desrosj.
Fixes #53841.

git-svn-id: https://develop.svn.wordpress.org/trunk@54856 602fd350-edb4-49c9-b593-d223f7449a82
2022-11-18 14:50:52 +00:00
Jonathan Desrosiers
4e72f78c75 Build/Test Tools: Add additional details why MacOS jobs are separate.
This adds additional inline context as to why the MacOS job is separate from the Windows and Ubuntu ones in the Test npm workflow.

While it is preferable to combine all of these to avoid repeated code, there is currently no way to determine the runner’s OS within the `if` workflow key.

MacOS jobs use GitHub Action minutes at by a multiple of 10. Being more strict about when to run these jobs ensures minutes are not unintentionally consumed within private forks and mirrors.

See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability for more details.

See #56793.

git-svn-id: https://develop.svn.wordpress.org/trunk@54852 602fd350-edb4-49c9-b593-d223f7449a82
2022-11-16 20:55:34 +00:00
Jonathan Desrosiers
7fbcfef25c Build/Test Tools: Various minor GitHub Action improvements.
This applies several types of improvements to GitHub Action workflows:
- Updates to inline documentation to ensure accuracy.
- Removal of repetitive or unnecessary debug logging.
- Reorganization of some steps to have configuration steps towards the beginning of jobs.
- Step name updates for consistency across workflows.

Props desrosj, jrf.
See #56793.

git-svn-id: https://develop.svn.wordpress.org/trunk@54851 602fd350-edb4-49c9-b593-d223f7449a82
2022-11-16 19:32:57 +00:00
Jonathan Desrosiers
50ebc187ab Build/Test Tools: Fix more set-output deprecated warnings.
This updates the `ramsey/composer-install` and `shivammathur/setup-php` actions to their latest versions.

These updates include fixes for the deprecated warnings output when using `set-output` and `save-state` commands.

Props jrf, desrosj.
See #56820, #56882, #56793.

git-svn-id: https://develop.svn.wordpress.org/trunk@54750 602fd350-edb4-49c9-b593-d223f7449a82
2022-11-04 14:39:00 +00:00
Jonathan Desrosiers
6226440bda Build/Test Tools: Don’t ZIP theme ZIP files.
When uploading artifacts during GitHub Action workflows, all files uploaded to an artifact name are zipped. When a ZIP file is uploaded, the result is a horrifying state of ZIP-ception.

This changes the workflow to upload all of the needed theme files to the artifact instead of a singular ZIP file created prior to uploading.

This also fixes a bug where ZIP files generated have the desired theme nested within `src/wp-content/themes` instead of just containing the theme files.

Props ndiego, wildworks, desrosj, bgardner, colorful-tones.
Fixes #56898.

git-svn-id: https://develop.svn.wordpress.org/trunk@54740 602fd350-edb4-49c9-b593-d223f7449a82
2022-11-01 19:18:50 +00:00
Jonathan Desrosiers
b71a7bfcff Build/Test Tools: Introduce a workflow for testing and building default themes.
This introduces a GitHub Action workflow that performs the following steps for default themes:

- Test installing npm dependencies and running the build script (for relevant themes).
- Create ZIP files for the .org Theme directory and uploads them as workflow artifacts.

The workflow will only run on limited occasions, one of those being when Twenty Nineteen, Twenty Twenty, or Twenty Twenty-One is edited. These are the themes with build scripts that need to be tested for issues.

It can also be manually run through the GitHub Actions UI for occasions when the ZIP files are needed for a release.

Props peterwilsoncc, desrosj
Fixes #56898.

git-svn-id: https://develop.svn.wordpress.org/trunk@54699 602fd350-edb4-49c9-b593-d223f7449a82
2022-10-26 15:06:21 +00:00
Jonathan Desrosiers
28061cb869 Build/Test Tools: Ensure PHPCS related workflows are properly marked as failed.
When a ruleset error is encountered during a PHPCodeSniffer scan, an XML report is not generated and `cs2pr` will exit with a `0`.

In this situation, a workflow run will be marked as passing (even though a failure has occurred) due to the presence of `continue-on-error`.

This adjusts the logic in the Coding Standards and PHP Compatibility workflows to remove the need for the `continue-on-error` option and ensures all failures are accurately reflected within the GitHub Actions UI.

Follow up to [54371].

Props jrf, TobiasBg.
See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@54678 602fd350-edb4-49c9-b593-d223f7449a82
2022-10-24 16:47:15 +00:00
Jonathan Desrosiers
0c3cdb9a90 Build/Test Tools: Hardcode the ref for the workflow dispatch on failure.
This removes the dynamic aspect of the `createWorkflowDispatch()` call that dispatches a Failed Workflow run when another workflow encounters an issue.

By hardcoding `trunk` as the `ref`, the version of the workflow used will always be the latest, most up to date. This ensures older branches receive the bug fixes and improvements made in `trunk` without having to backport them.

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@54674 602fd350-edb4-49c9-b593-d223f7449a82
2022-10-24 15:18:37 +00:00
Jonathan Desrosiers
57b2fe5372 Build/Test Tools: Update third-party welcome Action.
This updates the third-party action used to post a welcome message to pull requests opened by first time contributors.

This release updates the action to use Node.js version 16 instead of 12, the latter of which support has been deprecated for in GitHub Action runners.

The action has also changed from `bukboo/welcome-action` to `wow-action/welcome`.

See #56793.

git-svn-id: https://develop.svn.wordpress.org/trunk@54651 602fd350-edb4-49c9-b593-d223f7449a82
2022-10-19 18:26:29 +00:00
Jonathan Desrosiers
16699c3868 General: Correctly refer to “npm” and “Node.js”.
This update all references to npm and Node.js to their correct spelling.

Fixes #56816.

git-svn-id: https://develop.svn.wordpress.org/trunk@54650 602fd350-edb4-49c9-b593-d223f7449a82
2022-10-19 18:18:45 +00:00
Jonathan Desrosiers
47af196e14 Build/Test Tools: Remove use of set-output in Action workflows.
The `save-state` and `set-output` commands have been deprecated in GitHub Actions. This removes all occurrences of the command within workflow steps.

This will not remove all deprecated notices from workflow summaries (some third-party actions still contain instances of these commands and need to be fixed upstream), but it will fix the notices caused by custom workflow code.

See #56820.

git-svn-id: https://develop.svn.wordpress.org/trunk@54649 602fd350-edb4-49c9-b593-d223f7449a82
2022-10-19 18:10:43 +00:00
David Baumwald
e0f63b46d4 Trunk is now 6.2 alpha.
git-svn-id: https://develop.svn.wordpress.org/trunk@54642 602fd350-edb4-49c9-b593-d223f7449a82
2022-10-18 20:03:57 +00:00
Jonathan Desrosiers
fe58b3e518 Build/Test Tools: Update third-party GitHub Actions.
This updates the following third-party actions to their latest versions:

- `actions/cache`
- `actions/checkout`
- `actions/setup-node`
- `actions/github-script`
- `slackapi/slack-github-action`

The latest versions of these actions fix the warnings that are being triggered after the deprecation of `set-output` and `save-state` on GitHub Actions.

For more information, see https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/.

See #56820.

git-svn-id: https://develop.svn.wordpress.org/trunk@54511 602fd350-edb4-49c9-b593-d223f7449a82
2022-10-13 17:49:07 +00:00
Jonathan Desrosiers
cfe4548fde Build/Test Tools: Remove note about some PHP versions being allowed to fail.
This removes the note stating that PHP 8.1 (see [51604]) and 8.2 (see [53922]) are temporarily allowed to fail.

The compatibility issues were resolved and `continue-on-error` was removed in [53922].

See #56009.

git-svn-id: https://develop.svn.wordpress.org/trunk@54507 602fd350-edb4-49c9-b593-d223f7449a82
2022-10-13 14:28:04 +00:00
Jonathan Desrosiers
074a0ab820 Build/Test Tools: Update github-script action to the latest version.
The latest version of the `actions/github-script` action fixes an issue where passing options to the action would remove any default values not passed (see https://github.com/actions/github-script/pull/293).

This also includes updates to other third-party actions, bringing all third-party versions in Core workflows to their latest versions:
- `actions/cache`
- `actions/setup-node`
- `codecov/codecov-action`

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@54373 602fd350-edb4-49c9-b593-d223f7449a82
2022-10-04 01:25:42 +00:00
Jonathan Desrosiers
681317b998 Build/Test Tools: Display PHPCS results in the GitHub Action logs.
When running PHPCS scans (both for checking coding standards and PHP version compatibility), the results are currently only returned silently in a format that GitHub can consume for contextually annotating any code being flagged.

This changes workflows using PHPCS to also display the results of each scan in the GitHub Action log, making it easier to find and understand what is causing failures.

Props jrf.
See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@54371 602fd350-edb4-49c9-b593-d223f7449a82
2022-10-04 00:43:30 +00:00
Sergey Biryukov
108574a053 Build/Test Tools: Remove PHP 8.1 and 8.2 from allowed failures.
With all known unit test failures now addressed, WordPress 6.1 aims to support PHP 8.1 and 8.2 as much as possible.

While full compatibility with PHP 8.1 and 8.2 is still a work in progress, this commit aims to actively prevent new PHP issues from being introduced in WordPress core.

All remaining known issues are deprecation notices. Please note, a deprecation notice is not an error, but rather an indicator of where additional work is needed for compatibility before PHP 9 (i.e. when the notices become fatal errors). With a deprecation notice, the PHP code will continue to work and nothing is broken.

Follow-up to [49077], [49162], [50299], [51588], [51604], [53922], [54072].

Props jrf, desrosj.
See #55652, #55656, #56009, #56681.

git-svn-id: https://develop.svn.wordpress.org/trunk@54369 602fd350-edb4-49c9-b593-d223f7449a82
2022-10-03 16:01:57 +00:00
Jonathan Desrosiers
d3c4fc0df9 Build/Test Tools: Remove the retryAfter input.
This was included in the original pull request that aimed to add support for `octokit/plugin-retry.js` in `actions/github-scripts`, but was actually removed before being merged.

Follow up to [54342].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@54343 602fd350-edb4-49c9-b593-d223f7449a82
2022-09-28 02:20:32 +00:00
Jonathan Desrosiers
331ecedc06 Build/Test Tools: Update actions/github-scripts to the latest version.
This version adds support for `octokit/plugin-retry.js`, which retries requests automatically when `4xx` or `5xx` response codes are returned.

To start, the feature is configured to retry all `4xx` and `5xx` response codes, unless the server identifies as a teapot.

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@54342 602fd350-edb4-49c9-b593-d223f7449a82
2022-09-28 01:53:48 +00:00
Jonathan Desrosiers
9d4750abd0 Build/Test Tools: Remove unnecessary --no-interaction option from Composer commands.
As of version `2.17.0` of the `shivammathur/setup-php` action, the `COMPOSER_NO_INTERACTION` environment variable is configured by default. `—-no-interaction` will always be used.

Props jrf, hellofromTonya, SergeyBiryukov, costdev, desrosj.
Fixes #54695.

git-svn-id: https://develop.svn.wordpress.org/trunk@54313 602fd350-edb4-49c9-b593-d223f7449a82
2022-09-26 19:15:05 +00:00
Jonathan Desrosiers
c617ec0341 Build/Test Tools: Test building WordPress to run from src first.
Because of the scripts that run when `build:dev` is run, it’s more common for this Grunt task to change version-controlled files than when building WordPress to run from `build`.

This moves the `build:dev` tests before the `build` ones in order to detect changes earlier in the workflow.

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@54297 602fd350-edb4-49c9-b593-d223f7449a82
2022-09-23 20:03:00 +00:00
Jonathan Desrosiers
310a5b8a7c Build/Test Tools: Increase the timeout value for MacOS jobs.
The current `timeout-minutes` value of `20` is a bit too short for MacOS jobs in GitHub Actions, which on occasion take a bit longer.

This bumps that limit to `30` to avoid unnecessarily flagging a job as stuck.

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@54293 602fd350-edb4-49c9-b593-d223f7449a82
2022-09-23 17:01:46 +00:00
Greg Ziółkowski
108c92d8dd Build: Improve how combined assets are generated
Allows to revert changes applied in [54277] - temporary workaround for the failing Test NPM CI check on Windows.

Improvements included:
- generate combined asset files for both production and development
- store in the repository only the production version of the combined assets for packages, we use everything else only in development
- to make unit tests work, ensure that they ignore react fast refresh and use the production version of combined assets that are present in the source code

Props bernhard-reiter, jsnajdr, clorith, wildworks.
Fixes #56615.



git-svn-id: https://develop.svn.wordpress.org/trunk@54289 602fd350-edb4-49c9-b593-d223f7449a82
2022-09-23 08:25:45 +00:00
Jonathan Desrosiers
257a83b2e5 Build/Test Tools: Temporarily allow the NPM testing workflow to fail.
This changes the Test NPM GitHub Action workflow to temporarily allow the job validating build tools on Windows to fail.

When the `build:dev` Grunt task is run on Windows, the resulting hashes calculated by Webpack are different than other platforms. This seems to be related to how the `remove-accents` dependency is read and processed during the build script.

Since a Windows machine is not used to build WordPress on the build server, this will only affect local development installs for Windows contributors. While this is investigated, this workflow job can be allowed to fail.

Props bernhard-reiter, desrosj, Clorith, gziolo.
See #56615.

git-svn-id: https://develop.svn.wordpress.org/trunk@54277 602fd350-edb4-49c9-b593-d223f7449a82
2022-09-21 14:26:42 +00:00
Jonathan Desrosiers
55bdc301e2 Build/Test Tools: Enable debugging when rerunning a failed workflow.
Follow up to [53947], [54039].

Fixes #56407.

git-svn-id: https://develop.svn.wordpress.org/trunk@54264 602fd350-edb4-49c9-b593-d223f7449a82
2022-09-20 16:54:29 +00:00
Jonathan Desrosiers
8f87e05783 Build/Test Tools: Use the default GITHUB_TOKEN instead of a personal access token.
Previously, it was not possible to use the default `GITHUB_TOKEN` token to create new workflow runs in an effort to prevent accidental recursive workflows.

This has changed, and the `workflow_dispatch` is now one of two exceptions to this rule. Using `GITHUB_TOKEN` is preferred whenever possible to avoid the need for a PAT (personal access token), which expires (when created using the recommended security best practices), and is tied to an individual user.

See https://github.blog/changelog/2022-09-08-github-actions-use-github_token-with-workflow_dispatch-and-repository_dispatch/.

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@54108 602fd350-edb4-49c9-b593-d223f7449a82
2022-09-08 23:39:17 +00:00
Sergey Biryukov
10f6d876c9 Build/Test Tools: Do not allow tests to fail for select PHP 8.1 test runs.
This affects the following test groups:
* Ajax tests
* ms-files tests
* External HTTP tests
* Xdebug tests

The tests being run in these particular test groups are passing on PHP 8.1, however, the test runs are still allowed to “continue on error”. This creates the risk that new PHP 8.1 incompatibilities will be introduced without anyone noticing.

By no longer allowing these test runs to “continue on error”, that risk is removed.

Follow-up to [51588], [51604], [53922].

Props jrf.
See #55656, #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@54072 602fd350-edb4-49c9-b593-d223f7449a82
2022-09-05 18:55:08 +00:00
Jonathan Desrosiers
69b9ecc54e Build/Test Tools: Correct the context variable being used when auto-retrying failed and cancelled workflows.
The correct variable here is `github.run_attempt`, which represents the unique number for each attempt of a particular workflow run in a repository.

The `github.run_number` currently being used represents the unique number for each run of a particular workflow in a repository.

Follow up to [53947].

Fixes #56407.

git-svn-id: https://develop.svn.wordpress.org/trunk@54039 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-31 14:29:22 +00:00
Jonathan Desrosiers
63a5a3c464 Build/Test Tools: Automatically rerun a workflow the first time it fails.
There are several common reoccurring issues that sometimes cause GitHub Action workflows to fail (connection timeouts to WordPress.org or the Docker container registry, `npm install` failures, Chromium issues, etc.). Except when there are service level outages, most of these issues can be resolved by simply rerunning the workflow.

This introduces a new step within each of Core’s GitHub Action workflows that attempts to rerun the failed jobs within the workflow that encountered a failure if they are running for the first time. Since a workflow is not allowed to restart itself, a new `failed-workflow.yml` callable workflow is being introduced.

Other related adjustments in this changeset:
- The `actions/github-script` 3rd-party action is also now updated to the latest version (v6.2.0).
- A new secret, `GHA_WORKFLOW_DISPATCH`, has been introduced. This will replace the current one in use (`GHA_OLD_BRANCH_DISPATCH`) with a less specific name.

Props jorbin, desrosj.
Fixes #56407.

git-svn-id: https://develop.svn.wordpress.org/trunk@53947 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-26 19:19:11 +00:00
Jonathan Desrosiers
193406ab64 Build/Test Tools: Update third-party GitHub Actions to latest versions.
Updated actions:
- `actions/cache`
- `actions/github-script`
- `actions/setup-node`
- `bubkoo/welcome-action`
- `shivammathur/setup-php`
- `slackapi/slack-github-action`

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53940 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-24 16:30:31 +00:00
Sergey Biryukov
f6e8153eb5 Build/Test Tools: Enable running the tests on PHP 8.2.
PHP 8.2 is expected to be released at the end of November 2022.

Enabling the tests to run in CI on PHP 8.2 allows WordPress core to start getting ready.

As an interim measure, while working through the PHP 8.1 and 8.2 issues, builds against these PHP versions are allowed to fail, so that they don't block PR merges in the Gutenberg project.

Notes:
* The `composer install` command for PHP 8.1 was still using the `--ignore-platform-reqs` option, while that has not been needed anymore for quite a while, so the condition is now reused for PHP 8.2.
* The `--ignore-platform...` option used for the install is now made more specific:
 * Composer 2.0 added a `--ignore-platform-req=...` option to selectively ignore platform requirements.
 * Composer 2.2 then added the ability to only ignore the upper bound of platform requirements by adding the `+` sign.
* Xdebug-related tests will not be run on PHP 8.2 at this time as the Docker image for PHP 8.2 does not contain Xdebug yet. Once a stable release of Xdebug 3.2.0 is available, it can be added to the Docker image and the test step can then be enabled for PHP 8.2.

References:

* [https://github.com/WordPress/wpdev-docker-images/pull/87 wpdev-docker-images PR #87: Add PHP 8.2 containers]
* [https://github.com/composer/composer/releases/tag/2.0.0 Composer 2.0 changelog]
* [https://github.com/composer/composer/releases/tag/2.2.0 Composer 2.2 changelog]
* [https://xdebug.org/announcements/2022-07-20 Xdebug 3.2.0alpha1 release notes]
* [https://xdebug.org/announcements/2022-07-25 Xdebug 3.2.0alpha2 release notes]

Follow-up to [49077], [49162], [50299], [51588], [51604].

Props jrf, desrosj.
See #56009.

git-svn-id: https://develop.svn.wordpress.org/trunk@53922 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-23 13:07:17 +00:00
Jonathan Desrosiers
c5b4cd8921 Build/Test Tools: Increase the Dependabot pull request limit for GitHub Actions.
This ensures updates for all 3rd party actions will be flagged when updates exist simultaneously.

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53899 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-16 17:22:43 +00:00
John Blackbourn
0e04c0a621 Build/Test Tools: Move the Memcached container into the Docker Compose config.
This allows a developer to use the persistent Memcached object cache on their local development environment via the `LOCAL_PHP_MEMCACHED` environment variable.

Enable the memcached config via `LOCAL_PHP_MEMCACHED=true` in the `.env` file and then restart the environment with `npm run env:restart`.

Fixes #55700


git-svn-id: https://develop.svn.wordpress.org/trunk@53895 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-13 23:23:26 +00:00
Jonathan Desrosiers
c48672bb83 Build/Test Tools: Add tag pattern matching for the testing NPM workflow.
This workflow was missed in [50298].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53737 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-20 18:50:36 +00:00
Jonathan Desrosiers
f6e21e2806 Build/Test Tools: Make the GitHub Action pattern matching for tags more specific.
This improves the tag pattern matching for GitHub Action workflows to be more specific. The `*` wildcard in the current patterns matches any character except slash (`/`). While this correctly matches a version like `X.Y.Z`, it could also match non-numeric characters.

This changes patterns to use the `+` character, which matches one or more of the preceding characters (`[0-9]` in this case).

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53736 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-20 18:39:16 +00:00
Jonathan Desrosiers
b2b8a0c3d2 Build/Test Tools: Correctly detect the first workflow run for a branch or tag.
When trying to determine the outcome of the previous run for a GitHub Action workflow, the current run is included in the list fetched from the GitHub API.

This adjusts the logic checking for the previous run to account for that and fixes notifications for the first workflow runs of a new branch or tag.

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53735 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-20 17:41:02 +00:00
Jonathan Desrosiers
d45bfba3bc Build/Test Tools: Correct some GitHub Action workflow inline documentation.
See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53592 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-30 15:07:49 +00:00
Jonathan Desrosiers
d75d6ca550 Build/Test Tools: Remove the workflow_run event from the Slack notification workflow.
The `workflow_run` event was added to restore Slack notifications for older branches (5.8 and older) without having to backport any changes while alternate approaches were explored.

The workflow has been tested and refined as a reusable one in `trunk`, and this approach is superior to the `workflow_run` event in several ways.

Primarily, the `workflow_run` event results in a separate workflow run being created for sending Slack notifications after the completion of each workflow triggered by `push`. When called as a reusable workflow, this does not happen and the additional jobs are instead added to the initial workflow. This makes which jobs are sending notifications for the current workflow more clear, and reduces the amount of noise (less workflow runs overall).

The `workflow_run` event also makes some data available in different ways than `push` events. By removing it, much of the logic within the workflow can be simplified.

See #56095.

git-svn-id: https://develop.svn.wordpress.org/trunk@53591 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-30 14:05:29 +00:00
Jonathan Desrosiers
a5b555aac3 Build/Test Tools: Update the actions/cache action.
This correctly updates the `actions/cache` action. [53581] updated the inline comment to the latest version but did not update the actual SHA value correctly.

Follow up to [53581].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53582 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-27 19:23:45 +00:00
Jonathan Desrosiers
6d9ede9285 Build/Test Tools: Update 3rd party GitHub Actions.
This updates the following GitHub Actions to the latest versions:

- `actions/checkout`
- `actions/cache`
- `actions/github-script`
- `actions/setup-node`
- `codecov/codecov-action`
- `shivammathur/setup-php`
- `slackapi/slack-github-action`

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53581 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-27 18:57:00 +00:00
Jonathan Desrosiers
b2f9e67757 Build/Test Tools: Return an error when uploading a test coverage report fails.
`true` is now passed to the `fail_ci_if_error` input when the `codecov/codecov-action` action is used.

When uploading a code coverage report is unsuccessful, the action will now fail and return an error. This will help avoid situations like #56022 where the report was suddenly failing to upload even though the workflow itself appeared to be successful.

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53554 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-22 00:18:42 +00:00
Jonathan Desrosiers
e902e52e95 Build/Test Tools: Allow changes to the code coverage workflow to run on pull request.
This adds the `pull_request` event to the Code Coverage Report workflow, allowing changes to be verified in a pull request before being committed.

The `branches` and `paths` filters are used to limit when the workflow runs to pull requests with:

- A base branch of `trunk`.
- Changing specific files that can potentially affect the way a coverage report is generated.

Reports generated on `pull_request` events are for testing purposes only and are not submitted to Codecov.

The `docker-compose.yml` file has also been added to the `paths` filter for both `push` and `pull_request` events. Changes to this file could potentially affect the environment used to generate the report (such as the ones in [53552]).

Props afragen, johnbillion, desrosj.
See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53553 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-21 23:59:29 +00:00
Jonathan Desrosiers
c40b46525c Build/Test Tools: Configure Xdebug modes in the local Docker environment.
One change in the update from Xdebug version 2.x to 3.x was a shift from enabling features to switching into modes.

When the version of Xdebug installed in the PHP 7.4 Docker container was updated from 2.x to 3.x, the code coverage reporting workflow stopped generating reports due to a lack of available coverage drivers.

This change adds the `XDEBUG_MODE` environment variable to the local Docker environment configuration to allow the active modes to be changed. This environment variable takes precedence over the `xdebug.mode` setting, but will not change the value of the `xdebug.mode` setting.

The `LOCAL_PHP_XDEBUG_MODE` environment variable has been added to the `.env` file and can be used to change the modes enabled in the Docker container. The code coverage reporting workflow uses this variable to enable the `coverage` mode, which is required for generating a test coverage report.

By default, `debug` and `debug modes are active, which enables the more commonly used features of Xdebug: development helpers and step debugging.

Props afragen, johnbillion, desrosj.
Fixes #56022.

git-svn-id: https://develop.svn.wordpress.org/trunk@53552 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-21 23:45:19 +00:00
Jonathan Desrosiers
ebfc6cdc82 Build/Test Tools: Adjust Slack notifications logic to account for expected non push events.
This adjusts the logic used to determine the outcome of the previous workflow run of the current one to account for `schedule` and `workflow_dispatch` events.

In the current state, only workflows triggered by `push` events are examined. This is causing failures when trying to post Slack notifications for the Test Coverage workflow, and inconsistent results for `workflow_dispatch` events when testing older branches on a schedule.

Follow up to [53466] and [53468].
See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53534 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-20 14:58:45 +00:00
Jonathan Desrosiers
60e80c1fd9 Build/Test Tools: Correctly confirm the previous workflow run was triggered by a push event.
This fixes the code added in [53466] to look at the correct workflow object when determining the outcome of the previous workflow run.

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53468 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-05 19:43:50 +00:00
Jonathan Desrosiers
47e7c8e01a Build/Test Tools: Prevent inaccurate “fixed” notifications in Slack.
When searching for previous workflow runs by branch, GitHub currently includes matches within forks.

If a contributor opens a pull request from their fork with a `head_ref` matching a Core branch that triggers a workflow on `push` event, the outcomes of the workflows associated with that pull request are currently used to determine if the previous workflow run had failed.

The result is a false “fixed” notifications when a commit immediately follows a failed workflow run from the pull request.

This adds a check to skip any workflow runs not triggered by a `push` event to prevent these inaccurate notifications.

Props SergeyBiryukov.
See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53466 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-05 09:29:53 +00:00