Skip to content

Commit

Permalink
Building stubs for Windows, Linux and MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
lmbelo committed Sep 28, 2023
1 parent d3f0678 commit 4bd17d2
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 2 deletions.
163 changes: 162 additions & 1 deletion .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,125 @@ on:
workflow_dispatch:

jobs:
build_stubs_windows:
name: Build FMX Stubs for Windows
runs-on: ${{ matrix.os }}
strategy:
matrix:
python: ['3.11']
include:
- os: [windows-latest]
arch: ["AMD64"]

steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Build and Install FMX
run: |
python -m pip install setuptools --upgrade
python -m pip install wheel --upgrade
python setup.py install
- name: Install mypy
run: |
python -m pip install git+https://github.com/lmbelo/mypy.git
- name: Build Stubs
run: |
python -m mypy.stubgen -m delphifmx -o .\delphifmx --include-docstrings
ren .\delphifmx\delphifmx.pyi __init__.pyi
- name: Cache Stubs
id: cache-stubs
uses: actions/cache@v3
with:
path: .\delphifmx\__init__.pyi
key: ${{ runner.os }}-stubs

build_stubs_linux:
name: Build FMX Stubs for Linux
runs-on: ${{ matrix.os }}
strategy:
matrix:
python: ['3.11']
include:
- os: [ubuntu-latest]
arch: ["x86_64"]

steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python }}

- name: Build and Install FMX
run: |
python -m pip install setuptools --upgrade
python -m pip install wheel --upgrade
python setup.py install
- name: Install mypy
run: |
python -m pip install git+https://github.com/lmbelo/mypy.git
- name: Build Stubs
run: |
python -m mypy.stubgen -m delphifmx -o ./delphifmx --include-docstrings
mv ./delphifmx/delphifmx.pyi ./delphifmx/__init__.pyi
- name: Cache Stubs
id: cache-stubs
uses: actions/cache@v3
with:
path: ./delphifmx/__init__.pyi
key: ${{ runner.os }}-stubs

build_stubs_macos:
name: Build FMX Stubs MacOS
runs-on: ${{ matrix.os }}
strategy:
matrix:
python: ['3.11']
include:
- os: [ubuntu-latest]
arch: ["x86_64"]

steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python }}

- name: Build and Install FMX
run: |
python -m pip install setuptools --upgrade
python -m pip install wheel --upgrade
python setup.py install
- name: Install mypy
run: |
python -m pip install git+https://github.com/lmbelo/mypy.git
- name: Build Stubs
run: |
python -m mypy.stubgen -m delphifmx -o ./delphifmx --include-docstrings
mv delphifmx/delphifmx.pyi delphifmx/__init__.pyi
- name: Cache Stubs
id: cache-stubs
uses: actions/cache@v3
with:
path: ./delphifmx/__init__.pyi
key: Macos-stubs
enableCrossOsArchive: true

#This build makes delphifmx available for Android
build_universal_wheel:
name: Build universal wheel
Expand Down Expand Up @@ -42,6 +161,7 @@ jobs:

build_wheels_win_32:
name: Build Windows x86 wheels for Python ${{ matrix.python }}
needs: [build_stubs_windows]
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -54,7 +174,14 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0


- name: Restore Cached Stubs
id: cache-stubs
uses: actions/cache@v3
with:
path: .\delphifmx\__init__.pyi
key: ${{ runner.os }}-stubs

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v3
with:
Expand All @@ -75,6 +202,7 @@ jobs:

build_wheels_win_64:
name: Build Windows x64 wheels for Python ${{ matrix.python }}
needs: [build_stubs_windows]
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -87,6 +215,13 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Restore Cached Stubs
id: cache-stubs
uses: actions/cache@v3
with:
path: .\delphifmx\__init__.pyi
key: ${{ runner.os }}-stubs

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

build_wheels_manylinux:
name: Build ManyLinux x86_64 wheels for Python ${{ matrix.python }}
needs: [build_stubs_linux]
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -120,6 +256,13 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Restore Cached Stubs
id: cache-stubs
uses: actions/cache@v3
with:
path: ./delphifmx/__init__.pyi
key: ${{ runner.os }}-stubs

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

build_wheels_macos:
name: Build x86_64 macOS wheels for Python ${{ matrix.python }}
needs: [build_stubs_macos]
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -152,6 +296,14 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Restore Cached Stubs
id: cache-stubs
uses: actions/cache@v3
with:
path: ./delphifmx/__init__.pyi
key: Macos-stubs
enableCrossOsArchive: true

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

build_wheels_macos_arm:
name: Build arm64 macOS wheels for Python ${{ matrix.python }}
needs: [build_stubs_macos]
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -185,6 +338,14 @@ jobs:
with:
fetch-depth: 0

- name: Restore Cached Stubs
id: cache-stubs
uses: actions/cache@v3
with:
path: ./delphifmx/__init__.pyi
key: Macos-stubs
enableCrossOsArchive: true

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v3
with:
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
recursive-include delphifmx *.pyd
recursive-include delphifmx *.so
recursive-include delphifmx *.dylib
recursive-include delphifmx *.pyi
recursive-include delphifmx docs.xml
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ cmdclass =
bdist_wheel = build.BDistWheel

[options.package_data]
* = *.pyd, *.so, *.dylib, *.xml
* = *.pyd, *.so, *.dylib, *.pyi, *.xml

0 comments on commit 4bd17d2

Please sign in to comment.