Build/Test Tools: Run test workflows on old branches on a schedule.

On TravisCI, old branches still receiving security updates were tested on a regular basis. This ensured tests continued to pass as time passed even if updates were not made to these branches.

On GitHub Actions, there is no interface to configure this (TravisCI had a UI), but there is a `schedule` event that can trigger workflow runs on cron that can be used to accomplish the same thing.

This introduces a workflow file that runs twice a month (on the 1st and 15th) to verify the tests within older branches.

Because the `schedule` event only runs within the primary branch, the appropriate workflows in each old branch will be triggered manually through the `workflow_dispatch` trigger using the GitHub REST API. `workflow_dispatch` will need to be added to all workflows in all old branches in order for the event to dispatch successfully.

Merges [50590] to the 5.7 branch.
See #52653.

git-svn-id: https://develop.svn.wordpress.org/branches/5.7@50591 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers 2021-03-26 13:16:23 +00:00
parent 3a3839c56c
commit 8e15999eff
7 changed files with 64 additions and 0 deletions

View File

@ -32,6 +32,7 @@ on:
- 'phpcs.xml.dist'
# Changes to workflow files should always verify all workflows are successful.
- '.github/workflows/*.yml'
workflow_dispatch:
jobs:
# Runs PHP coding standards checks.

View File

@ -17,6 +17,7 @@ on:
- trunk
- '5.[3-9]'
- '[6-9].[0-9]'
workflow_dispatch:
env:
LOCAL_DIR: build

View File

@ -30,6 +30,7 @@ on:
- 'tests/qunit/**'
# Changes to workflow files should always verify all workflows are successful.
- '.github/workflows/*.yml'
workflow_dispatch:
jobs:
# Runs the QUnit tests for WordPress.

View File

@ -26,6 +26,7 @@ on:
- 'phpcompat.xml.dist'
# Changes to workflow files should always verify all workflows are successful.
- '.github/workflows/*.yml'
workflow_dispatch:
jobs:

View File

@ -14,6 +14,7 @@ on:
- master
- '3.[7-9]'
- '[4-9].[0-9]'
workflow_dispatch:
# Once weekly On Sundays at 00:00 UTC.
schedule:
- cron: '0 0 * * 0'

View File

@ -23,6 +23,7 @@ on:
- '**.css'
# Changes to workflow files should always verify all workflows are successful.
- '.github/workflows/**.yml'
workflow_dispatch:
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}

58
.github/workflows/test-old-branches.yml vendored Normal file
View File

@ -0,0 +1,58 @@
name: Test old branches
on:
# Once weekly On Mondays at 00:00 UTC.
schedule:
- cron: '0 0 1,15 * *'
jobs:
dispatch-workflows-for-old-branches:
name: ${{ matrix.workflow }} for ${{ matrix.branch }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
workflow: [
'coding-standards.yml',
'javascript-tests.yml',
'phpunit-tests.yml',
'test-npm.yml'
]
branch: [
'5.7', '5.6', '5.5', '5.4', '5.3', '5.2', '5.1', '5.0',
'4.9', '4.8', '4.7', '4.6', '4.5', '4.4', '4.3', '4.2', '4.1', '4.0',
'3.9', '3.8', '3.7'
]
include:
# PHP Compatibility testing was introduced in 5.5.
- branch: '5.7'
workflow: 'php-compatibility.yml'
- branch: '5.6'
workflow: 'php-compatibility.yml'
- branch: '5.5'
workflow: 'php-compatibility.yml'
# End to End testing was introduced in 5.3 but later removed as there were no meaningful assertions.
# Only the officially supported major branch runs E2E tests so that more assertions can be added, and the
# workflow does not continue to run needlessly on old branches.
- branch: '5.7'
workflow: 'end-to-end-tests.yml'
exclude:
# Coding standards and JavaScript testing did not take place in 3.7.
- branch: '3.7'
workflow: 'coding-standards.yml'
- branch: '3.7'
workflow: 'javascript-tests.yml'
steps:
- name: Dispatch workflow run
uses: actions/github-script@47f7cf65b5ced0830a325f705cad64f2f58dddf7 # v3.1.0
with:
github-token: ${{ secrets.GHA_OLD_BRANCH_DISPATCH }}
script: |
github.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: '${{ matrix.workflow }}',
ref: '${{ matrix.branch }}'
});