Skip to content

Commit dca8f69

Browse files
daquinteroflexyaugenst-flex
authored andcommitted
ci: Enforce pr-requirements pass
1 parent 108f807 commit dca8f69

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

.github/workflows/run_tests.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
outputs:
3737
local_tests: ${{ steps.determine-test-type.outputs.local_tests }}
3838
remote_tests: ${{ steps.determine-test-type.outputs.remote_tests }}
39+
pr_approval_state: ${{ steps.approval.outputs.approved }}
3940
steps:
4041
- name: check-current-approval-status
4142
id: approval
@@ -144,7 +145,8 @@ jobs:
144145
image: ghcr.io/astral-sh/uv:debian
145146
options: --user 31001:61001 # Required slurm-batch UID: slurm GID for tmp/ file removal
146147
concurrency:
147-
group: local-tests-${{ github.ref }}
148+
group: local-tests-${{ github.ref }}-${{ matrix.python-version }}
149+
cancel-in-progress: true # Required so it does not use previous state
148150
strategy:
149151
matrix:
150152
python-version: ['3.9', '3.13']
@@ -324,26 +326,26 @@ jobs:
324326

325327
pr-requirements-pass:
326328
name: pr-requirements-pass
327-
if: ( needs.determine-test-scope.outputs.local_tests == 'true' ) || ( needs.determine-test-scope.outputs.remote_tests == 'true' )
329+
if: always() && ( needs.determine-test-scope.outputs.local_tests == 'true' ) || ( needs.determine-test-scope.outputs.remote_tests == 'true' ) # always will run if dependent job is skipped
328330
needs: [local-tests, remote-tests, lint]
329331
runs-on: ubuntu-latest
330332
steps:
331333
- name: check-passing-remote-tests
332334
run: |
333335
echo "Remote tests result: ${{ needs.remote-tests.result }}"
334336
335-
if [[ "${{ needs.lint.result }}" != "success" ]]; then
337+
if [[ "${{ needs.lint.result }}" != 'success' ]]; then
336338
echo "❌ Linting failed or was skipped."
337339
exit 1
338-
fi
339-
340-
if [[ "${{ needs.remote-tests.result }}" != "success" ]]; then
340+
elif [[ "${{ needs.remote-tests.result }}" != 'success' ]]; then
341341
echo "❌ remote-tests failed or were skipped."
342-
fi
343-
344-
if [[ "${{ needs.local-tests.result }}" != "success" ]]; then
342+
exit 1 # Given remote-tests always run after a PR is approved
343+
elif [[ "${{ needs.local-tests.result }}" != 'success' ]]; then
345344
echo "❌ local-tests failed or were skipped."
346345
exit 1
346+
elif [[ "${{ needs.determine-test-scope.outputs.pr_approval_state }}" == 'true' && github.event.pull_request ]]; then
347+
echo "❌ PR requires approval."
348+
exit 1
349+
else
350+
echo "✅ All required test jobs passed!"
347351
fi
348-
349-
echo "✅ All required test jobs passed!"

0 commit comments

Comments
 (0)