Skip to content

Commit

Permalink
[ci] Fix final job for required workflows (#5619)
Browse files Browse the repository at this point in the history
Currently if a required job fails the final jobs is skipped which breaks
the logic of required jobs.
PR fixes it. 

Closes paritytech/ci_cd#1033
  • Loading branch information
alvicsam authored Sep 6, 2024
1 parent 5040b3c commit b2089d8
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 35 deletions.
24 changes: 14 additions & 10 deletions .github/workflows/build-misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ on:
branches:
- master
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]
types: [opened, synchronize, reopened, ready_for_review]
merge_group:


concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
Expand Down Expand Up @@ -41,7 +40,7 @@ jobs:
build-runtimes-polkavm:
timeout-minutes: 20
needs: [ set-image ]
needs: [set-image]
runs-on: ${{ needs.set-image.outputs.RUNNER }}
container:
image: ${{ needs.set-image.outputs.IMAGE }}
Expand All @@ -65,7 +64,7 @@ jobs:
build-subkey:
timeout-minutes: 20
needs: [ set-image ]
needs: [set-image]
runs-on: ${{ needs.set-image.outputs.RUNNER }}
container:
image: ${{ needs.set-image.outputs.IMAGE }}
Expand All @@ -89,10 +88,15 @@ jobs:
runs-on: ubuntu-latest
name: All build misc jobs passed
# If any new job gets added, be sure to add it to this array
needs:
[
build-runtimes-polkavm,
build-subkey
]
needs: [build-runtimes-polkavm, build-subkey]
if: always() && !cancelled()
steps:
- run: echo '### Good job! All the build misc tests passed 🚀' >> $GITHUB_STEP_SUMMARY
- run: |
tee resultfile <<< '${{ toJSON(needs) }}'
FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l)
if [ $FAILURES -gt 0 ]; then
echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY
exit 1
else
echo '### Good job! All the required jobs passed 🚀' >> $GITHUB_STEP_SUMMARY
fi
14 changes: 11 additions & 3 deletions .github/workflows/check-cargo-check-runtimes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: Check Cargo Check Runtimes

on:
pull_request:
types: [ opened, synchronize, reopened, ready_for_review, labeled ]

types: [opened, synchronize, reopened, ready_for_review, labeled]

# Jobs in this workflow depend on each other, only for limiting peak amount of spawned workers

Expand Down Expand Up @@ -132,5 +131,14 @@ jobs:
- check-runtime-contracts
- check-runtime-starters
- check-runtime-testing
if: always() && !cancelled()
steps:
- run: echo '### Good job! All the tests passed 🚀' >> $GITHUB_STEP_SUMMARY
- run: |
tee resultfile <<< '${{ toJSON(needs) }}'
FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l)
if [ $FAILURES -gt 0 ]; then
echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY
exit 1
else
echo '### Good job! All the required jobs passed 🚀' >> $GITHUB_STEP_SUMMARY
fi
13 changes: 11 additions & 2 deletions .github/workflows/check-runtime-migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
# We need to set this to rather long to allow the snapshot to be created, but the average time
# should be much lower.
timeout-minutes: 60
needs: [ set-image ]
needs: [set-image]
container:
image: ${{ needs.set-image.outputs.IMAGE }}
strategy:
Expand Down Expand Up @@ -162,5 +162,14 @@ jobs:
name: All runtime migrations passed
# If any new job gets added, be sure to add it to this array
needs: [check-runtime-migration]
if: always() && !cancelled()
steps:
- run: echo '### Good job! All the checks passed 🚀' >> $GITHUB_STEP_SUMMARY
- run: |
tee resultfile <<< '${{ toJSON(needs) }}'
FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l)
if [ $FAILURES -gt 0 ]; then
echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY
exit 1
else
echo '### Good job! All the required jobs passed 🚀' >> $GITHUB_STEP_SUMMARY
fi
13 changes: 11 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions: { }
permissions: {}

