Make WordPress Core


Ignore:
Timestamp:
05/17/2024 05:41:40 PM (10 months ago)
Author:
desrosj
Message:

Build/Test Tools: Convert GitHub action workflows into reusable ones.

With a few exceptions, GitHub Actions workflows run using the version of the workflow file present in the commit SHA or Git ref for the triggering event. This is useful for maintaining different versions of a workflow file.

In the case of WordPress where there are currently 25+ branches that could potentially receive a security fix, it creates a huge maintenance burden. When 3rd party actions are updated or features are deprecated on GitHub Actions, the required changes need to be backported to all of those branches. This takes considerable time and effort.

This change converts Core’s workflow files to reusable ones. This allows the same workflow to be used for all (or most) branches, allowing the described maintenance updates to be made once in trunk.

To keep track of which files are reusable vs. those that are responsible for holding the strategy matrix for that branch, reusable workflows are now prefixed with reusable-.

Props johnbillion, swissspidy, jorbin, desrosj.
Fixes #61213.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/javascript-tests.yml

    r57655 r58165  
    4444
    4545jobs:
    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.
    5547  test-js:
    5648    name: QUnit Tests
    57     runs-on: ubuntu-latest
     49    uses: WordPress/wordpress-develop/.github/workflows/reusable-javascript-tests.yml@trunk
    5850    permissions:
    5951      contents: read
    60     timeout-minutes: 20
    6152    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    62 
    63     steps:
    64       - name: Checkout repository
    65         uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
    66         with:
    67           show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
    68 
    69       - name: Set up Node.js
    70         uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
    71         with:
    72           node-version-file: '.nvmrc'
    73           cache: npm
    74 
    75       - name: Log debug information
    76         run: |
    77           npm --version
    78           node --version
    79           git --version
    80 
    81       - name: Install npm Dependencies
    82         run: npm ci
    83 
    84       - name: Run QUnit tests
    85         run: npm run grunt qunit:compiled
    86 
    87       - name: Ensure version-controlled files are not modified or deleted
    88         run: git diff --exit-code
    8953
    9054  slack-notifications:
Note: See TracChangeset for help on using the changeset viewer.