Skip to content

Commit 4bd17d2

Browse files
committed
Building stubs for Windows, Linux and MacOS
1 parent d3f0678 commit 4bd17d2

File tree

3 files changed

+164
-2
lines changed

3 files changed

+164
-2
lines changed

.github/workflows/pypi.yml

+162-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,125 @@ on:
77
workflow_dispatch:
88

99
jobs:
10+
build_stubs_windows:
11+
name: Build FMX Stubs for Windows
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
python: ['3.11']
16+
include:
17+
- os: [windows-latest]
18+
arch: ["AMD64"]
19+
20+
steps:
21+
- name: Check out repository
22+
uses: actions/checkout@v3
23+
24+
- name: Build and Install FMX
25+
run: |
26+
python -m pip install setuptools --upgrade
27+
python -m pip install wheel --upgrade
28+
python setup.py install
29+
30+
- name: Install mypy
31+
run: |
32+
python -m pip install git+https://github.com/lmbelo/mypy.git
33+
34+
- name: Build Stubs
35+
run: |
36+
python -m mypy.stubgen -m delphifmx -o .\delphifmx --include-docstrings
37+
ren .\delphifmx\delphifmx.pyi __init__.pyi
38+
39+
- name: Cache Stubs
40+
id: cache-stubs
41+
uses: actions/cache@v3
42+
with:
43+
path: .\delphifmx\__init__.pyi
44+
key: ${{ runner.os }}-stubs
45+
46+
build_stubs_linux:
47+
name: Build FMX Stubs for Linux
48+
runs-on: ${{ matrix.os }}
49+
strategy:
50+
matrix:
51+
python: ['3.11']
52+
include:
53+
- os: [ubuntu-latest]
54+
arch: ["x86_64"]
55+
56+
steps:
57+
- name: Check out repository
58+
uses: actions/checkout@v3
59+
60+
- name: Set up Python ${{ matrix.python }}
61+
uses: actions/setup-python@v3
62+
with:
63+
python-version: ${{ matrix.python }}
64+
65+
- name: Build and Install FMX
66+
run: |
67+
python -m pip install setuptools --upgrade
68+
python -m pip install wheel --upgrade
69+
python setup.py install
70+
71+
- name: Install mypy
72+
run: |
73+
python -m pip install git+https://github.com/lmbelo/mypy.git
74+
75+
- name: Build Stubs
76+
run: |
77+
python -m mypy.stubgen -m delphifmx -o ./delphifmx --include-docstrings
78+
mv ./delphifmx/delphifmx.pyi ./delphifmx/__init__.pyi
79+
80+
- name: Cache Stubs
81+
id: cache-stubs
82+
uses: actions/cache@v3
83+
with:
84+
path: ./delphifmx/__init__.pyi
85+
key: ${{ runner.os }}-stubs
86+
87+
build_stubs_macos:
88+
name: Build FMX Stubs MacOS
89+
runs-on: ${{ matrix.os }}
90+
strategy:
91+
matrix:
92+
python: ['3.11']
93+
include:
94+
- os: [ubuntu-latest]
95+
arch: ["x86_64"]
96+
97+
steps:
98+
- name: Check out repository
99+
uses: actions/checkout@v3
100+
101+
- name: Set up Python ${{ matrix.python }}
102+
uses: actions/setup-python@v3
103+
with:
104+
python-version: ${{ matrix.python }}
105+
106+
- name: Build and Install FMX
107+
run: |
108+
python -m pip install setuptools --upgrade
109+
python -m pip install wheel --upgrade
110+
python setup.py install
111+
112+
- name: Install mypy
113+
run: |
114+
python -m pip install git+https://github.com/lmbelo/mypy.git
115+
116+
- name: Build Stubs
117+
run: |
118+
python -m mypy.stubgen -m delphifmx -o ./delphifmx --include-docstrings
119+
mv delphifmx/delphifmx.pyi delphifmx/__init__.pyi
120+
121+
- name: Cache Stubs
122+
id: cache-stubs
123+
uses: actions/cache@v3
124+
with:
125+
path: ./delphifmx/__init__.pyi
126+
key: Macos-stubs
127+
enableCrossOsArchive: true
128+
10129
#This build makes delphifmx available for Android
11130
build_universal_wheel:
12131
name: Build universal wheel
@@ -42,6 +161,7 @@ jobs:
42161

