-
Notifications
You must be signed in to change notification settings - Fork 0
166 lines (128 loc) · 4.55 KB
/
Copy pathci.yml
File metadata and controls
166 lines (128 loc) · 4.55 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
# Cancel superseded runs on the same ref to keep the queue short.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
POETRY_VERSION: "2.2.1"
PYTHONHASHSEED: "0"
jobs:
quality:
name: Lint, format and types
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
# numpy ships PEP 695 stubs, so mypy needs 3.12+ semantics.
python-version: "3.12"
- name: Install Poetry
run: pipx install poetry==${{ env.POETRY_VERSION }}
- name: Install dependencies
run: poetry install --with dev --no-interaction
- name: Verify the lock file matches pyproject.toml
run: poetry check --lock
- name: Ruff lint
run: poetry run ruff check --output-format=github .
- name: Ruff format
run: poetry run ruff format --check --diff .
- name: Mypy (strict)
run: poetry run mypy
test:
name: Tests (${{ matrix.os }}, Python ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: pipx install poetry==${{ env.POETRY_VERSION }}
- name: Install dependencies
run: poetry install --with dev --no-interaction
- name: Run tests with coverage
run: poetry run pytest --cov=setqca --cov-report=term-missing --cov-report=xml
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml
fail_ci_if_error: false
examples:
name: Examples and benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install Poetry
run: pipx install poetry==${{ env.POETRY_VERSION }}
- name: Install dependencies
run: poetry install --no-interaction
- name: Run the documented example end to end
run: poetry run python examples/basic_fsqca.py
- name: Run the minimisation benchmark
run: poetry run python benchmarks/benchmark_qmc.py
build:
name: Build and verify distributions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install Poetry
run: pipx install poetry==${{ env.POETRY_VERSION }}
- name: Build sdist and wheel
run: poetry build
- name: Check distribution metadata
run: |
python -m pip install --upgrade twine
python -m twine check --strict dist/*
- name: Verify the wheel installs and imports cleanly
run: |
python -m venv /tmp/smoke
/tmp/smoke/bin/python -m pip install --quiet dist/*.whl
/tmp/smoke/bin/python - <<'PY'
import pandas as pd
import setqca
from setqca import CSQCA
assert setqca.__version__
data = pd.DataFrame({"A": [1, 1, 0], "B": [1, 0, 0], "Y": [1, 1, 0]})
result = CSQCA().fit(data, outcome="Y", conditions=["A", "B"])
assert result.parsimonious[0].expression(result.conditions) == "A"
print("smoke test passed for setqca", setqca.__version__)
PY
- name: Confirm the wheel ships the typing marker
run: python -c "import zipfile,glob,sys; w=glob.glob('dist/*.whl')[0]; names=zipfile.ZipFile(w).namelist(); sys.exit(0 if 'setqca/py.typed' in names else 'py.typed missing from wheel')"
- uses: actions/upload-artifact@v7
with:
name: distributions
path: dist/
docs:
name: Build documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install Poetry
run: pipx install poetry==${{ env.POETRY_VERSION }}
- name: Install dependencies
run: poetry install --with docs --no-interaction
- name: Build the site in strict mode
run: poetry run mkdocs build --strict