Skip to content

Commit

Permalink
Build Pyinstaller EXE from GitHub Actions (#109)
Browse files Browse the repository at this point in the history
* Use an older version of PyInstaller for now

* Build Pyinstaller EXE from GitHub Actions

* Poetry should be in path

* Make sure Poetry is installed to PATH

* Python on Windows is awful

* Sanity check the EXE before releasing

* Revert "Use an older version of PyInstaller for now"

This reverts commit 7a068f8.

* Try not excluding bootlocale

* Try a venv

* Revert "Try a venv"

This reverts commit 1619e04.

* Troubleshooting

<https://stackoverflow.com/questions/64468438/pyinstaller-executable-fails-with-pkg-resources-distributionnotfound-error>

* Add missing argument
  • Loading branch information
thebeanogamer authored May 20, 2023
1 parent 5efefac commit 2e77e96
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 6 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
name: Build Releases
on: push

jobs:
windows:
runs-on: windows-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.11'

- name: Cache Python modules
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
path: ~/.pip
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.5.0
virtualenvs-create: false
installer-parallel: true

- name: Install Python Dependencies
run: C:\Users\runneradmin\.local\bin\poetry install --no-interaction --no-ansi
env:
PIP_CACHE_DIR: ~/.pip

- name: Build Executable
run: C:\Users\runneradmin\.local\bin\poetry run pyinstaller --onefile --additional-hooks-dir hooks hstsparser.py

- name: Print Helptext to Validate Executable
run: dist\hstsparser.exe -h

- name: Upload Executable
uses: actions/upload-artifact@v3
with:
name: hstsparser.exe
path: dist/hstsparser.exe
13 changes: 7 additions & 6 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ jobs:
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Poetry
run: curl -sSL https://install.python-poetry.org | python3 -

- name: Disable Virtualenvs
run: $HOME/.local/bin/poetry config virtualenvs.create false
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.5.0
virtualenvs-create: false
installer-parallel: true

- name: Install Python Dependencies
run: $HOME/.local/bin/poetry install --no-interaction --no-ansi
run: poetry install --no-interaction --no-ansi
env:
PIP_CACHE_DIR: ~/.pip

Expand Down
3 changes: 3 additions & 0 deletions hooks/hook-prettytable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from PyInstaller.utils.hooks import collect_all

datas, binaries, hiddenimports = collect_all('prettytable')

0 comments on commit 2e77e96

Please sign in to comment.