-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (101 loc) · 3.58 KB
/
Copy pathci.yml
File metadata and controls
117 lines (101 loc) · 3.58 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
111
112
113
114
115
116
117
name: CI
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
jobs:
test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: |
requirements.txt
pyproject.toml
quantcore/pyproject.toml
tickbridge/pyproject.toml
querybus/pyproject.toml
pulsefan/pyproject.toml
kvcache/pyproject.toml
- name: Install core deps (without heavy data-source SDKs)
run: |
python -m pip install --upgrade pip
# Core deps needed to run the unit test suite. Heavy SDKs
# (akshare/yfinance/etc.) are NOT installed because the unit
# tests mock them; CI installation should stay fast.
pip install \
python-dotenv requests pandas numpy sqlalchemy \
fastapi uvicorn starlette pydantic pydantic-settings \
litellm Jinja2 \
tenacity fake-useragent json-repair python-dateutil PyYAML \
cachetools diskcache \
pybreaker passlib itsdangerous \
sse-starlette slowapi \
markdown2 \
pytest pytest-cov
- name: Run main test suite (with coverage)
run: pytest tests/ --cov --cov-report=term --cov-report=xml -q
- name: Run sub-package test suites
run: |
pytest tickbridge/tests/test_smoke.py tickbridge/tests/test_cache.py -q
pytest querybus/tests/ -q
pytest pulsefan/tests/ -q
- name: Upload coverage as artifact
if: matrix.python-version == '3.11'
uses: actions/upload-artifact@v4
with:
name: coverage-xml
path: coverage.xml
retention-days: 14
lint:
name: Lint (ruff)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Install ruff
run: pip install ruff
# We don't fail CI on the existing 3000+ legacy violations; the
# ratchet check below ensures regressions can't sneak in.
# Adjust this number downward as we clean up legacy code.
- name: Lint (warn-only, with regression ratchet)
run: |
set -e
MAX_ERRORS=3050
ACTUAL=$(ruff check . 2>&1 | grep -c '^[^[:space:]].*\.py:' || true)
echo "ruff violations: ${ACTUAL} (ratchet ceiling: ${MAX_ERRORS})"
if [ "${ACTUAL}" -gt "${MAX_ERRORS}" ]; then
echo "::error::ruff violations regressed: ${ACTUAL} > ${MAX_ERRORS}"
ruff check . | tail -50
exit 1
fi
- name: Format check (no changes required, just report)
run: ruff format --check . || true
file-size:
name: File size ratchet
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
# Hard ceiling: 1500 lines (any file fails CI).
# Soft ceiling: 800 lines (new files fail; existing tracked in
# scripts/large_files.txt and must monotonically shrink).
- name: Check file sizes
run: python scripts/check_file_size.py