Make WordPress Core


Ignore:
Timestamp:
05/19/2021 05:36:54 PM (3 years ago)
Author:
desrosj
Message:

Build/Test Tools: Use the new concurrency setting for GitHub Actions.

The new concurrency setting can be used to ensure only a single workflow run or job is in progress. When used in combination with the cancel-in-progress setting, incomplete workflow runs can be cancelled automatically to prevent running workflows unnecessarily.

The workflows that take longer to run previously had this built into a step and utilized a 3rd-party action. Now that this is natively supported by GitHub Actions, using that is preferred.

This option is currently in beta, but is stable enough to use in our workflows for the time being.

Props ocean90.
Fixes #53080.

File:
1 edited

Legend:

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

    r50796 r50930  
    2626  workflow_dispatch:
    2727
     28# Cancels all previous workflow runs for pull requests that have not completed.
     29concurrency:
     30  # The concurrency group contains the workflow name and the branch name for pull requests
     31  # or the commit hash for any other events.
     32  group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
     33  cancel-in-progress: true
     34
    2835env:
    2936  PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
    3037
    3138jobs:
    32   # Prepares the workflow.
    33   #
    34   # Performs the following steps:
    35   # - Cancels all previous workflow runs for pull requests that have not completed.
    36   prepare-workflow:
    37     name: Prepare the workflow
    38     runs-on: ubuntu-latest
    39     if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    40 
    41     steps:
    42       - name: Cancel previous runs of this workflow (pull requests only)
    43         if: ${{ github.event_name == 'pull_request' }}
    44         uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0
    45 
    4639  # Verifies that installing NPM dependencies and building WordPress works as expected.
    4740  #
     
    6053    runs-on: ${{ matrix.os }}
    6154    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    62     needs: prepare-workflow
    6355    strategy:
    6456      fail-fast: false
     
    135127    runs-on: macos-latest
    136128    if: ${{ github.repository == 'WordPress/wordpress-develop' }}
    137     needs: prepare-workflow
    138129    steps:
    139130      - name: Checkout repository
Note: See TracChangeset for help on using the changeset viewer.