Skip to content

Commit 95ef33a

Browse files
Bordagithub-advanced-security[bot]Copilot
authored
Add testing-guardian job to aggregate test results (#2037)
* Add testing-guardian job to aggregate test results * Potential fix for code scanning alert no. 2: Workflow does not contain permissions * Apply suggestions from code review --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Co-authored-by: Copilot <[email protected]>
1 parent fc11bea commit 95ef33a

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

.github/workflows/uv-test.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
pull_request:
77
branches: [main, develop]
88

9+
permissions:
10+
contents: read
11+
912
concurrency:
1013
group: pytest-test-${{ github.ref }}
1114
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
@@ -30,7 +33,6 @@ jobs:
3033
python-version: ${{ matrix.python-version }}
3134
activate-environment: true
3235

33-
3436
- name: 🚀 Install Packages
3537
run: uv pip install -r pyproject.toml --group dev --group docs --extra metrics
3638

@@ -39,3 +41,25 @@ jobs:
3941

4042
- name: 🧪 Run the Test
4143
run: uv run pytest
44+
45+
46+
testing-guardian:
47+
runs-on: ubuntu-latest
48+
needs: run-tests
49+
if: always()
50+
steps:
51+
- name: Display test result
52+
run: echo "${{ needs.run-tests.result }}"
53+
- name: Fail guardian on test failure
54+
if: needs.run-tests.result == 'failure'
55+
run: exit 1
56+
# Ensure that cancelled or skipped test runs still cause this guardian job to fail,
57+
# using an explicit exit code instead of relying on timeout behavior.
58+
- name: cancelled or skipped...
59+
if: contains(fromJSON('["cancelled", "skipped"]'), needs.run-tests.result)
60+
run: |
61+
echo "run-tests job result is '${{ needs.run-tests.result }}'; failing explicitly."
62+
exit 1
63+
- name: tests succeeded
64+
if: needs.run-tests.result == 'success'
65+
run: echo "All tests completed successfully in job 'run-tests'."

0 commit comments

Comments
 (0)