Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backporting GHA compatibility changes - 6.0 #3512

Closed
wants to merge 26 commits into from

Commits on Mar 6, 2023

  1. Build/Test Tools: Run the PHP container with PID > 1 so Ctrl+C works …

    …correctly.
    
    This allows for cancellation of operations in the PHP container, such as a PHPUnit test suite run.
    
    Fixes #55702
    
    
    git-svn-id: https://develop.svn.wordpress.org/trunk@53628 602fd350-edb4-49c9-b593-d223f7449a82
    johnbillion authored and desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    cd670ad View commit details
    Browse the repository at this point in the history
  2. Build/Test Tools: Enable loopback requests to work on the local devel…

    …opment environment.
    
    This maps `localhost` to the host machine so the requests get routed to the web server container.
    
    Props sandrasanzdev, hasanuzzamanshamim
    
    Fixes #52708
    
    
    git-svn-id: https://develop.svn.wordpress.org/trunk@53636 602fd350-edb4-49c9-b593-d223f7449a82
    johnbillion authored and desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    df27252 View commit details
    Browse the repository at this point in the history
  3. Build/Test Tools: Move the Memcached container into the Docker Compos…

    …e 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
    johnbillion authored and desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    f3796a8 View commit details
    Browse the repository at this point in the history
  4. 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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    140138e View commit details
    Browse the repository at this point in the history
  5. Build/Test Tools: Automatically rerun a workflow the first time it fa…

    …ils.
    
    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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    63f5e40 View commit details
    Browse the repository at this point in the history
  6. Build/Test Tools: Correct the context variable being used when auto-r…

    …etrying 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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    0a7e62a View commit details
    Browse the repository at this point in the history
  7. Build/Test Tools: Use the default GITHUB_TOKEN instead of a persona…

    …l 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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    9717726 View commit details
    Browse the repository at this point in the history
  8. 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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    4212757 View commit details
    Browse the repository at this point in the history
  9. 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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    fe7c9e6 View commit details
    Browse the repository at this point in the history
  10. Build/Test Tools: Remove unnecessary --no-interaction option from C…

    …omposer 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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    5f41fb5 View commit details
    Browse the repository at this point in the history
  11. 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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    f8a4d04 View commit details
    Browse the repository at this point in the history
  12. 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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    216035b View commit details
    Browse the repository at this point in the history
  13. 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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    160ba1f View commit details
    Browse the repository at this point in the history
  14. 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 actions/github-script#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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    a6c5845 View commit details
    Browse the repository at this point in the history
  15. 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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    e406791 View commit details
    Browse the repository at this point in the history
  16. 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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    22b095a View commit details
    Browse the repository at this point in the history
  17. 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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    57b6bc4 View commit details
    Browse the repository at this point in the history
  18. Build/Test Tools: Hardcode the ref for the workflow dispatch on fai…

    …lure.
    
    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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    5b71582 View commit details
    Browse the repository at this point in the history
  19. 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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    12ea0cb View commit details
    Browse the repository at this point in the history
  20. 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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    4d18726 View commit details
    Browse the repository at this point in the history
  21. 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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    d1d899a View commit details
    Browse the repository at this point in the history
  22. 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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    456b493 View commit details
    Browse the repository at this point in the history
  23. 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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    96a52f5 View commit details
    Browse the repository at this point in the history
  24. 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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    12d7c59 View commit details
    Browse the repository at this point in the history
  25. 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
    desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    1d5a63b View commit details
    Browse the repository at this point in the history
  26. Build/Test Tools: Always use the amd64 images for MariaDB and MySQL o…

    …n the local development environment.
    
    The `amd64/mysql` and `amd64/mariadb` official images from Docker are also compatible with an x64 host machine which means they can be used by default instead of only when the host uses ARM64.
    
    Props bernhard-reiter, czapla, gmovr, withinboredom
    
    Fixes #56528
    
    
    git-svn-id: https://develop.svn.wordpress.org/trunk@54096 602fd350-edb4-49c9-b593-d223f7449a82
    johnbillion authored and desrosj committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    a531490 View commit details
    Browse the repository at this point in the history