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/phpunit-tests.yml

    r50704 r50930  
    2222    - cron: '0 0 * * 0'
    2323
     24# Cancels all previous workflow runs for pull requests that have not completed.
     25concurrency:
     26  # The concurrency group contains the workflow name and the branch name for pull requests
     27  # or the commit hash for any other events.
     28  group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
     29  cancel-in-progress: true
     30
    2431env:
    2532  PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
     
    3138
    3239jobs:
    33   # Sets up the workflow for testing.
    34   #
    35   # Performs the following steps:
    36   # - Cancels all previous workflow runs for pull requests that have not completed.
    37   setup-workflow:
    38     name: Setup Workflow
    39     runs-on: ubuntu-latest
    40     if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    41 
    42     steps:
    43       - name: Cancel previous runs of this workflow (pull requests only)
    44         if: ${{ github.event_name == 'pull_request' }}
    45         uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0
    46 
    4740  # Runs the PHPUnit tests for WordPress.
    4841  #
Note: See TracChangeset for help on using the changeset viewer.