Skip to content

Commit 4d020cb

Browse files
ci: add "test" as a separate job to confirm test-uv/test-pixi are done
1 parent 9029638 commit 4d020cb

File tree

3 files changed

+41
-68
lines changed

3 files changed

+41
-68
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
echo "use_pixi=false" >> $GITHUB_OUTPUT
6262
fi
6363
64-
# Job 3: Test Suite - UV Workflow
64+
# Job 3.1: Test Suite - UV Workflow
6565
# Traditional Python testing with uv for projects without pixi
6666
test-uv:
6767
needs: detect-test-strategy
@@ -99,24 +99,7 @@ jobs:
9999
run: |
100100
pytest -v || if [ $? -eq 5 ]; then exit 0; else exit $?; fi
101101
102-
# Job 3.1: Test Suite - UV Workflow - Complete
103-
# This creates a single check that passes only when all matrix jobs pass
104-
test-uv-complete:
105-
if: always() && needs.detect-test-strategy.outputs.use_pixi == 'false'
106-
needs: [detect-test-strategy, test-uv]
107-
runs-on: ubuntu-latest
108-
steps:
109-
- name: Check test-uv status
110-
run: |
111-
if [ "${{ needs.test-uv.result }}" == "success" ] || [ "${{ needs.test-uv.result }}" == "skipped" ]; then
112-
echo "All test-uv jobs passed!"
113-
exit 0
114-
else
115-
echo "Some test-uv jobs failed"
116-
exit 1
117-
fi
118-
119-
# Job 4: Test Suite - Pixi Workflow
102+
# Job 3.2: Test Suite - Pixi Workflow
120103
# Pixi-based testing for projects using pixi.toml
121104
test-pixi:
122105
needs: detect-test-strategy
@@ -153,24 +136,28 @@ jobs:
153136
run: |
154137
pixi run -e ${{ matrix.environment }} test || if [ $? -eq 5 ]; then exit 0; else exit $?; fi
155138
156-
# Job 4.1: Test Suite - Pixi Workflow - Complete
157-
# This creates a single check that passes only when all matrix jobs pass
158-
test-pixi-complete:
159-
if: always() && needs.detect-test-strategy.outputs.use_pixi == 'true'
160-
needs: [detect-test-strategy, test-pixi]
139+
# Job 3.3: Test Suite - Complete
140+
# Unified test status for branch protection
141+
test:
142+
if: always()
143+
needs: [detect-test-strategy, test-uv, test-pixi]
161144
runs-on: ubuntu-latest
162145
steps:
163-
- name: Check test-pixi status
146+
- name: Check test results
164147
run: |
165-
if [ "${{ needs.test-pixi.result }}" == "success" ] || [ "${{ needs.test-pixi.result }}" == "skipped" ]; then
166-
echo "All test-pixi jobs passed!"
167-
exit 0
168-
else
169-
echo "Some test-pixi jobs failed"
170-
exit 1
148+
uv_result="${{ needs.test-uv.result }}"
149+
pixi_result="${{ needs.test-pixi.result }}"
150+
# One should succeed, the other should be skipped
151+
if [ "$uv_result" == "success" ] || [ "$uv_result" == "skipped" ]; then
152+
if [ "$pixi_result" == "success" ] || [ "$pixi_result" == "skipped" ]; then
153+
echo "All tests passed!"
154+
exit 0
155+
fi
171156
fi
157+
echo "Tests failed: uv=$uv_result, pixi=$pixi_result"
158+
exit 1
172159
173-
# Job 5: Build Verification
160+
# Job 4: Build Verification
174161
# Ensures the package can be built successfully
175162
build:
176163
runs-on: ubuntu-latest
@@ -206,5 +193,5 @@ jobs:
206193
# This ensures the package is usable after installation
207194
run: ap --help
208195

209-
# Job 6: Type Check
196+
# Job 5: Type Check
210197
# typecheck:

