Make WordPress Core


Ignore:
Timestamp:
06/30/2022 04:26:30 PM (4 years ago)
Author:
desrosj
Message:

Build/Test Tools: Use the Slack notifications workflow as a reusable one.

This backports several changesets that are required to remove the reliance on the workflow_run event for posting Slack notifications.

The Slack notification workflow will now be called as a reusable one, which has several benefits (see [53591]).

Several other minor GitHub Actions related updates are also being backported in this commit to maintain tooling consistency across branches that still receive security updates as a courtesy when necessary.

Merges [51921], [51924], [51925], [51937], [52002], [52130], [52183], [52233], [53112], [53581], [53582], [53592] to the 5.8 branch.
See #56095.

Location:
branches/5.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.8

  • branches/5.8/.github/workflows/test-npm.yml

    r51357 r53597  
    44  push:
    55    branches:
    6       - master
    76      - trunk
    87      - '3.[7-9]'
     
    109  pull_request:
    1110    branches:
    12       - master
    1311      - trunk
    1412      - '3.[7-9]'
     
    4139  # Performs the following steps:
    4240  # - Checks out the repository.
    43   # - Logs debug information about the runner container.
    44   # - Installs NodeJS 14.
     41  # - Logs debug information about the GitHub Action runner.
     42  # - Installs NodeJS.
    4543  # - Sets up caching for NPM.
    46   # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
     44  # _ Installs NPM dependencies.
    4745  # - Builds WordPress to run from the `build` directory.
    4846  # - Cleans up after building WordPress to the `build` directory.
     
    5452    name: Test NPM on ${{ matrix.os }}
    5553    runs-on: ${{ matrix.os }}
     54    timeout-minutes: 20
    5655    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    5756    strategy:
     
    6261    steps:
    6362      - name: Checkout repository
    64         uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
     63        uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
    6564
    6665      - name: Log debug information
     
    7372
    7473      - name: Install NodeJS
    75         uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
     74        uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
    7675        with:
    77           node-version: 14
    78 
    79       - name: Cache NodeJS modules (Ubuntu & MacOS)
    80         uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
    81         if: ${{ matrix.os != 'windows-latest' }}
    82         with:
    83           path: ~/.npm
    84           key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
    85 
    86       - name: Get NPM cache directory (Windows only)
    87         if: ${{ matrix.os == 'windows-latest' }}
    88         id: npm-cache
    89         run: echo "::set-output name=dir::$(npm config get cache)"
    90 
    91       - name: Cache NodeJS modules (Windows only)
    92         uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
    93         if: ${{ matrix.os == 'windows-latest' }}
    94         with:
    95           path: ${{ steps.npm-cache.outputs.dir }}
    96           key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
     76          node-version-file: '.nvmrc'
     77          cache: npm
    9778
    9879      - name: Install Dependencies
     
    119100  # Verifies that installing NPM dependencies and building WordPress works as expected on MacOS.
    120101  #
    121   # This is a separate job in order to that more strict conditions can be used.
     102  # This is separate from the job above in order to use stricter conditions about when to run.
     103  # This avoids unintentionally consuming excessive minutes, as MacOS jobs consume minutes at a 10x rate.
    122104  #
    123105  # Performs the following steps:
    124106  # - Checks out the repository.
    125   # - Logs debug information about the runner container.
    126   # - Installs NodeJS 14.
     107  # - Logs debug information about the GitHub Action runner.
     108  # - Installs NodeJS.
    127109  # - Sets up caching for NPM.
    128   # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
     110  # _ Installs NPM dependencies.
    129111  # - Builds WordPress to run from the `build` directory.
    130112  # - Cleans up after building WordPress to the `build` directory.
     
    136118    name: Test NPM on MacOS
    137119    runs-on: macos-latest
     120    timeout-minutes: 20
    138121    if: ${{ github.repository == 'WordPress/wordpress-develop' }}
    139122    steps:
    140123      - name: Checkout repository
    141         uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
     124        uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
    142125
    143126      - name: Log debug information
     
    150133
    151134      - name: Install NodeJS
    152         uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
     135        uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
    153136        with:
    154           node-version: 14
    155 
    156       - name: Cache NodeJS modules
    157         uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
    158         if: ${{ matrix.os != 'windows-latest' }}
    159         with:
    160           path: ~/.npm
    161           key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
     137          node-version-file: '.nvmrc'
     138          cache: npm
    162139
    163140      - name: Install Dependencies
     
    181158      - name: Ensure version-controlled files are not modified or deleted during building and cleaning
    182159        run: git diff --exit-code
     160
     161  slack-notifications:
     162    name: Slack Notifications
     163    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     164    needs: [ test-npm, test-npm-macos ]
     165    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     166    with:
     167      calling_status: ${{ needs.test-npm.result == 'success' && needs.test-npm-macos.result == 'success' && 'success' || ( needs.test-npm.result == 'cancelled' || needs.test-npm-macos.result == 'cancelled' ) && 'cancelled' || 'failure' }}
     168    secrets:
     169      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
     170      SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
     171      SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
     172      SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
Note: See TracChangeset for help on using the changeset viewer.