Repository navigation
116 lines (111 loc) · 4.8 KB
/
Copy pathci.yml
File metadata and controls
116 lines (111 loc) · 4.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
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
name: CI
# Validates both supported runtimes:
# * pure-Python (no GSL, no compiled engine) — the headline "engine-free" path;
# * with the optional CFFI C engine compiled against GSL.
# Tests that compare against the C *binary* / *engine* or load the sibling repo's
# IPC3 data skip themselves when those are absent (see needs_c / needs_engine /
# needs_ipc3 guards), so both jobs are green on a standalone checkout.
on:
push:
branches: [master, main]
pull_request:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
pure-python:
name: pure-Python (no engine)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# No libgsl-dev on purpose: the optional C extension fails to build and
# the install degrades to pure-Python (setup.py marks it optional).
- name: Install (pure-Python)
run: |
python -m pip install --upgrade pip
pip install -e ".[test,plots,forecast-report]" "art-tseries>=0.1.3"
# TEMPORARY, until fue 0.1.23 is on PyPI: the ladder needs fue's cast
# without its MA flip (cast_us_py(flip=False), BUG-0030; fue-python #14,
# merged). The published wheel is kept -- it carries fue's compiled
# engine -- and only that one pure-Python module is taken from fue's
# master. Remove this step, and raise the requirement in pyproject.toml
# to fue>=0.1.23, when fue is released (RELEASING.md).
- name: fue's cast from master (until fue 0.1.23 is published)
shell: bash
run: |
python - <<'PY'
import inspect, os, urllib.request
import fue.cast_us as c
if "flip" not in inspect.signature(c.cast_us_py).parameters:
url = "https://raw.githubusercontent.com/davidesg/fue-python/master/src/fue/cast_us.py"
src = urllib.request.urlopen(url, timeout=60).read()
assert b"flip=True" in src
open(c.__file__, "wb").write(src)
print("fue.cast_us replaced from master:", c.__file__)
else:
print("the installed fue already has flip:", c.__file__)
PY
- name: Assert the C engine is NOT present
run: |
python - <<'PY'
try:
import drvarma._drvarma_engine # noqa: F401
raise SystemExit("C engine unexpectedly built in the pure-Python job")
except ImportError:
print("OK: pure-Python (no _drvarma_engine)")
PY
- name: Run tests
run: pytest -q
with-engine:
name: with C engine (GSL)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install GSL development headers
run: |
sudo apt-get update
sudo apt-get install -y libgsl-dev
- name: Install with the C engine
run: |
# setuptools is needed at runtime for the direct `setup.py build_ext`
# below (modern venvs / isolated pip builds don't provide it).
python -m pip install --upgrade pip setuptools
pip install -e ".[test,c-engine,plots,forecast-report]" "art-tseries>=0.1.3"
# Build the extension straight into src/drvarma/ (see docs/STATUS.md).
python setup.py build_ext --inplace
# TEMPORARY, until fue 0.1.23 is on PyPI: the ladder needs fue's cast
# without its MA flip (cast_us_py(flip=False), BUG-0030; fue-python #14,
# merged). The published wheel is kept -- it carries fue's compiled
# engine -- and only that one pure-Python module is taken from fue's
# master. Remove this step, and raise the requirement in pyproject.toml
# to fue>=0.1.23, when fue is released (RELEASING.md).
- name: fue's cast from master (until fue 0.1.23 is published)
shell: bash
run: |
python - <<'PY'
import inspect, os, urllib.request
import fue.cast_us as c
if "flip" not in inspect.signature(c.cast_us_py).parameters:
url = "https://raw.githubusercontent.com/davidesg/fue-python/master/src/fue/cast_us.py"
src = urllib.request.urlopen(url, timeout=60).read()
assert b"flip=True" in src
open(c.__file__, "wb").write(src)
print("fue.cast_us replaced from master:", c.__file__)
else:
print("the installed fue already has flip:", c.__file__)
PY
- name: Assert the C engine imports
run: |
python -c "import drvarma._drvarma_engine; print('C engine built OK')"
- name: Run tests
run: pytest -q