From 77632dd2aba92cf14c9d09e24f1343db639dfd6a Mon Sep 17 00:00:00 2001 From: geekflyer Date: Sat, 3 Jun 2023 17:55:42 -0700 Subject: [PATCH] fix trigger condition for build jobs --- .github/workflows/docker-build-test.yaml | 93 +++++++++++------------- 1 file changed, 43 insertions(+), 50 deletions(-) diff --git a/.github/workflows/docker-build-test.yaml b/.github/workflows/docker-build-test.yaml index ac104494d8223d..f6c50e8c0f417f 100644 --- a/.github/workflows/docker-build-test.yaml +++ b/.github/workflows/docker-build-test.yaml @@ -171,43 +171,8 @@ jobs: FEATURES: consensus-only-perf-test BUILD_ADDL_TESTING_IMAGES: true - rust-images-all: - needs: - [ - determine-docker-build-metadata, - rust-images, - rust-images-indexer, - rust-images-failpoints, - rust-images-performance, - rust-images-consensus-only-perf-test, - ] - if: always() # this ensures that the job will run even if the previous jobs were skipped - runs-on: ubuntu-latest - steps: - - name: fail if rust-images job failed - if: ${{ needs.rust-images.result == 'failure' }} - run: exit 1 - - name: fail if rust-images-indexer job failed - if: ${{ needs.rust-images-indexer.result == 'failure' }} - run: exit 1 - - name: fail if rust-images-failpoints job failed - if: ${{ needs.rust-images-failpoints.result == 'failure' }} - run: exit 1 - - name: fail if rust-images-performance job failed - if: ${{ needs.rust-images-performance.result == 'failure' }} - run: exit 1 - - name: fail if rust-images-consensus-only-perf-test job failed - if: ${{ needs.rust-images-consensus-only-perf-test.result == 'failure' }} - run: exit 1 - outputs: - rustImagesResult: ${{ needs.rust-images.result }} - rustImagesIndexerResult: ${{ needs.rust-images-indexer.result }} - rustImagesFailpointsResult: ${{ needs.rust-images-failpoints.result }} - rustImagesPerformanceResult: ${{ needs.rust-images-performance.result }} - rustImagesConsensusOnlyPerfTestResult: ${{ needs.rust-images-consensus-only-perf-test.result }} - sdk-release: - needs: [rust-images, determine-docker-build-metadata] # runs with the default release docker build variant "rust-images" + needs: [permission-check, rust-images, determine-docker-build-metadata] # runs with the default release docker build variant "rust-images" if: | (github.event_name == 'push' && github.ref_name != 'main') || github.event_name == 'workflow_dispatch' || @@ -220,7 +185,7 @@ jobs: GIT_SHA: ${{ needs.determine-docker-build-metadata.outputs.gitSha }} cli-e2e-tests: - needs: [rust-images, determine-docker-build-metadata] # runs with the default release docker build variant "rust-images" + needs: [permission-check, rust-images, determine-docker-build-metadata] # runs with the default release docker build variant "rust-images" if: | !contains(github.event.pull_request.labels.*.name, 'CICD:skip-sdk-integration-test') && ( github.event_name == 'push' || @@ -235,7 +200,7 @@ jobs: GIT_SHA: ${{ needs.determine-docker-build-metadata.outputs.gitSha }} indexer-grpc-e2e-tests: - needs: [rust-images, determine-docker-build-metadata] # runs with the default release docker build variant "rust-images" + needs: [permission-check, rust-images, determine-docker-build-metadata] # runs with the default release docker build variant "rust-images" if: | (github.event_name == 'push' && github.ref_name != 'main') || github.event_name == 'workflow_dispatch' || @@ -248,9 +213,16 @@ jobs: GIT_SHA: ${{ needs.determine-docker-build-metadata.outputs.gitSha }} forge-e2e-test: - needs: [rust-images-all, determine-docker-build-metadata] - if: | # always() ensures that the job will run even if some of the previous docker variant build jobs were skipped https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions - always() && needs.rust-images-all.result == 'success' && ( + needs: + - permission-check + - determine-docker-build-metadata + - rust-images + - rust-images-indexer + - rust-images-failpoints + - rust-images-performance + - rust-images-consensus-only-perf-test + if: | + !failure() && !cancelled() && needs.permission-check.result == 'success' && ( (github.event_name == 'push' && github.ref_name != 'main') || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'CICD:run-e2e-tests') || @@ -272,9 +244,16 @@ jobs: # Run e2e compat test against testnet branch forge-compat-test: - needs: [rust-images-all, determine-docker-build-metadata] - if: | # always() ensures that the job will run even if some of the previous docker variant build jobs were skipped https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions - always() && needs.rust-images-all.result == 'success' && ( + needs: + - permission-check + - determine-docker-build-metadata + - rust-images + - rust-images-indexer + - rust-images-failpoints + - rust-images-performance + - rust-images-consensus-only-perf-test + if: | + !failure() && !cancelled() && needs.permission-check.result == 'success' && ( (github.event_name == 'push' && github.ref_name != 'main') || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'CICD:run-e2e-tests') || @@ -293,9 +272,16 @@ jobs: # Run forge framework upgradability test forge-framework-upgrade-test: - needs: [rust-images-all, determine-docker-build-metadata] - if: | # always() ensures that the job will run even if some of the previous docker variant build jobs were skipped https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions - always() && needs.rust-images-all.result == 'success' && ( + needs: + - permission-check + - determine-docker-build-metadata + - rust-images + - rust-images-indexer + - rust-images-failpoints + - rust-images-performance + - rust-images-consensus-only-perf-test + if: | + !failure() && !cancelled() && needs.permission-check.result == 'success' && ( (github.event_name == 'push' && github.ref_name != 'main') || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'CICD:run-e2e-tests') || @@ -313,9 +299,16 @@ jobs: FORGE_NAMESPACE: forge-framework-upgrade-${{ needs.determine-docker-build-metadata.outputs.targetCacheId }} forge-consensus-only-perf-test: - needs: [rust-images-all, determine-docker-build-metadata] - if: | # always() ensures that the job will run even if some of the previous docker variant build jobs were skipped https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions - always() && needs.rust-images-all.result == 'success' && + needs: + - permission-check + - determine-docker-build-metadata + - rust-images + - rust-images-indexer + - rust-images-failpoints + - rust-images-performance + - rust-images-consensus-only-perf-test + if: | + !failure() && !cancelled() && needs.permission-check.result == 'success' && contains(github.event.pull_request.labels.*.name, 'CICD:run-consensus-only-perf-test') uses: aptos-labs/aptos-core/.github/workflows/workflow-run-forge.yaml@main secrets: inherit