3333 github.ref == 'refs/heads/develop' ||
3434 github.event_name == 'workflow_dispatch'
3535 outputs :
36+ code_quality_tests : ${{ steps.determine-test-type.outputs.code_quality_tests }}
37+ pr_review_tests : ${{ steps.determine-test-type.outputs.pr_review_tests }}
3638 local_tests : ${{ steps.determine-test-type.outputs.local_tests }}
3739 remote_tests : ${{ steps.determine-test-type.outputs.remote_tests }}
3840 pr_approval_state : ${{ steps.approval.outputs.approved }}
9597
9698 remote_tests=false
9799 local_tests=false
100+ code_quality_tests=false
101+ pr_review_tests=false
102+
98103 # Workflow_dispatch input override
99104 if [[ "$EVENT_NAME" == "workflow_dispatch" ]]; then
100-
105+ code_quality_tests=true
101106 # Each option is self contained
102107 if [[ "$INPUT_REMOTE" == "true" ]]; then
103108 remote_tests=true
@@ -111,39 +116,46 @@ jobs:
111116 # All PRs that have been triggered need local tests and approved ones need to re-run the remote tests
112117 if [[ "$EVENT_NAME" == "pull_request" ]]; then
113118 local_tests=true
119+ code_quality_tests=true
120+ pr_review_tests=true
114121 [[ "$APPROVED" == "true" ]] && remote_tests=true
115122 fi
116123
117124 if [[ "$EVENT_NAME" == "merge_group" ]]; then
118125 local_tests=true
119126 remote_tests=true
127+ code_quality_tests=true
120128 fi
121129
122130 # If triggered by PR review and approved
123131 if [[ "$EVENT_NAME" == "pull_request_review" ]]; then
124132 if [[ "$REVIEW_STATE" == "approved" ]]; then
133+ code_quality_tests=true
134+ pr_review_tests=true
125135 local_tests=true
126136 remote_tests=true
127- else
128- local_tests=false
129- remote_tests=false
130137 fi
131138 fi
132139
133140 # If it's a push to develop
134141 if [[ "$EVENT_NAME" == "push" && "$REF" == "refs/heads/develop" ]]; then
135142 local_tests=true
136143 remote_tests=true
144+ code_quality_tests=true
137145 fi
138146
139147 echo "local_tests=$local_tests" >> $GITHUB_OUTPUT
140148 echo "remote_tests=$remote_tests" >> $GITHUB_OUTPUT
149+ echo "code_quality_tests=$code_quality_tests" >> $GITHUB_OUTPUT
150+ echo "pr_review_tests=$pr_review_tests" >> $GITHUB_OUTPUT
151+ echo "code_quality_tests=$code_quality_tests"
152+ echo "pr_review_tests=$pr_review_tests"
141153 echo "local_tests=$local_tests"
142154 echo "remote_tests=$remote_tests"
143155
144156 lint :
145157 needs : determine-test-scope
146- if : ( needs.determine-test-scope.outputs.local_tests == 'true' ) || ( needs.determine-test-scope.outputs.remote_tests == 'true' )
158+ if : needs.determine-test-scope.outputs.code_quality_tests == 'true'
147159 name : verify-linting
148160 runs-on : ubuntu-latest
149161 container : ghcr.io/astral-sh/uv:debian
@@ -163,6 +175,8 @@ jobs:
163175 zizmor :
164176 name : Run zizmor 🌈
165177 runs-on : ubuntu-latest
178+ needs : determine-test-scope
179+ if : needs.determine-test-scope.outputs.code_quality_tests == 'true'
166180 permissions :
167181 security-events : write
168182 steps :
@@ -177,10 +191,10 @@ jobs:
177191 lint-branch-name :
178192 needs : determine-test-scope
179193 runs-on : ubuntu-latest
194+ if : needs.determine-test-scope.outputs.pr_review_tests == 'true'
180195 name : lint-branch-name
181196 env :
182197 PR_TITLE : ${{ github.event.pull_request.title }}
183- if : github.event_name == 'pull_request'
184198 steps :
185199 - name : extract-branch-name
186200 id : extract-branch-name
@@ -225,6 +239,7 @@ jobs:
225239 lint-commit-messages :
226240 needs : determine-test-scope
227241 runs-on : ubuntu-latest
242+ if : needs.determine-test-scope.outputs.pr_review_tests == 'true'
228243 name : lint-commit-messages
229244 steps :
230245 - name : Check out source code
@@ -260,9 +275,7 @@ jobs:
260275 verify-schema-change :
261276 name : verify-schema-change
262277 needs : determine-test-scope
263- if : |
264- (( needs.determine-test-scope.outputs.local_tests == 'true' ) ||
265- ( needs.determine-test-scope.outputs.remote_tests == 'true' ))
278+ if : needs.determine-test-scope.outputs.code_quality_tests == 'true'
266279 runs-on : ubuntu-latest
267280 container : ghcr.io/astral-sh/uv:debian
268281 defaults :
@@ -568,42 +581,67 @@ jobs:
568581 maxColorRange : 95
569582 valColorRange : ${{ env.total }}
570583 style : " for-the-badge"
571-
584+
572585 pr-requirements-pass :
573586 name : pr-requirements-pass
574587 if : |
575588 always() &&
576- ((github.event_name == 'pull_request') || (github.event_name == 'pull_request_review') || (github.event_name == 'merge_group' )) &&
577- (( needs.determine-test-scope.outputs.pr_approval_state == 'true' ) &&
578- ( needs.determine-test-scope.outputs.local_tests == 'true' ) ||
579- ( needs.determine-test-scope.outputs.remote_tests == 'true' ))
580- needs : [local-tests, remote-tests, lint, verify-schema-change, lint-commit-messages, lint-branch-name, zizmor]
589+ (github.event_name == 'pull_request' || github.event_name == 'pull_request_review' || github.event_name == 'merge_group') &&
590+ ((needs.determine-test-scope.outputs.pr_approval_state == 'true' && needs.determine-test-scope.outputs.local_tests == 'true') || needs.determine-test-scope.outputs.remote_tests == 'true')
591+ needs :
592+ - determine-test-scope
593+ - local-tests
594+ - remote-tests
595+ - lint
596+ - verify-schema-change
597+ - lint-commit-messages
598+ - lint-branch-name
599+ - zizmor
581600 runs-on : ubuntu-latest
582601 steps :
583- - name : check-passing-remote-tests
602+ - name : check-linting-result
603+ if : ${{ needs.lint.result != 'success' }}
584604 run : |
585- echo "Local tests result: ${{ needs.local-tests.result }}"
586- echo "Remote tests result: ${{ needs.remote-tests.result }}"
605+ echo "❌ Linting failed."
606+ exit 1
607+
608+ - name : check-schema-change-verification
609+ if : ${{ needs.verify-schema-change.result != 'success' }}
610+ run : |
611+ echo "❌ Schema change verification failed."
612+ exit 1
613+
614+ - name : check-local-tests-result
615+ if : ${{ needs.local-tests.result != 'success' }}
616+ run : |
617+ echo "❌ Local tests failed."
618+ exit 1
619+
620+ - name : check-remote-tests-result
621+ if : ${{ needs.remote-tests.result != 'success' }}
622+ run : |
623+ echo "❌ Remote tests failed."
624+ exit 1
625+
626+ - name : check-commit-message-linting
627+ if : ${{ github.event_name == 'merge_group' && needs.lint-commit-messages.result != 'success' }}
628+ run : |
629+ echo "❌ Commit message linting failed."
630+ exit 1
631+
632+ - name : check-branch-name-linting
633+ if : ${{ needs.determine-test-scope.outputs.pr_review_tests == 'true' && needs.lint-branch-name.result != 'success' }}
634+ run : |
635+ echo "❌ Branch name linting failed."
636+ exit 1
637+
638+ - name : check-zizmor-static-analysis
639+ if : ${{ needs.determine-test-scope.outputs.code_quality_tests == 'true' && needs.zizmor.result != 'success' }}
640+ run : |
641+ echo "❌ Zizmor static analysis failed."
642+ exit 1
643+
644+ - name : all-checks-passed
645+ if : ${{ success() }}
646+ run : echo "✅ All required jobs passed!"
587647
588- if [[ "${{ needs.lint.result }}" != 'success' ]]; then
589- echo "❌ Linting failed or was skipped."
590- exit 1
591- elif [[ "${{ needs.verify-schema-change.result }}" != 'success' ]]; then
592- echo "❌ verify-schema-change failed or was skipped."
593- exit 1
594- elif [[ "${{ needs.remote-tests.result }}" != 'success' ]]; then
595- echo "❌ remote-tests failed or were skipped."
596- exit 1 # Given remote-tests always run after a PR is approved
597- elif [[ "${{ needs.local-tests.result }}" != 'success' ]]; then
598- echo "❌ local-tests failed or were skipped."
599- elif [[ "${{ github.event_name }}" == 'merge_group' && "${{ needs.lint-commit-messages.result }}" != 'success' ]]; then
600- echo "❌ Linting of commit messages failed or was skipped."
601- exit 1
602- elif [[ "${{ github.event_name }}" == 'pull_request' && "${{ needs.lint-branch-name.result }}" != 'success' ]]; then
603- echo "❌ Linting of branch name failed."
604- exit 1
605- elif [[ "${{ needs.zizmor.result }}" != 'success' ]]; then
606- echo "❌ Static check of github actions with zizmor failed."
607- exit 1
608- fi
609- echo "✅ All required test jobs passed!"
0 commit comments