[wp-trac] [WordPress Trac] #61213: Convert GitHub Action workflows into reusable ones

WordPress Trac noreply at wordpress.org
Tue May 14 18:08:00 UTC 2024


#61213: Convert GitHub Action workflows into reusable ones
------------------------------+-----------------------
 Reporter:  desrosj           |      Owner:  (none)
     Type:  enhancement       |     Status:  new
 Priority:  normal            |  Milestone:  6.6
Component:  Build/Test Tools  |    Version:
 Severity:  normal            |   Keywords:  has-patch
  Focuses:                    |
------------------------------+-----------------------
 In `trunk`, Core's GitHub Action workflows are a mix of standard and
 [https://docs.github.com/en/actions/using-workflows/reusing-workflows
 reusable workflows]. While each have pros and cons, the advantages of
 reusable workflows outweigh the shortcomings, primarily because it makes
 maintaining the workflows within the 25 (and growing) old branches that
 can still receive security updates significantly easier.

 The PHPUnit and build process testing workflows have been callable for a
 few release cycles now and there have been no major problems. Here is a
 quick breakdown of the pros and cons:

 **Benefits**
 - All branches receiving security updates immediately receive the benefits
 of performance improvements to the callable workflow file used from
 `trunk`.
 - All branches receive the 3rd-party action updates updated when updated
 in `trunk`.
 - Any changes required at the platform level only need to be applied in
 `trunk` ([https://github.blog/changelog/2024-03-07-github-actions-all-
 actions-will-run-on-node20-instead-of-node16-by-default/ changes to the
 versions of Node.js found on images] or
 [https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-
 state-and-set-output-commands/ removal of] `save-state`/`set-output` as
 examples).

 **Disadvantages**
 - Because a repository and branch is specified when using the workflow,
 the version of the file found in `trunk` is always used, even within PRs.
 The best way around this is to change the `uses:` path to the PR's fork
 repository/branch.
 - Truly using one reusable workflow for all branches would result in a
 large number of inputs and steps that are skipped. There will likely need
 to be 2 versions of a few workflows to account for major updates to how a
 workflow works (see #45863).

 This ticket proposes the following:
 - Extract the actual testing/building logic in all workflows to reusable
 ones that accept inputs to configure the environment.
 - Establish a naming practice and standardize all reusable workflows so
 it's clear which files are reusable and which ones contain the strategy
 matrix/permission configuration.
 - Update old branches to use the workflow file in `trunk`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61213>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list