Skip to content

Commit 83c18aa

Browse files
Pigbibicodex
andcommitted
ci: split P2 gate from legacy full suite
Co-Authored-By: Codex <noreply@openai.com>
1 parent 8972cc2 commit 83c18aa

2 files changed

Lines changed: 132 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,100 @@ jobs:
131131
- name: Ensure uv.lock matches pyproject.toml
132132
run: uv lock --check
133133

134-
- name: Run unit tests
134+
- name: Run P2 scoped unit tests
135+
run: |
136+
set -euo pipefail
137+
# P2 scoped gate; this is not a repository-wide full-suite result.
138+
PYTHONPATH=. PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --no-sync python -m pytest -q tests/test_broker_reconciliation.py tests/test_execution_service.py tests/test_rebalance_service.py tests/test_ci_unit_test_contract.py
139+
140+
- name: Summarize P2 scoped gate
141+
run: |
142+
echo "P2 scoped gate passed; this is not a repository-wide full-suite result." >> "$GITHUB_STEP_SUMMARY"
143+
144+
legacy-full-suite:
145+
runs-on: ubuntu-latest
146+
timeout-minutes: 20
147+
steps:
148+
- name: Checkout
149+
uses: actions/checkout@v6
150+
151+
- name: Resolve QuantPlatformKit ref
152+
id: quant-platform-kit-ref
153+
run: |
154+
set -euo pipefail
155+
ref="main"
156+
for candidate in "${GITHUB_HEAD_REF:-}" "${GITHUB_BASE_REF:-}"; do
157+
if [ -n "$candidate" ] && git ls-remote --exit-code --heads https://github.com/QuantStrategyLab/QuantPlatformKit.git "$candidate" >/dev/null 2>&1; then
158+
ref="$candidate"
159+
break
160+
fi
161+
done
162+
echo "ref=${ref}" >> "$GITHUB_OUTPUT"
163+
164+
- name: Resolve UsEquityStrategies ref
165+
id: us-equity-strategies-ref
166+
run: |
167+
set -euo pipefail
168+
ref="main"
169+
for candidate in "${GITHUB_HEAD_REF:-}" "${GITHUB_BASE_REF:-}"; do
170+
if [ -n "$candidate" ] && git ls-remote --exit-code --heads https://github.com/QuantStrategyLab/UsEquityStrategies.git "$candidate" >/dev/null 2>&1; then
171+
ref="$candidate"
172+
break
173+
fi
174+
done
175+
echo "ref=${ref}" >> "$GITHUB_OUTPUT"
176+
177+
- name: Resolve UsEquitySnapshotPipelines ref
178+
id: us-equity-snapshot-pipelines-ref
179+
run: |
180+
set -euo pipefail
181+
ref="main"
182+
for candidate in "${GITHUB_HEAD_REF:-}" "${GITHUB_BASE_REF:-}"; do
183+
if [ -n "$candidate" ] && git ls-remote --exit-code --heads https://github.com/QuantStrategyLab/UsEquitySnapshotPipelines.git "$candidate" >/dev/null 2>&1; then
184+
ref="$candidate"
185+
break
186+
fi
187+
done
188+
echo "ref=${ref}" >> "$GITHUB_OUTPUT"
189+
190+
- name: Checkout QuantPlatformKit
191+
uses: actions/checkout@v6
192+
with:
193+
repository: QuantStrategyLab/QuantPlatformKit
194+
ref: ${{ steps.quant-platform-kit-ref.outputs.ref }}
195+
path: external/QuantPlatformKit
196+
197+
- name: Checkout UsEquityStrategies
198+
uses: actions/checkout@v6
199+
with:
200+
repository: QuantStrategyLab/UsEquityStrategies
201+
ref: ${{ steps.us-equity-strategies-ref.outputs.ref }}
202+
path: external/UsEquityStrategies
203+
204+
- name: Checkout UsEquitySnapshotPipelines
205+
uses: actions/checkout@v6
206+
with:
207+
repository: QuantStrategyLab/UsEquitySnapshotPipelines
208+
ref: ${{ steps.us-equity-snapshot-pipelines-ref.outputs.ref }}
209+
path: external/UsEquitySnapshotPipelines
210+
211+
- name: Setup Python
212+
uses: actions/setup-python@v6
213+
with:
214+
python-version: "3.12"
215+
216+
- name: Install dependencies
217+
run: |
218+
set -euo pipefail
219+
python -m pip install --upgrade pip uv
220+
uv sync --frozen --extra test
221+
222+
- name: Install editable shared repositories
223+
run: |
224+
set -euo pipefail
225+
uv pip install --no-deps -e external/QuantPlatformKit -e external/UsEquityStrategies -e external/UsEquitySnapshotPipelines
226+
227+
- name: Run legacy full suite
135228
run: |
136229
set -euo pipefail
137230
PYTHONPATH=. PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --no-sync python -m pytest -q tests --ignore=tests/test_request_handling.py --ignore=tests/test_event_loop.py --ignore=tests/test_monitor_dispatcher.py --ignore=tests/test_notifications.py --ignore=tests/test_connect_timeout_alert.py
Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,43 @@
11
from pathlib import Path
2+
import re
23

34

4-
def test_ci_runs_unit_tests_fail_closed() -> None:
5+
_P2_TEST_COMMAND = (
6+
"python -m pytest -q "
7+
"tests/test_broker_reconciliation.py "
8+
"tests/test_execution_service.py "
9+
"tests/test_rebalance_service.py "
10+
"tests/test_ci_unit_test_contract.py"
11+
)
12+
_LEGACY_FULL_SUITE_COMMAND = (
13+
"python -m pytest -q tests "
14+
"--ignore=tests/test_request_handling.py "
15+
"--ignore=tests/test_event_loop.py "
16+
"--ignore=tests/test_monitor_dispatcher.py "
17+
"--ignore=tests/test_notifications.py "
18+
"--ignore=tests/test_connect_timeout_alert.py"
19+
)
20+
21+
22+
def _job_block(workflow: str, job_name: str) -> str:
23+
match = re.search(
24+
rf"^ {re.escape(job_name)}:\n(?P<block>.*?)(?=^ [A-Za-z][A-Za-z0-9-]*:\n|\Z)",
25+
workflow,
26+
flags=re.MULTILINE | re.DOTALL,
27+
)
28+
assert match is not None
29+
return match.group("block")
30+
31+
32+
def test_ci_runs_p2_scoped_required_gate_and_unsuppressed_legacy_suite() -> None:
533
workflow = Path(".github/workflows/ci.yml").read_text(encoding="utf-8")
6-
unit_test_step = workflow.split(" - name: Run unit tests\n", maxsplit=1)[1]
34+
required_job = _job_block(workflow, "test")
35+
legacy_job = _job_block(workflow, "legacy-full-suite")
736

8-
assert "python -m pytest -q tests" in unit_test_step
9-
assert "|| true" not in unit_test_step
37+
assert _P2_TEST_COMMAND in required_job
38+
assert _LEGACY_FULL_SUITE_COMMAND in legacy_job
39+
assert "P2 scoped gate" in required_job
40+
assert "GITHUB_STEP_SUMMARY" in required_job
41+
assert "|| true" not in required_job
42+
assert "|| true" not in legacy_job
43+
assert "continue-on-error" not in workflow

0 commit comments

Comments
 (0)