Skip to content

Commit

Permalink
Unified tests into final step ✅ (#192)
Browse files Browse the repository at this point in the history
Unified all the tests into having one final step at the end.

<img width="803" alt="image"
src="https://github.com/polkadot-fellows/runtimes/assets/8524599/5269a2c1-eae0-481c-b13c-d5b9e2957bbf">

This step will only run if all the previous steps have ran. If any of
these tests fail, it will fail.

All the status checks will still appear in the PR, so the user can see
any failed case:
<img width="855" alt="image"
src="https://github.com/polkadot-fellows/runtimes/assets/8524599/2b5e6f9c-5304-4bc8-b7b9-15d99df0d07d">

But, by adding this last test as the only requirement, the list to block
the branch becomes significantly smaller.

- [x] Does not require a CHANGELOG entry

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
  • Loading branch information
Bullrich and bkchr authored Jun 24, 2024
1 parent 5330501 commit 750aa73
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/check-migrations.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Check Migrations

# If you modify more jobs, ensure that you add them as required to the job "confirmMigrationsPassed"
# which is located at the end of this file (more info in the job)

on:
push:
branches: ["main", "release-*"]
Expand All @@ -16,6 +19,7 @@ concurrency:
permissions: {}

jobs:
# This generates a matrix with all the required jobs which will be run in the next step
runtime-matrix:
runs-on: ubuntu-latest
outputs:
Expand All @@ -36,6 +40,8 @@ jobs:
TASKS=$(echo $TASKS | jq -c .)
echo "runtime=$TASKS" >> $GITHUB_OUTPUT
# This runs all the jobs in the matrix. It is required by the "confirmMigrationsPassed" job, so
# if they all pass, that job will pass too.
check-migrations:
needs: [runtime-matrix]
continue-on-error: true
Expand Down Expand Up @@ -77,3 +83,15 @@ jobs:
node-uri: ${{ matrix.runtime.uri }}
checks: "pre-and-post"
extra-args: ${{ env.EXTRA_ARGS }}

# This will only run if all the tests in its "needs" array passed.
# Add this as your required job, becuase if the matrix changes size (new things get added)
# it will still require all the steps to succeed.
# If you add more jobs, remember to add them to the "needs" array.
confirmMigrationsPassed:
runs-on: ubuntu-latest
name: All migrations passed
# If any new job gets added, be sure to add it to this array
needs: [check-migrations]
steps:
- run: echo '### Good job! All the migrations passed 🚀' >> $GITHUB_STEP_SUMMARY
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: "Test all features"

# If you modify more test jobs, ensure that you add them as required to the job "confirmTestPassed"
# which is located at the end of this file (more info in the job)

on:
push:
branches: ["main", "release-*"]
Expand All @@ -12,6 +15,7 @@ concurrency:
cancel-in-progress: true

jobs:
# This generates a matrix with all the required jobs which will be run in the next step
runtime-matrix:
runs-on: ubuntu-latest
outputs:
Expand All @@ -38,6 +42,7 @@ jobs:
echo $TASKS
echo "itest=$TASKS" >> $GITHUB_OUTPUT
# Job required by "confirmTestPassed"
runtime-test:
needs: [runtime-matrix]
continue-on-error: true
Expand Down Expand Up @@ -94,6 +99,7 @@ jobs:
RUSTFLAGS: "-C debug-assertions -D warnings"
SKIP_WASM_BUILD: 1

# Job required by "confirmTestPassed"
integration-test:
needs: [integration-test-matrix]
continue-on-error: true
Expand Down Expand Up @@ -144,6 +150,7 @@ jobs:
env:
RUSTFLAGS: "-C debug-assertions -D warnings"

# Job required by "confirmTestPassed"
build-chain-spec-generator:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -190,6 +197,7 @@ jobs:
RUSTFLAGS: "-C debug-assertions -D warnings"
SKIP_WASM_BUILD: 1

# Job required by "confirmTestPassed"
zombienet-smoke:
needs: [build-chain-spec-generator]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -240,3 +248,19 @@ jobs:
run: |
export PATH=$(pwd)/target/release:$PATH
cargo test --manifest-path integration-tests/zombienet/Cargo.toml
# This will only run if all the tests in its "needs" array passed.
# Add this as your required job, becuase if the matrix changes size (new things get added)
# it will still require all the steps to succeed.
# If you add more jobs, remember to add them to the "needs" array.
confirmTestPassed:
runs-on: ubuntu-latest
name: All tests passed
# If any new job gets added, be sure to add it to this list
needs:
- runtime-test
- integration-test
- build-chain-spec-generator
- zombienet-smoke
steps:
- run: echo '### Good job! All the tests passed 🚀' >> $GITHUB_STEP_SUMMARY

0 comments on commit 750aa73

Please sign in to comment.