From 96060cb37eaf6af90d9394f99e958515fe3cfd46 Mon Sep 17 00:00:00 2001 From: "Amir Y. Perehodnik" Date: Wed, 14 Aug 2024 22:03:37 +0300 Subject: [PATCH 1/2] Add pyinstaller building workflows --- .github/workflows/build-linux.yml | 45 +++++++++++++++++++++++++++++ .github/workflows/build-windows.yml | 45 +++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 .github/workflows/build-linux.yml create mode 100644 .github/workflows/build-windows.yml diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml new file mode 100644 index 0000000..322df21 --- /dev/null +++ b/.github/workflows/build-linux.yml @@ -0,0 +1,45 @@ +name: Build and Release for Linux + +on: + release: + types: [created] # Triggers only when a release is created + +jobs: + build-and-release: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Create Executable + uses: Martin005/pyinstaller-action@v1.2.0 + with: + python_ver: '3.10' + spec: 'pyinst-compile.spec' + requirements: 'requirements.txt' + upload_exe_with_name: 'arnis' + options: '--onefile --name arnis' + + - name: Build + run: make build + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./dist/arnis + asset_name: arnis + asset_content_type: application/octet-stream diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml new file mode 100644 index 0000000..55b0231 --- /dev/null +++ b/.github/workflows/build-windows.yml @@ -0,0 +1,45 @@ +name: Build and Release for Windows + +on: + release: + types: [created] # Triggers only when a release is created + +jobs: + build-and-release: + runs-on: windows-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Create Executable + uses: Martin005/pyinstaller-action@v1.2.0 + with: + python_ver: '3.10' + spec: 'pyinst-compile.spec' + requirements: 'requirements.txt' + upload_exe_with_name: 'arnis.exe' + options: '--onefile --name arnis' + + - name: Build + run: make build + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./dist/arnis.exe + asset_name: arnis.exe + asset_content_type: application/octet-stream From 70f229fb581abf78a4384435af404ea12947a4b1 Mon Sep 17 00:00:00 2001 From: "Amir Y. Perehodnik" Date: Wed, 14 Aug 2024 22:03:54 +0300 Subject: [PATCH 2/2] add pyinstaller spec file --- pyinst-compile.spec | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 pyinst-compile.spec diff --git a/pyinst-compile.spec b/pyinst-compile.spec new file mode 100644 index 0000000..284f61c --- /dev/null +++ b/pyinst-compile.spec @@ -0,0 +1,34 @@ +# -*- mode: python ; coding: utf-8 -*- +import os +import site + +# Locate the site-packages directory +site_packages_path = next(p for p in site.getsitepackages() if 'site-packages' in p) + +# Path to the legacy_blocks.json file +legacy_blocks_path = os.path.join(site_packages_path, 'anvil', 'legacy_blocks.json') + +block_cipher = None + +a = Analysis(['arnis.py'], + pathex=['.'], + binaries=[], + datas=[(legacy_blocks_path, 'anvil')], + hiddenimports=[], + hookspath=[], + runtime_hooks=[], + excludes=[], + cipher=block_cipher, + noarchive=False) +pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) +exe = EXE(pyz, + a.scripts, + a.binaries, + a.zipfiles, + a.datas, + name='arnis', + debug=False, + strip=False, + upx=True, + runtime_tmpdir=None, + console=True )