jobs:
# temporary disabled because currently doesn't work in merge queue
Expand Down Expand Up @@ -105,5 +105,14 @@ jobs:
name: All checks passed
# If any new job gets added, be sure to add it to this array
needs: [cargo-clippy, check-try-runtime, check-core-crypto-features]
if: always() && !cancelled()
steps:
- run: echo '### Good job! All the checks passed 🚀' >> $GITHUB_STEP_SUMMARY
- run: |
tee resultfile <<< '${{ toJSON(needs) }}'
FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l)
if [ $FAILURES -gt 0 ]; then
echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY
exit 1
else
echo '### Good job! All the required jobs passed 🚀' >> $GITHUB_STEP_SUMMARY
fi
11 changes: 10 additions & 1 deletion .github/workflows/tests-linux-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,14 @@ jobs:
test-linux-stable-runtime-benchmarks,
test-linux-stable,
]
if: always() && !cancelled()
steps:
- run: echo '### Good job! All the tests passed 🚀' >> $GITHUB_STEP_SUMMARY
- run: |
tee resultfile <<< '${{ toJSON(needs) }}'
FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l)
if [ $FAILURES -gt 0 ]; then
echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY
exit 1
else
echo '### Good job! All the required jobs passed 🚀' >> $GITHUB_STEP_SUMMARY
fi
43 changes: 26 additions & 17 deletions .github/workflows/tests-misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- master
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]
types: [opened, synchronize, reopened, ready_for_review]
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand Down Expand Up @@ -43,12 +43,12 @@ jobs:
echo "RUNNER=arc-runners-polkadot-sdk-beefy-persistent" >> $GITHUB_OUTPUT
else
echo "RUNNER=arc-runners-polkadot-sdk-beefy" >> $GITHUB_OUTPUT
fi
fi
# more information about this job can be found here:
# https://github.com/paritytech/substrate/pull/3778
test-full-crypto-feature:
needs: [ set-image ]
needs: [set-image]
runs-on: ${{ needs.set-image.outputs.RUNNER }}
timeout-minutes: 60
container:
Expand All @@ -72,7 +72,7 @@ jobs:
test-frame-examples-compile-to-wasm:
timeout-minutes: 20
# into one job
needs: [ set-image, test-full-crypto-feature ]
needs: [set-image, test-full-crypto-feature]
runs-on: ${{ needs.set-image.outputs.RUNNER }}
container:
image: ${{ needs.set-image.outputs.IMAGE }}
Expand All @@ -93,7 +93,7 @@ jobs:
test-frame-ui:
timeout-minutes: 60
needs: [ set-image, test-frame-examples-compile-to-wasm ]
needs: [set-image, test-frame-examples-compile-to-wasm]
runs-on: ${{ needs.set-image.outputs.RUNNER }}
container:
image: ${{ needs.set-image.outputs.IMAGE }}
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
test-deterministic-wasm:
timeout-minutes: 20
needs: [ set-image ]
needs: [set-image]
runs-on: ${{ needs.set-image.outputs.RUNNER }}
container:
image: ${{ needs.set-image.outputs.IMAGE }}
Expand All @@ -143,7 +143,7 @@ jobs:
sha256sum -c checksum.sha256
cargo-check-benches-branches:
needs: [ set-image ]
needs: [set-image]
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
timeout-minutes: 60
outputs:
Expand All @@ -156,7 +156,7 @@ jobs:
echo "branch=['${{ github.base_ref }}', '${{ github.head_ref }}']" >> $GITHUB_OUTPUT
cargo-check-benches:
needs: [ set-image, cargo-check-benches-branches ]
needs: [set-image, cargo-check-benches-branches]
timeout-minutes: 60
strategy:
matrix:
Expand Down Expand Up @@ -191,7 +191,7 @@ jobs:
node-bench-regression-guard:
timeout-minutes: 20
runs-on: arc-runners-polkadot-sdk
needs: [ set-image, cargo-check-benches ]
needs: [set-image, cargo-check-benches]
steps:
- name: Checkout
uses: actions/checkout@v4.1.7
Expand Down Expand Up @@ -227,7 +227,7 @@ jobs:
fi
test-node-metrics:
needs: [ set-image ]
needs: [set-image]
timeout-minutes: 30
runs-on: ${{ needs.set-image.outputs.RUNNER }}
container:
Expand Down Expand Up @@ -260,7 +260,7 @@ jobs:
# https://github.com/paritytech/substrate/pull/6916
check-tracing:
timeout-minutes: 20
needs: [ set-image, test-node-metrics ]
needs: [set-image, test-node-metrics]
runs-on: ${{ needs.set-image.outputs.RUNNER }}
container:
image: ${{ needs.set-image.outputs.IMAGE }}
Expand All @@ -275,7 +275,7 @@ jobs:
check-metadata-hash:
timeout-minutes: 20
needs: [ set-image, check-tracing ]
needs: [set-image, check-tracing]
runs-on: ${{ needs.set-image.outputs.RUNNER }}
container:
image: ${{ needs.set-image.outputs.IMAGE }}
Expand All @@ -289,7 +289,7 @@ jobs:
cargo-hfuzz:
timeout-minutes: 20
needs: [ set-image, check-metadata-hash ]
needs: [set-image, check-metadata-hash]
runs-on: ${{ needs.set-image.outputs.RUNNER }}
container:
image: ${{ needs.set-image.outputs.IMAGE }}
Expand Down Expand Up @@ -329,7 +329,7 @@ jobs:

cargo-check-each-crate:
timeout-minutes: 140
needs: [ set-image ]
needs: [set-image]
runs-on: ${{ needs.set-image.outputs.RUNNER }}
container:
image: ${{ needs.set-image.outputs.IMAGE }}
Expand All @@ -338,7 +338,7 @@ jobs:
CI_JOB_NAME: cargo-check-each-crate
strategy:
matrix:
index: [ 1,2,3,4,5,6,7 ] # 7 parallel jobs
index: [1, 2, 3, 4, 5, 6, 7] # 7 parallel jobs
steps:
- name: Checkout
uses: actions/checkout@v4.1.7
Expand Down Expand Up @@ -394,5 +394,14 @@ jobs:
- cargo-check-each-crate
- test-deterministic-wasm
# - cargo-hfuzz remove from required for now, as it's flaky
if: always() && !cancelled()
steps:
- run: echo '### Good job! All the required tests passed 🚀' >> $GITHUB_STEP_SUMMARY
- run: |
tee resultfile <<< '${{ toJSON(needs) }}'
FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l)
if [ $FAILURES -gt 0 ]; then
echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY
exit 1
else
echo '### Good job! All the required jobs passed 🚀' >> $GITHUB_STEP_SUMMARY
fi

0 comments on commit b2089d8

Please sign in to comment.