-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (98 loc) · 4.08 KB
/
Copy pathdrift-check.yml
File metadata and controls
110 lines (98 loc) · 4.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Drift Check
# Daily drift detection for HK equity strategies.
on:
schedule:
- cron: "0 6 * * *"
workflow_dispatch:
permissions:
contents: read
issues: write
jobs:
preflight_backtests:
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
snapshot_repository_ref: ${{ steps.snapshot-input.outputs.snapshot_repository_ref }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Checkout QuantPlatformKit
uses: actions/checkout@v6
with:
repository: QuantStrategyLab/QuantPlatformKit
ref: 92458590a463e7219f0369a3505031ee74414135
path: external/QuantPlatformKit
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install dependencies
run: |
set -euo pipefail
python -m pip install --upgrade pip
python -m pip install pandas yfinance==1.2.2
python -m pip install --no-deps -e .
python -m pip install --no-deps -e external/QuantPlatformKit
- name: Resolve snapshot repository ref
id: snapshot-input
run: |
set -euo pipefail
snapshot_repository_ref="$(
git ls-remote \
https://github.com/QuantStrategyLab/HkEquitySnapshotPipelines.git \
refs/heads/main \
| awk '{print $1}'
)"
if [[ ! "$snapshot_repository_ref" =~ ^[0-9a-f]{40}$ ]]; then
echo "::error::Unable to resolve the public snapshot repository main SHA"
exit 1
fi
echo "snapshot_repository_ref=$snapshot_repository_ref" >> "$GITHUB_OUTPUT"
- name: Build lifecycle preflight bundle
env:
LIFECYCLE_PREFLIGHT_BUNDLE_ROOT: ${{ runner.temp }}/lifecycle-preflight-bundle
INPUT_ARTIFACT_ROOT: ${{ runner.temp }}/hk-lifecycle-inputs
run: |
set -euo pipefail
end_date="$(date -u -d 'tomorrow' '+%Y-%m-%d')"
python scripts/build_lifecycle_preflight.py \
--bundle-root "$LIFECYCLE_PREFLIGHT_BUNDLE_ROOT" \
--input-artifact-root "$INPUT_ARTIFACT_ROOT" \
--start 2020-08-27 \
--end "$end_date"
- name: Upload lifecycle preflight artifact
uses: actions/upload-artifact@v4
with:
name: lifecycle-preflight-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/lifecycle-preflight-bundle
if-no-files-found: error
retention-days: 14
- name: Upload normalized market input artifact
uses: actions/upload-artifact@v4
with:
name: hk-lifecycle-inputs-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/hk-lifecycle-inputs
if-no-files-found: error
retention-days: 14
drift:
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
needs: preflight_backtests
permissions:
contents: read
issues: write
id-token: write
uses: QuantStrategyLab/QuantPlatformKit/.github/workflows/reusable-drift-check.yml@92458590a463e7219f0369a3505031ee74414135
with:
strategy_domain: hk_equity
caller_event_name: ${{ github.event_name }}
caller_pr_head_repository: ${{ github.event.pull_request.head.repo.full_name || '' }}
snapshot_repository: QuantStrategyLab/HkEquitySnapshotPipelines
snapshot_checkout_path: external/HkEquitySnapshotPipelines
snapshot_repository_ref: ${{ needs.preflight_backtests.outputs.snapshot_repository_ref }}
ai_gateway_service_url: ${{ vars.AI_GATEWAY_SERVICE_URL }}
quant_platform_kit_ref: 92458590a463e7219f0369a3505031ee74414135
lifecycle_preflight_artifact: lifecycle-preflight-${{ github.run_id }}-${{ github.run_attempt }}
secrets:
codex_audit_service_url: ${{ secrets.CODEX_AUDIT_SERVICE_URL }}
snapshot_repository_token: ${{ secrets.SNAPSHOT_REPOSITORY_TOKEN || secrets.QSL_REPO_SYNC_TOKEN || github.token }}