43162
build_wheels_win_32:
44163
name: Build Windows x86 wheels for Python ${{ matrix.python }}
164+
needs: [build_stubs_windows]
45165
runs-on: ${{ matrix.os }}
46166
strategy:
47167
matrix:
@@ -54,7 +174,14 @@ jobs:
54174
uses: actions/checkout@v3
55175
with:
56176
fetch-depth: 0
57-
177+
178+
- name: Restore Cached Stubs
179+
id: cache-stubs
180+
uses: actions/cache@v3
181+
with:
182+
path: .\delphifmx\__init__.pyi
183+
key: ${{ runner.os }}-stubs
184+
58185
- name: Set up Python ${{ matrix.python }}
59186
uses: actions/setup-python@v3
60187
with:
@@ -75,6 +202,7 @@ jobs:
75202

76203
build_wheels_win_64:
77204
name: Build Windows x64 wheels for Python ${{ matrix.python }}
205+
needs: [build_stubs_windows]
78206
runs-on: ${{ matrix.os }}
79207
strategy:
80208
matrix:
@@ -87,6 +215,13 @@ jobs:
87215
uses: actions/checkout@v3
88216
with:
89217
fetch-depth: 0
218+
219+
- name: Restore Cached Stubs
220+
id: cache-stubs
221+
uses: actions/cache@v3
222+
with:
223+
path: .\delphifmx\__init__.pyi
224+
key: ${{ runner.os }}-stubs
90225

91226
- name: Set up Python ${{ matrix.python }}
92227
uses: actions/setup-python@v3
@@ -108,6 +243,7 @@ jobs:
108243

109244
build_wheels_manylinux:
110245
name: Build ManyLinux x86_64 wheels for Python ${{ matrix.python }}
246+
needs: [build_stubs_linux]
111247
runs-on: ${{ matrix.os }}
112248
strategy:
113249
matrix:
@@ -120,6 +256,13 @@ jobs:
120256
uses: actions/checkout@v3
121257
with:
122258
fetch-depth: 0
259+
260+
- name: Restore Cached Stubs
261+
id: cache-stubs
262+
uses: actions/cache@v3
263+
with:
264+
path: ./delphifmx/__init__.pyi
265+
key: ${{ runner.os }}-stubs
123266

124267
- name: Set up Python ${{ matrix.python }}
125268
uses: actions/setup-python@v3
@@ -140,6 +283,7 @@ jobs:
140283

141284
build_wheels_macos:
142285
name: Build x86_64 macOS wheels for Python ${{ matrix.python }}
286+
needs: [build_stubs_macos]
143287
runs-on: ${{ matrix.os }}
144288
strategy:
145289
matrix:
@@ -152,6 +296,14 @@ jobs:
152296
uses: actions/checkout@v3
153297
with:
154298
fetch-depth: 0
299+
300+
- name: Restore Cached Stubs
301+
id: cache-stubs
302+
uses: actions/cache@v3
303+
with:
304+
path: ./delphifmx/__init__.pyi
305+
key: Macos-stubs
306+
enableCrossOsArchive: true
155307

156308
- name: Set up Python ${{ matrix.python }}
157309
uses: actions/setup-python@v3
@@ -172,6 +324,7 @@ jobs:
172324

173325
build_wheels_macos_arm:
174326
name: Build arm64 macOS wheels for Python ${{ matrix.python }}
327+
needs: [build_stubs_macos]
175328
runs-on: ${{ matrix.os }}
176329
strategy:
177330
matrix:
@@ -185,6 +338,14 @@ jobs:
185338
with:
186339
fetch-depth: 0
187340

341+
- name: Restore Cached Stubs
342+
id: cache-stubs
343+
uses: actions/cache@v3
344+
with:
345+
path: ./delphifmx/__init__.pyi
346+
key: Macos-stubs
347+
enableCrossOsArchive: true
348+
188349
- name: Set up Python ${{ matrix.python }}
189350
uses: actions/setup-python@v3
190351
with:

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
recursive-include delphifmx *.pyd
22
recursive-include delphifmx *.so
33
recursive-include delphifmx *.dylib
4+
recursive-include delphifmx *.pyi
45
recursive-include delphifmx docs.xml

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ cmdclass =
5858
bdist_wheel = build.BDistWheel
5959

6060
[options.package_data]
61-
* = *.pyd, *.so, *.dylib, *.xml
61+
* = *.pyd, *.so, *.dylib, *.pyi, *.xml

0 commit comments

Comments
 (0)