Skip to content

Commit

Permalink
feat: add pyinstaller action
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamin-awd committed Jun 17, 2024
1 parent 9a6ba5b commit 56ff7e9
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 1 deletion.
81 changes: 81 additions & 0 deletions .github/workflows/build_app_pyinstaller.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Build App with Pyinstaller

on:
pull_request:
# inputs:
# platform:
# description: 'platform'
# required: true
# default: 'macos-latest'
# type: choice
# options:
# - 'windows-latest'
# - 'macos-latest'
# - 'ubuntu-latest'

jobs:
build:
env:
platform: ubuntu-latest
name: ubuntu-latest # ${{ env.platform }}
runs-on: ubuntu-latest # ${{ env.platform }}
strategy:
fail-fast: false

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Conda (windows)
if: env.platform == 'windows-latest'
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: ''

- name: Install Monopoly dependencies (windows)
if: env.platform == 'windows-latest'
run: |
conda install -c conda-forge poppler
pip install -r requirements.txt
- name: Install Monopoly dependencies (ubuntu/mac)
if: env.platform == 'macos-latest' || env.platform == 'ubuntu-latest'
uses: daaku/gh-action-apt-install@v4
with:
packages: build-essential libpoppler-cpp-dev pkg-config

- name: Install Rust for ubuntu-latest
if: env.platform == 'ubuntu-latest'
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: x86_64-unknown-linux-musl

- name: Install Rust for windows-latest
if: env.platform == 'windows-latest'
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable-x86_64-msvc
target: x86_64-pc-windows-msvc

- name: Install Rust for macos-latest
if: env.platform == 'macos-latest'
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: x86_64-apple-darwin

- name: Get host type
run: |
host=$(rustc -Vv | grep host)
echo "HOST=$(echo $host | cut -f2 -d' ')" >> $GITHUB_ENV
- name: Create executable
uses: sayyid5416/pyinstaller@v1
with:
python_ver: '3.11'
pyinstaller_ver: '==6.8.0'
spec: entrypoint.spec
requirements: requirements.txt
options: --onefile, --name "monopoly"
upload_exe_with_name: 'monopoly-${{ env.HOST }}'
4 changes: 3 additions & 1 deletion hooks/hook-monopoly_streamlit.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# pylint: disable=invalid-name
import site

from PyInstaller.utils.hooks import collect_submodules

site_packages_dir = site.getsitepackages()[0]
datas = [(f"{site_packages_dir}/monopoly_streamlit", "./monopoly_streamlit")]
datas = [("./monopoly_streamlit", "./monopoly_streamlit")]
hiddenimports = collect_submodules("monopoly_streamlit")
2 changes: 2 additions & 0 deletions hooks/hook-streamlit_extras.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# pylint: disable=invalid-name

from PyInstaller.utils.hooks import collect_submodules

hiddenimports = collect_submodules("streamlit_extras")

0 comments on commit 56ff7e9

Please sign in to comment.