-
Notifications
You must be signed in to change notification settings - Fork 9
143 lines (135 loc) · 4.54 KB
/
Copy pathpr_code_changes.yaml
File metadata and controls
143 lines (135 loc) · 4.54 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
# Workflow that runs on code changes to a pull request.
name: Code changes
on:
pull_request:
paths:
- src/**
- tests/**
- scripts/**
- .github/**
- changelog.d/**
- pyproject.toml
- src/policyengine/data/bundle/manifest.json
workflow_dispatch:
jobs:
check-changelog:
name: Check changelog fragment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install towncrier
run: pip install towncrier
- name: Check for changelog fragment
run: .github/check-changelog.sh
Lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install ruff
run: pip install ruff
- name: Run ruff format check
run: ruff format --check .
- name: Run ruff check
run: ruff check .
Mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.13'
- name: Install package
run: uv pip install -e .[dev] --system
- name: Run mypy (informational)
run: mypy src/policyengine || echo "mypy found errors (non-blocking until codebase is clean)"
Python-Compat:
name: Install + smoke-import (py${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
- name: Install package (no country-model extras)
# `h5py` is used transitively by policyengine.core.scoping_strategy
# but is normally supplied via the [us]/[uk] extras (through
# policyengine-core). Install it directly so the smoke import can
# exercise the wrapper without the country models, which pin
# versions that don't support 3.9/3.10 yet.
run: uv pip install --system . h5py
- name: Smoke-import core modules
run: python -c "import policyengine; from policyengine.core import Dataset, Policy, Simulation; from policyengine.outputs import aggregate, poverty, inequality; print('import OK')"
BundleVerification:
name: Verify bundle metadata
runs-on: ubuntu-latest
env:
POLICYENGINE_SKIP_COUNTRY_IMPORTS: "1"
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.13'
- name: Check derived bundle metadata
run: python scripts/bundle.py check
- name: Install bundle package scaffold
run: |
uv pip install -e ".[models]" --system
python - <<'PY'
import subprocess
import sys
from policyengine import bundle
requirements = [
requirement
for requirement in bundle.bundle_install_requirements(
countries=["us", "uk"]
)
if not requirement.startswith("policyengine==")
]
subprocess.check_call(
[sys.executable, "-m", "pip", "install", *requirements]
)
PY
- name: Check installed package consistency
run: python -m pip check
- name: Verify bundle packages
run: policyengine bundle verify --country us --country uk --packages-only --json
Test:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.13', '3.14']
steps:
- name: Checkout repo
uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install package
run: uv pip install -e .[dev] --system
- name: Install policyengine
run: uv pip install policyengine --system
- name: Run tests with coverage
run: make test
env:
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}