Make WordPress Core


Ignore:
Timestamp:
06/30/2022 04:37:20 PM (2 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 [50446], [50473], [50704], [50796], [50930], [51341], [51355], [51498], [51511], [51535], [51924], [51925], [51937], [52002], [52130], [52183], [52233], [53112], [53581], [53582], [53592] to the 5.5 branch.
See #56095.

Location:
branches/5.5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.5

  • branches/5.5/.github/workflows/javascript-tests.yml

    r50603 r53600  
    55  push:
    66    branches:
    7       - master
    87      - trunk
    98      - '3.[89]'
     
    1413  pull_request:
    1514    branches:
    16       - master
    1715      - trunk
    1816      - '3.[89]'
     
    3331  workflow_dispatch:
    3432
     33# Cancels all previous workflow runs for pull requests that have not completed.
     34concurrency:
     35  # The concurrency group contains the workflow name and the branch name for pull requests
     36  # or the commit hash for any other events.
     37  group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
     38  cancel-in-progress: true
     39
    3540jobs:
    3641  # Runs the QUnit tests for WordPress.
    3742  #
    3843  # Performs the following steps:
    39   # - Cancels all previous workflow runs for pull requests that have not completed.
    4044  # - Checks out the repository.
    41   # - Logs debug information about the runner container.
    42   # - Installs NodeJS 14.
    43   # - Sets up caching for NPM.
     45  # - Logs debug information about the GitHub Action runner.
     46  # - Installs NodeJS.
    4447  # - Logs updated debug information.
    45   # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
     48  # _ Installs NPM dependencies.
    4649  # - Run the WordPress QUnit tests.
    47   # - todo: Configure Slack notifications for failing tests.
    4850  test-js:
    4951    name: QUnit Tests
    5052    runs-on: ubuntu-latest
     53    timeout-minutes: 20
    5154    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    5255
    5356    steps:
    54       - name: Cancel previous runs of this workflow (pull requests only)
    55         if: ${{ github.event_name == 'pull_request' }}
    56         uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0
    57 
    5857      - name: Checkout repository
    59         uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
     58        uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
    6059
    6160      - name: Log debug information
     
    6766
    6867      - name: Install NodeJS
    69         uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
     68        uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
    7069        with:
    71           node-version: 14
    72 
    73       - name: Cache NodeJS modules
    74         uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
    75         env:
    76           cache-name: cache-node-modules
    77         with:
    78           # npm cache files are stored in `~/.npm` on Linux/macOS
    79           path: ~/.npm
    80           key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
     70          node-version-file: '.nvmrc'
     71          cache: npm
    8172
    8273      - name: Log debug information
     
    9081      - name: Run QUnit tests
    9182        run: npm run grunt qunit:compiled
     83
     84  slack-notifications:
     85    name: Slack Notifications
     86    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     87    needs: [ test-js ]
     88    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     89    with:
     90      calling_status: ${{ needs.test-js.result == 'success' && 'success' || needs.test-js.result == 'cancelled' && 'cancelled' || 'failure' }}
     91    secrets:
     92      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
     93      SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
     94      SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
     95      SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
Note: See TracChangeset for help on using the changeset viewer.