From 750aa739020f0a42073d925f98f03b38d43a1888 Mon Sep 17 00:00:00 2001 From: Javier Bullrich Date: Mon, 24 Jun 2024 22:23:17 +0200 Subject: [PATCH] =?UTF-8?q?Unified=20tests=20into=20final=20step=20?= =?UTF-8?q?=E2=9C=85=20=20(#192)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unified all the tests into having one final step at the end. image 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: image 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 --- .github/workflows/check-migrations.yml | 18 ++++++++++++++++++ .github/workflows/test.yml | 24 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/.github/workflows/check-migrations.yml b/.github/workflows/check-migrations.yml index 11fa1fe9c5..72ba40db29 100644 --- a/.github/workflows/check-migrations.yml +++ b/.github/workflows/check-migrations.yml @@ -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-*"] @@ -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: @@ -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 @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e74b57668f..37d64a5b3f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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-*"] @@ -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: @@ -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 @@ -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 @@ -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: @@ -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 @@ -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