Skip to content

Commit 0da7005

Browse files
committed
Fix CI snapshot pipeline checkout
1 parent 929a150 commit 0da7005

2 files changed

Lines changed: 33 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ jobs:
3232
fi
3333
echo "ref=${ref}" >> "$GITHUB_OUTPUT"
3434
35+
- name: Resolve UsEquitySnapshotPipelines ref
36+
id: us-equity-snapshot-pipelines-ref
37+
run: |
38+
set -euo pipefail
39+
ref="main"
40+
if [ -n "${GITHUB_HEAD_REF:-}" ] && git ls-remote --exit-code --heads https://github.com/QuantStrategyLab/UsEquitySnapshotPipelines.git "${GITHUB_HEAD_REF}" >/dev/null 2>&1; then
41+
ref="${GITHUB_HEAD_REF}"
42+
fi
43+
echo "ref=${ref}" >> "$GITHUB_OUTPUT"
44+
3545
- name: Checkout QuantPlatformKit
3646
uses: actions/checkout@v6
3747
with:
@@ -46,6 +56,13 @@ jobs:
4656
ref: ${{ steps.us-equity-strategies-ref.outputs.ref }}
4757
path: external/UsEquityStrategies
4858

59+
- name: Checkout UsEquitySnapshotPipelines
60+
uses: actions/checkout@v6
61+
with:
62+
repository: QuantStrategyLab/UsEquitySnapshotPipelines
63+
ref: ${{ steps.us-equity-snapshot-pipelines-ref.outputs.ref }}
64+
path: external/UsEquitySnapshotPipelines
65+
4966
- name: Setup Python
5067
uses: actions/setup-python@v6
5168
with:
@@ -56,12 +73,12 @@ jobs:
5673
set -euo pipefail
5774
python -m pip install --upgrade pip
5875
python -m pip install -r requirements.txt pytest ruff
59-
python -m pip install --no-deps -e external/QuantPlatformKit -e external/UsEquityStrategies
76+
python -m pip install --no-deps -e external/QuantPlatformKit -e external/UsEquityStrategies -e external/UsEquitySnapshotPipelines
6077
6178
- name: Run ruff
6279
run: |
6380
set -euo pipefail
64-
ruff check .
81+
ruff check --exclude external .
6582
6683
- name: Run unit tests
6784
run: |

research/backtest_stock_alpha_suite.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,20 @@
2727
import yfinance as yf
2828

2929

30-
WORKSPACE_ROOT = Path(__file__).resolve().parents[2]
31-
US_EQUITY_STRATEGIES_ROOT = WORKSPACE_ROOT / "UsEquityStrategies"
32-
US_EQUITY_SNAPSHOT_PIPELINES_ROOT = WORKSPACE_ROOT / "UsEquitySnapshotPipelines"
33-
QUANT_PLATFORM_KIT_ROOT = WORKSPACE_ROOT / "QuantPlatformKit"
30+
REPO_ROOT = Path(__file__).resolve().parents[1]
31+
WORKSPACE_ROOT = REPO_ROOT.parent
32+
33+
34+
def _resolve_workspace_repo(repo_name: str) -> Path:
35+
for candidate in (WORKSPACE_ROOT / repo_name, REPO_ROOT / "external" / repo_name):
36+
if candidate.exists():
37+
return candidate
38+
return WORKSPACE_ROOT / repo_name
39+
40+
41+
US_EQUITY_STRATEGIES_ROOT = _resolve_workspace_repo("UsEquityStrategies")
42+
US_EQUITY_SNAPSHOT_PIPELINES_ROOT = _resolve_workspace_repo("UsEquitySnapshotPipelines")
43+
QUANT_PLATFORM_KIT_ROOT = _resolve_workspace_repo("QuantPlatformKit")
3444
LOCAL_RUNS_ROOT = WORKSPACE_ROOT / "_local_runs"
3545

3646
for candidate in (

0 commit comments

Comments
 (0)