Remove setup_win.py and fix supported Pythons (#1375) #249
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Windows Executable | |
on: | |
push: | |
pull_request: | |
release: | |
types: | |
- created | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-latest] | |
# remove x86 builds for now as there are no snapshot builds of wxPython available | |
#architecture: [x64, x86] | |
architecture: [x64] | |
# add python '3.10' because wxPython 4.2 is now available (2022-08-21) | |
# supported versions: ['3.7', '3.8', '3.9','3.10'] | |
python-version: ['3.10'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# Import submodule PrintrunGTK3 | |
with: | |
submodules: recursive | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
architecture: ${{ matrix.architecture }} | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip pyinstaller setuptools wheel simplejson polygon3 cython cffi -r requirements.txt | |
# - name: Update to wxPython Version for x86 and py 3.8 | |
# # Latest development version for x86 and Python 3.6 is for now (2021-12-18) 4.1.2a1.dev5226+a843ed14 | |
# # Latest development version for x86 and Python 3.8+3.9 is for now (2022-03-17) 4.1.2a1.dev5226+a843ed14 | |
# # Remove Python 3.6 | |
# if: ${{ matrix.architecture == 'x86' && matrix.python-version == '3.8' }} | |
# run: | | |
# python -m pip install -U --pre -f https://wxpython.org/Phoenix/snapshot-builds/ wxPython==4.1.2a1.dev5226+a843ed14 | |
# - name: Update to wxPython Version for x86 and py 3.9 | |
# # Latest development version for x86 and Python 3.6 is for now (2021-12-18) 4.1.2a1.dev5226+a843ed14 | |
# # Latest development version for x86 and Python 3.8+3.9 is for now (2022-03-17) 4.1.2a1.dev5226+a843ed14 | |
# # Remove Python 3.6 | |
# if: ${{ matrix.architecture == 'x86' && matrix.python-version == '3.9' }} | |
# run: | | |
# python -m pip install -U --pre -f https://wxpython.org/Phoenix/snapshot-builds/ wxPython==4.1.2a1.dev5226+a843ed14 | |
# | |
# | |
- name: Update to wxPython latest Version for x64 | |
# Latest development version for x64 and Python 3.7 to 3.10, can be removed if requirements.txt is fixed | |
if: ${{ matrix.architecture == 'x64' && matrix.python-version >= '3.7' }} | |
run: | | |
# python -m pip install -U --pre -f https://wxpython.org/Phoenix/snapshot-builds/ wxPython | |
python -m pip install -U wxPython | |
- name: Build Cython ext | |
run: | | |
python setup.py build_ext --inplace | |
# Build pyinstaller spec depending on GTK3 x32/x64 binaries or w/o GTK3 bundle | |
# for running Projector. The user can install the GTK3 libraries external and | |
# set the environment path to the installation manually if the bundle is not | |
# included or found (last option) via submodules | |
- name: Make pyinstaller spec with GTK3 x64 bundle | |
if: ${{ matrix.architecture == 'x64' && hashFiles('PrintrunGTK3/GTK3Windows10-64') != '' }} | |
run: | | |
pyi-makespec --hidden-import="pkg_resources.py2_warn" -F --add-binary "PrintrunGTK3/GTK3Windows10-64/*.dll;." --add-data "VERSION;cairocffi" --add-data "VERSION;cairosvg" --add-data "images/*;images" --add-data "*.png;." --add-data "*.ico;." -w -i pronterface.ico pronterface.py | |
- name: Make pyinstaller spec with GTK3 x32 bundle | |
if: ${{ matrix.architecture == 'x86' && hashFiles('PrintrunGTK3/GTK3Windows10-32') != '' }} | |
run: | | |
pyi-makespec --hidden-import="pkg_resources.py2_warn" -F --add-binary "PrintrunGTK3/GTK3Windows10-32/*.dll;." --add-data "VERSION;cairocffi" --add-data "VERSION;cairosvg" --add-data "images/*;images" --add-data "*.png;." --add-data "*.ico;." -w -i pronterface.ico pronterface.py | |
- name: Make pyinstaller spec without GTK3 bundle | |
if: ${{ hashFiles('PrintrunGTK3') == '' }} | |
run: | | |
pyi-makespec --hidden-import="pkg_resources.py2_warn" -F --add-data "VERSION;cairocffi" --add-data "VERSION;cairosvg" --add-data "images/*;images" --add-data "*.png;." --add-data "*.ico;." -w -i pronterface.ico pronterface.py | |
- name: Make pyinstaller build | |
run: | | |
pyinstaller --clean pronterface.spec -y | |
- name: Configuration for releases | |
if: ${{ github.event_name == 'release' }} | |
run: | | |
"EXE_NAME=${{ github.ref_name }}" >> $env:GITHUB_ENV | |
- name: Configuration for pushes | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
"EXE_NAME=printrun-nightly" >> $env:GITHUB_ENV | |
- name: Configuration for pull requests | |
if: ${{ github.event_name != 'release' && github.event_name != 'push' }} | |
run: | | |
"EXE_NAME=printrun-test" >> $env:GITHUB_ENV | |
- name: Upload artifacts for inspection | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.EXE_NAME }}_windows_${{ matrix.architecture }}_py${{ matrix.python-version }} | |
path: dist/pronterface.exe |