mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
Build/Test Tools: Simplify some logic in GitHub Action workflows.
This simplifies the logic within the `slack-notifications` and `failed-workflow` steps in GitHub Action workflows to use the `contains()` function and object filtering. This makes it simpler to perform the needed checks by removing the need to list out every single dependent job defined in `needs`. See #58867. git-svn-id: https://develop.svn.wordpress.org/trunk@56660 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8baf4f643c
commit
ba71767faf
6
.github/workflows/coding-standards.yml
vendored
6
.github/workflows/coding-standards.yml
vendored
@ -182,7 +182,7 @@ jobs:
|
|||||||
needs: [ phpcs, jshint ]
|
needs: [ phpcs, jshint ]
|
||||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||||
with:
|
with:
|
||||||
calling_status: ${{ needs.phpcs.result == 'success' && needs.jshint.result == 'success' && 'success' || ( needs.phpcs.result == 'cancelled' || needs.jshint.result == 'cancelled' ) && 'cancelled' || 'failure' }}
|
calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
|
||||||
secrets:
|
secrets:
|
||||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||||
@ -201,8 +201,8 @@ jobs:
|
|||||||
github.event_name != 'pull_request' &&
|
github.event_name != 'pull_request' &&
|
||||||
github.run_attempt < 2 &&
|
github.run_attempt < 2 &&
|
||||||
(
|
(
|
||||||
needs.phpcs.result == 'cancelled' || needs.phpcs.result == 'failure' ||
|
contains( needs.*.result, 'cancelled' ) ||
|
||||||
needs.jshint.result == 'cancelled' || needs.jshint.result == 'failure'
|
contains( needs.*.result, 'failure' )
|
||||||
)
|
)
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
5
.github/workflows/javascript-tests.yml
vendored
5
.github/workflows/javascript-tests.yml
vendored
@ -97,7 +97,7 @@ jobs:
|
|||||||
needs: [ test-js ]
|
needs: [ test-js ]
|
||||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||||
with:
|
with:
|
||||||
calling_status: ${{ needs.test-js.result == 'success' && 'success' || needs.test-js.result == 'cancelled' && 'cancelled' || 'failure' }}
|
calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
|
||||||
secrets:
|
secrets:
|
||||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||||
@ -116,7 +116,8 @@ jobs:
|
|||||||
github.event_name != 'pull_request' &&
|
github.event_name != 'pull_request' &&
|
||||||
github.run_attempt < 2 &&
|
github.run_attempt < 2 &&
|
||||||
(
|
(
|
||||||
needs.test-js.result == 'cancelled' || needs.test-js.result == 'failure'
|
contains( needs.*.result, 'cancelled' ) ||
|
||||||
|
contains( needs.*.result, 'failure' )
|
||||||
)
|
)
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
5
.github/workflows/performance.yml
vendored
5
.github/workflows/performance.yml
vendored
@ -251,7 +251,7 @@ jobs:
|
|||||||
needs: [ performance ]
|
needs: [ performance ]
|
||||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||||
with:
|
with:
|
||||||
calling_status: ${{ needs.performance.result == 'success' && 'success' || needs.performance.result == 'cancelled' && 'cancelled' || 'failure' }}
|
calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
|
||||||
secrets:
|
secrets:
|
||||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||||
@ -270,7 +270,8 @@ jobs:
|
|||||||
github.event_name != 'pull_request' &&
|
github.event_name != 'pull_request' &&
|
||||||
github.run_attempt < 2 &&
|
github.run_attempt < 2 &&
|
||||||
(
|
(
|
||||||
needs.performance.result == 'cancelled' || needs.performance.result == 'failure'
|
contains( needs.*.result, 'cancelled' ) ||
|
||||||
|
contains( needs.*.result, 'failure' )
|
||||||
)
|
)
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
5
.github/workflows/php-compatibility.yml
vendored
5
.github/workflows/php-compatibility.yml
vendored
@ -122,7 +122,7 @@ jobs:
|
|||||||
needs: [ php-compatibility ]
|
needs: [ php-compatibility ]
|
||||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||||
with:
|
with:
|
||||||
calling_status: ${{ needs.php-compatibility.result == 'success' && 'success' || needs.php-compatibility.result == 'cancelled' && 'cancelled' || 'failure' }}
|
calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
|
||||||
secrets:
|
secrets:
|
||||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||||
@ -141,7 +141,8 @@ jobs:
|
|||||||
github.event_name != 'pull_request' &&
|
github.event_name != 'pull_request' &&
|
||||||
github.run_attempt < 2 &&
|
github.run_attempt < 2 &&
|
||||||
(
|
(
|
||||||
needs.php-compatibility.result == 'cancelled' || needs.php-compatibility.result == 'failure'
|
contains( needs.*.result, 'cancelled' ) ||
|
||||||
|
contains( needs.*.result, 'failure' )
|
||||||
)
|
)
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
6
.github/workflows/phpunit-tests.yml
vendored
6
.github/workflows/phpunit-tests.yml
vendored
@ -136,7 +136,7 @@ jobs:
|
|||||||
needs: [ test-with-mysql, test-with-mariadb ]
|
needs: [ test-with-mysql, test-with-mariadb ]
|
||||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||||
with:
|
with:
|
||||||
calling_status: ${{ needs.test-with-mysql.result == 'success' && needs.test-with-mariadb.result == 'success' && 'success' || ( needs.test-with-mysql.result == 'cancelled' || needs.test-with-mariadb.result == 'cancelled' ) && 'cancelled' || 'failure' }}
|
calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
|
||||||
secrets:
|
secrets:
|
||||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||||
@ -155,8 +155,8 @@ jobs:
|
|||||||
github.event_name != 'pull_request' &&
|
github.event_name != 'pull_request' &&
|
||||||
github.run_attempt < 2 &&
|
github.run_attempt < 2 &&
|
||||||
(
|
(
|
||||||
needs.test-with-mysql.result == 'cancelled' || needs.test-with-mysql.result == 'failure' ||
|
contains( needs.*.result, 'cancelled' ) ||
|
||||||
needs.test-with-mariadb.result == 'cancelled' || needs.test-with-mariadb.result == 'failure'
|
contains( needs.*.result, 'failure' )
|
||||||
)
|
)
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -155,7 +155,7 @@ jobs:
|
|||||||
needs: [ bundle-theme, test-build-scripts ]
|
needs: [ bundle-theme, test-build-scripts ]
|
||||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||||
with:
|
with:
|
||||||
calling_status: ${{ needs.test-build-scripts.result == 'success' && needs.bundle-theme.result == 'success' && 'success' || ( needs.test-build-scripts.result == 'cancelled' || needs.bundle-theme.result == 'cancelled' ) && 'cancelled' || 'failure' }}
|
calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
|
||||||
secrets:
|
secrets:
|
||||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||||
@ -174,8 +174,8 @@ jobs:
|
|||||||
github.event_name != 'pull_request' &&
|
github.event_name != 'pull_request' &&
|
||||||
github.run_attempt < 2 &&
|
github.run_attempt < 2 &&
|
||||||
(
|
(
|
||||||
needs.test-build-scripts.result == 'cancelled' || needs.test-build-scripts.result == 'failure' ||
|
contains( needs.*.result, 'cancelled' ) ||
|
||||||
needs.bundle-theme.result == 'cancelled' || needs.bundle-theme.result == 'failure'
|
contains( needs.*.result, 'failure' )
|
||||||
)
|
)
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
5
.github/workflows/test-coverage.yml
vendored
5
.github/workflows/test-coverage.yml
vendored
@ -183,7 +183,7 @@ jobs:
|
|||||||
needs: [ test-coverage-report ]
|
needs: [ test-coverage-report ]
|
||||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||||
with:
|
with:
|
||||||
calling_status: ${{ needs.test-coverage-report.result == 'success' && 'success' || needs.test-coverage-report.result == 'cancelled' && 'cancelled' || 'failure' }}
|
calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
|
||||||
secrets:
|
secrets:
|
||||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||||
@ -202,7 +202,8 @@ jobs:
|
|||||||
github.event_name != 'pull_request' &&
|
github.event_name != 'pull_request' &&
|
||||||
github.run_attempt < 2 &&
|
github.run_attempt < 2 &&
|
||||||
(
|
(
|
||||||
needs.test-coverage-report.result == 'cancelled' || needs.test-coverage-report.result == 'failure'
|
contains( needs.*.result, 'cancelled' ) ||
|
||||||
|
contains( needs.*.result, 'failure' )
|
||||||
)
|
)
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
6
.github/workflows/test-npm.yml
vendored
6
.github/workflows/test-npm.yml
vendored
@ -184,7 +184,7 @@ jobs:
|
|||||||
needs: [ test-npm, test-npm-macos ]
|
needs: [ test-npm, test-npm-macos ]
|
||||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||||
with:
|
with:
|
||||||
calling_status: ${{ needs.test-npm.result == 'success' && needs.test-npm-macos.result == 'success' && 'success' || ( needs.test-npm.result == 'cancelled' || needs.test-npm-macos.result == 'cancelled' ) && 'cancelled' || 'failure' }}
|
calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
|
||||||
secrets:
|
secrets:
|
||||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||||
@ -203,8 +203,8 @@ jobs:
|
|||||||
github.event_name != 'pull_request' &&
|
github.event_name != 'pull_request' &&
|
||||||
github.run_attempt < 2 &&
|
github.run_attempt < 2 &&
|
||||||
(
|
(
|
||||||
needs.test-npm.result == 'cancelled' || needs.test-npm.result == 'failure' ||
|
contains( needs.*.result, 'cancelled' ) ||
|
||||||
needs.test-npm-macos.result == 'cancelled' || needs.test-npm-macos.result == 'failure'
|
contains( needs.*.result, 'failure' )
|
||||||
)
|
)
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
2
.github/workflows/test-old-branches.yml
vendored
2
.github/workflows/test-old-branches.yml
vendored
@ -106,7 +106,7 @@ jobs:
|
|||||||
needs: [ dispatch-workflows-for-old-branches ]
|
needs: [ dispatch-workflows-for-old-branches ]
|
||||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||||
with:
|
with:
|
||||||
calling_status: ${{ needs.dispatch-workflows-for-old-branches.result == 'success' && 'success' || needs.dispatch-workflows-for-old-branches.result == 'cancelled' && 'cancelled' || 'failure' }}
|
calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
|
||||||
secrets:
|
secrets:
|
||||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user