afterpython/templates/ci-workflow-template.yml

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
echo "use_pixi=false" >> $GITHUB_OUTPUT
6262
fi
6363
64-
# Job 3: Test Suite - UV Workflow
64+
# Job 3.1: Test Suite - UV Workflow
6565
# Traditional Python testing with uv for projects without pixi
6666
test-uv:
6767
needs: detect-test-strategy
@@ -99,24 +99,7 @@ jobs:
9999
run: |
100100
pytest -v || if [ $? -eq 5 ]; then exit 0; else exit $?; fi
101101
102-
# Job 3.1: Test Suite - UV Workflow - Complete
103-
# This creates a single check that passes only when all matrix jobs pass
104-
test-uv-complete:
105-
if: always() && needs.detect-test-strategy.outputs.use_pixi == 'false'
106-
needs: [detect-test-strategy, test-uv]
107-
runs-on: ubuntu-latest
108-
steps:
109-
- name: Check test-uv status
110-
run: |
111-
if [ "${{ needs.test-uv.result }}" == "success" ] || [ "${{ needs.test-uv.result }}" == "skipped" ]; then
112-
echo "All test-uv jobs passed!"
113-
exit 0
114-
else
115-
echo "Some test-uv jobs failed"
116-
exit 1
117-
fi
118-
119-
# Job 4: Test Suite - Pixi Workflow
102+
# Job 3.2: Test Suite - Pixi Workflow
120103
# Pixi-based testing for projects using pixi.toml
121104
test-pixi:
122105
needs: detect-test-strategy
@@ -153,24 +136,28 @@ jobs:
153136
run: |
154137
pixi run -e ${{ matrix.environment }} test || if [ $? -eq 5 ]; then exit 0; else exit $?; fi
155138
156-
# Job 4.1: Test Suite - Pixi Workflow - Complete
157-
# This creates a single check that passes only when all matrix jobs pass
158-
test-pixi-complete:
159-
if: always() && needs.detect-test-strategy.outputs.use_pixi == 'true'
160-
needs: [detect-test-strategy, test-pixi]
139+
# Job 3.3: Test Suite - Complete
140+
# Unified test status for branch protection
141+
test:
142+
if: always()
143+
needs: [detect-test-strategy, test-uv, test-pixi]
161144
runs-on: ubuntu-latest
162145
steps:
163-
- name: Check test-pixi status
146+
- name: Check test results
164147
run: |
165-
if [ "${{ needs.test-pixi.result }}" == "success" ] || [ "${{ needs.test-pixi.result }}" == "skipped" ]; then
166-
echo "All test-pixi jobs passed!"
167-
exit 0
168-
else
169-
echo "Some test-pixi jobs failed"
170-
exit 1
148+
uv_result="${{ needs.test-uv.result }}"
149+
pixi_result="${{ needs.test-pixi.result }}"
150+
# One should succeed, the other should be skipped
151+
if [ "$uv_result" == "success" ] || [ "$uv_result" == "skipped" ]; then
152+
if [ "$pixi_result" == "success" ] || [ "$pixi_result" == "skipped" ]; then
153+
echo "All tests passed!"
154+
exit 0
155+
fi
171156
fi
157+
echo "Tests failed: uv=$uv_result, pixi=$pixi_result"
158+
exit 1
172159
173-
# Job 5: Build Verification
160+
# Job 4: Build Verification
174161
# Ensures the package can be built successfully
175162
build:
176163
runs-on: ubuntu-latest
@@ -206,5 +193,5 @@ jobs:
206193
# This ensures the package is usable after installation
207194
run: ap --help
208195

209-
# Job 6: Type Check
196+
# Job 5: Type Check
210197
# typecheck:

afterpython/tools/branch_rules.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
"parameters": {
3232
"required_status_checks": [
3333
{"context": "lint"},
34-
{"context": "test-uv-complete"},
35-
{"context": "test-pixi-complete"},
34+
{"context": "test"},
3635
{"context": "build"},
3736
],
3837
# The PR branch must be up to date with the base branch (main) before merging

0 commit comments

Comments
 (0)