wordpress/.github/workflows/test-old-branches.yml
Jonathan Desrosiers ce0396ba76 Build/Test Tools: Expand Slack notifications for GitHub Actions.
This expands Slack notifications to include success, cancelled, and “fixed” GitHub Action workflow run outcomes in addition to failures.

A “fixed” outcome occurs when the previous run for a workflow failed and the current one succeeds. This matches the behavior that was native to TravisCI by setting `on_success` for notifications to `change`.

The message details and where each outcome is posted is controlled by Slack workflows.

The Slack notification logic has also been pulled into a separate workflow to prevent repeating code in every workflow.

See #52644.

git-svn-id: https://develop.svn.wordpress.org/trunk@51535 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-03 13:45:02 +00:00

72 lines
2.5 KiB
YAML

name: Test old branches
on:
# Verify the workflow is successful when this file is updated.
push:
branches:
- master
- trunk
paths:
- '.github/workflows/test-old-branches.yml'
# Run twice a month on the 1st and 15th at 00:00 UTC.
schedule:
- cron: '0 0 1 * *'
- cron: '0 0 15 * *'
jobs:
dispatch-workflows-for-old-branches:
name: ${{ matrix.workflow }} for ${{ matrix.branch }}
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/wordpress-develop' }}
strategy:
fail-fast: false
matrix:
workflow: [
'coding-standards.yml',
'javascript-tests.yml',
'phpunit-tests.yml',
'test-npm.yml'
]
branch: [
'5.8', '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.8'
workflow: 'php-compatibility.yml'
- 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.8'
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'
# Run all branches monthly, but only the currently supported one twice per month.
steps:
- name: Dispatch workflow run
uses: actions/github-script@47f7cf65b5ced0830a325f705cad64f2f58dddf7 # v3.1.0
if: ${{ github.event_name == 'push' || github.event.schedule == '0 0 15 * *' || matrix.branch == '5.7' }}
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 }}'
});