-
Notifications
You must be signed in to change notification settings - Fork 1
181 lines (144 loc) · 5.13 KB
/
Copy pathpython-app.yml
File metadata and controls
181 lines (144 loc) · 5.13 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: CI
on:
push:
branches: [ main ]
pull_request: # 全 PR
permissions:
contents: read # テストに read 権限のみで十分
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
env:
ELLPHI_USE_EIGEN: "1"
ELLPHI_EIGEN_INCLUDE: "/usr/include/eigen3"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install Eigen headers
run: sudo apt-get update && sudo apt-get install -y libeigen3-dev
# -- Poetry ------------------------------------------------------
- name: Install Poetry
run: pip install --upgrade poetry
- name: Cache Poetry env
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('pyproject.toml') }}-v2
- name: Install project (dev extras)
run: poetry install --with dev # Install core and development dependencies
# -- Lint / Format ----------------------------------------------
- name: flake8
run: poetry run flake8 src tests scripts
- name: black check
run: poetry run black --check src tests scripts
# -- Tests ------------------------------------------------------
- name: pytest with coverage
run: poetry run pytest --cov=src/ellphi --cov-report=xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
# 3.11 限定で mypy
typecheck:
runs-on: ubuntu-latest
env:
ELLPHI_USE_EIGEN: "1"
ELLPHI_EIGEN_INCLUDE: "/usr/include/eigen3"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
- name: Install Eigen headers
run: sudo apt-get update && sudo apt-get install -y libeigen3-dev
- name: Install Poetry
run: pip install --upgrade poetry
- name: Cache Poetry env
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('pyproject.toml') }}-v2
- name: Install project (dev extras)
run: poetry install --with dev # Install core and development dependencies
- name: mypy
run: poetry run mypy src
- name: stubtest
run: MYPYPATH=src poetry run stubtest ellphi --allowlist stubtest-allowlist.txt
package-test:
runs-on: ubuntu-latest
env:
ELLPHI_USE_EIGEN: "1"
ELLPHI_EIGEN_INCLUDE: "/usr/include/eigen3"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
- name: Install Eigen headers
run: sudo apt-get update && sudo apt-get install -y libeigen3-dev
- name: Install Poetry
run: pip install --upgrade poetry
- name: Build package
run: poetry build
- name: Check sdist content
run: |
# Ensure sdist contains C++ source but NO binaries
tar -tf dist/*.tar.gz > sdist_content.txt
if ! grep -q "src/ellphi/_tangency_cpp_impl.cpp" sdist_content.txt; then
echo "Error: C++ source missing from sdist"
exit 1
fi
if grep -q -E "\.(so|dylib|dll|pyd)$" sdist_content.txt; then
echo "Error: Binary files found in sdist"
cat sdist_content.txt | grep -E "\.(so|dylib|dll|pyd)$"
exit 1
fi
echo "sdist content check passed."
- name: Install wheel and test
run: |
# Create a fresh venv to test installation
python -m venv test-env
source test-env/bin/activate
# Install the built wheel
pip install dist/*.whl
# Install test dependencies (pytest)
# Note: runtime dependencies (numpy, etc.) are installed by pip automatically from the wheel metadata
pip install pytest
# Run tests against the installed package
# We assume tests are in 'tests/' and we want to avoid importing from local 'src/'
# So we move to a different directory or explicitely tell pytest where to look
mkdir -p test_run
cd test_run
pytest ../tests
demo-install:
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 Poetry
run: pip install --upgrade poetry
- name: Cache Poetry env
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('pyproject.toml') }}-v2
- name: Install project (demo extras)
run: poetry install --with demo # Ensure the demo dependency set resolves