Repository navigation
82 lines (71 loc) · 2.8 KB
/
Copy pathpython-test.yml
File metadata and controls
82 lines (71 loc) · 2.8 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
name: Python package
on:
push:
branches: [ "main" ]
# Every pull request, not just those into main. A stacked PR targets its parent
# branch rather than main, so a branch filter here leaves each step of a stack
# unchecked until it is retargeted, which is exactly when a regression is hardest
# to attribute.
pull_request:
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Test against peer repos' range: cotdata 3.10–3.13, crucible 3.9–3.12
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: Check out cot-analyzer
uses: actions/checkout@v4
with:
path: cot-analyzer
- name: Check out cotdata (public sibling — resolves `-e ../cotdata` in requirements.txt)
uses: actions/checkout@v4
with:
repository: mspinola/cotdata
path: cotdata
- name: Check out marketdata (daily bars — resolves `-e ../marketdata`)
# ADR-0007 moved bars out of cotdata, and marketdata is not on PyPI, so this
# sibling checkout is the only thing that resolves the dependency cotmetrics
# now imports.
uses: actions/checkout@v4
with:
repository: mspinola/marketdata
path: marketdata
- name: Check out cotmetrics (metrics/data layer — resolves `-e ../cotmetrics`)
uses: actions/checkout@v4
with:
repository: mspinola/cotmetrics
path: cotmetrics
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
working-directory: cot-analyzer
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Verify internal dependency floors
# cotdata / marketdata / cotmetrics are installed editable from ../ at whatever HEAD was
# checked out, so pip never enforces the version floors in pyproject.toml.
# This asserts the installed siblings actually satisfy those declared floors.
working-directory: cot-analyzer
run: python scripts/check_dep_floors.py
- name: Run linting
working-directory: cot-analyzer
run: python -m ruff check src tests
- name: Run tests
working-directory: cot-analyzer
env:
PYTHONPATH: src
# Dummy stores so each package's store guard doesn't error at import.
# Two of them since ADR-0007: positioning and bars are separate roots, and
# neither package defaults a missing root to somewhere plausible.
COTDATA_STORE: /tmp/cotdata_store
MARKETDATA_STORE: /tmp/marketdata_store
COTMETRICS_CACHE: /tmp/cotmetrics_cache
run: |
mkdir -p /tmp/cotdata_store /tmp/marketdata_store /tmp/cotmetrics_cache
pytest tests/