Make WordPress Core


Ignore:
Timestamp:
03/07/2023 07:36:29 PM (3 years ago)
Author:
desrosj
Message:

Build/Test Tools: Backport updates to GitHub Actions.

This backports several changesets to GitHub Actions workflows. These changesets:

  • address the deprecated notices related to save-output and set-output to ensure the workflows continue to run after these are removed.
  • adds support for automatically retrying a failed workflow once.
  • backports some Docker environment related tooling updates for the sake of consistency across branches.

Merges [53628], [53636], [53736], [53737], [53895], [53940], [53947], [54039], [54096], [54108], [54293], [54297], [54313], [54342], [54343], [54371], [54373], [54511], [54649], [54650], [54674], [54678], [54750], [54851], [54852], [54856], [54921], [55152] to the 6.0 branch.
See 55702, #52708, #55652, #55652, #55700, #55652, #56407, #56407, #56528, #55652, #55652, #55652, #54695, #55652, #55652, #55652, #55652, #56820, #56820, #56816, #55652, #55652, #56820, #56793, #56793, #53841, #57148, #57572, #56682.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/6.0/.github/workflows/test-npm.yml

    r53738 r55482  
    1 name: Test NPM
     1name: Test npm
    22
    33on:
     
    1616      - '[4-9].[0-9]'
    1717    paths:
    18       # These files configure NPM. Changes could affect the outcome.
     18      # These files configure npm. Changes could affect the outcome.
    1919      - 'package*.json'
    20       # JavaScript files are built using NPM.
     20      # JavaScript files are built using npm.
    2121      - '**.js'
    22       # CSS and SCSS files are built using NPM.
     22      # CSS and SCSS files are built using npm.
    2323      - '**.scss'
    2424      - '**.css'
     
    3838
    3939jobs:
    40   # Verifies that installing NPM dependencies and building WordPress works as expected.
     40  # Verifies that installing npm dependencies and building WordPress works as expected.
    4141  #
    4242  # Performs the following steps:
    4343  # - Checks out the repository.
     44  # - Sets up Node.js.
    4445  # - Logs debug information about the GitHub Action runner.
    45   # - Installs NodeJS.
    46   # _ Installs NPM dependencies.
     46  # - Installs npm dependencies.
    4747  # - Builds WordPress to run from the `build` directory.
    4848  # - Cleans up after building WordPress to the `build` directory.
     
    5252  # - Ensures version-controlled files are not modified or deleted.
    5353  test-npm:
    54     name: Test NPM on ${{ matrix.os }}
     54    name: Test npm on ${{ matrix.os }}
    5555    runs-on: ${{ matrix.os }}
    5656    timeout-minutes: 20
     
    6363    steps:
    6464      - name: Checkout repository
    65         uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
     65        uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
     66
     67      - name: Set up Node.js
     68        uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
     69        with:
     70          node-version-file: '.nvmrc'
     71          cache: npm
    6672
    6773      - name: Log debug information
     
    7379          svn --version
    7480
    75       - name: Install NodeJS
    76         uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
     81      - name: Install npm Dependencies
     82        run: npm ci
     83
     84      - name: Build WordPress in /src
     85        run: npm run build:dev
     86
     87      - name: Clean after building in /src
     88        run: npm run grunt clean -- --dev
     89
     90      - name: Ensure version-controlled files are not modified or deleted during building and cleaning
     91        run: git diff --exit-code
     92
     93      - name: Build WordPress
     94        run: npm run build
     95
     96      - name: Clean after building
     97        run: npm run grunt clean
     98
     99      - name: Ensure version-controlled files are not modified or deleted during building and cleaning
     100        run: git diff --exit-code
     101
     102  # Verifies that installing npm dependencies and building WordPress works as expected on MacOS.
     103  #
     104  # This is separate from the job above in order to use stricter conditions about when to run.
     105  # This avoids unintentionally consuming excessive minutes, as MacOS jobs consume minutes at a 10x rate.
     106  #
     107  # The `matrix` and `runner` contexts are not available for use within `if` expressions. So there is
     108  # currently no way to determine the OS being used on a given job.
     109  # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability.
     110  #
     111  # Performs the following steps:
     112  # - Checks out the repository.
     113  # - Sets up Node.js.
     114  # - Logs debug information about the GitHub Action runner.
     115  # - Installs npm dependencies.
     116  # - Builds WordPress to run from the `build` directory.
     117  # - Cleans up after building WordPress to the `build` directory.
     118  # - Ensures version-controlled files are not modified or deleted.
     119  # - Builds WordPress to run from the `src` directory.
     120  # - Cleans up after building WordPress to the `src` directory.
     121  # - Ensures version-controlled files are not modified or deleted.
     122  test-npm-macos:
     123    name: Test npm on MacOS
     124    runs-on: macos-latest
     125    timeout-minutes: 30
     126    if: ${{ github.repository == 'WordPress/wordpress-develop' }}
     127    steps:
     128      - name: Checkout repository
     129        uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
     130
     131      - name: Set up Node.js
     132        uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    77133        with:
    78134          node-version-file: '.nvmrc'
    79135          cache: npm
    80 
    81       - name: Install Dependencies
    82         run: npm ci
    83 
    84       - name: Build WordPress
    85         run: npm run build
    86 
    87       - name: Clean after building
    88         run: npm run grunt clean
    89 
    90       - name: Ensure version-controlled files are not modified or deleted during building and cleaning
    91         run: git diff --exit-code
    92 
    93       - name: Build WordPress in /src
    94         run: npm run build:dev
    95 
    96       - name: Clean after building in /src
    97         run: npm run grunt clean -- --dev
    98 
    99       - name: Ensure version-controlled files are not modified or deleted during building and cleaning
    100         run: git diff --exit-code
    101 
    102   # Verifies that installing NPM dependencies and building WordPress works as expected on MacOS.
    103   #
    104   # This is separate from the job above in order to use stricter conditions about when to run.
    105   # This avoids unintentionally consuming excessive minutes, as MacOS jobs consume minutes at a 10x rate.
    106   #
    107   # Performs the following steps:
    108   # - Checks out the repository.
    109   # - Logs debug information about the GitHub Action runner.
    110   # - Installs NodeJS.
    111   # _ Installs NPM dependencies.
    112   # - Builds WordPress to run from the `build` directory.
    113   # - Cleans up after building WordPress to the `build` directory.
    114   # - Ensures version-controlled files are not modified or deleted.
    115   # - Builds WordPress to run from the `src` directory.
    116   # - Cleans up after building WordPress to the `src` directory.
    117   # - Ensures version-controlled files are not modified or deleted.
    118   test-npm-macos:
    119     name: Test NPM on MacOS
    120     runs-on: macos-latest
    121     timeout-minutes: 20
    122     if: ${{ github.repository == 'WordPress/wordpress-develop' }}
    123     steps:
    124       - name: Checkout repository
    125         uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
    126136
    127137      - name: Log debug information
     
    133143          svn --version
    134144
    135       - name: Install NodeJS
    136         uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
    137         with:
    138           node-version-file: '.nvmrc'
    139           cache: npm
    140 
    141       - name: Install Dependencies
     145      - name: Install npm Dependencies
    142146        run: npm ci
     147
     148      - name: Build WordPress in /src
     149        run: npm run build:dev
     150
     151      - name: Clean after building in /src
     152        run: npm run grunt clean -- --dev
     153
     154      - name: Ensure version-controlled files are not modified or deleted during building and cleaning
     155        run: git diff --exit-code
    143156
    144157      - name: Build WordPress
     
    147160      - name: Clean after building
    148161        run: npm run grunt clean
    149 
    150       - name: Ensure version-controlled files are not modified or deleted during building and cleaning
    151         run: git diff --exit-code
    152 
    153       - name: Build WordPress in /src
    154         run: npm run build:dev
    155 
    156       - name: Clean after building in /src
    157         run: npm run grunt clean -- --dev
    158162
    159163      - name: Ensure version-controlled files are not modified or deleted during building and cleaning
     
    172176      SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
    173177      SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
     178
     179  failed-workflow:
     180    name: Failed workflow tasks
     181    runs-on: ubuntu-latest
     182    needs: [ test-npm, test-npm-macos, slack-notifications ]
     183    if: |
     184      always() &&
     185      github.repository == 'WordPress/wordpress-develop' &&
     186      github.event_name != 'pull_request' &&
     187      github.run_attempt < 2 &&
     188      (
     189        needs.test-npm.result == 'cancelled' || needs.test-npm.result == 'failure' ||
     190        needs.test-npm-macos.result == 'cancelled' || needs.test-npm-macos.result == 'failure'
     191      )
     192
     193    steps:
     194      - name: Dispatch workflow run
     195        uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     196        with:
     197          retries: 2
     198          retry-exempt-status-codes: 418
     199          script: |
     200            github.rest.actions.createWorkflowDispatch({
     201              owner: context.repo.owner,
     202              repo: context.repo.repo,
     203              workflow_id: 'failed-workflow.yml',
     204              ref: 'trunk',
     205              inputs: {
     206                run_id: '${{ github.run_id }}'
     207              }
     208            });
Note: See TracChangeset for help on using the changeset viewer.