From 26e04767f5beea7ae51dcd2ce835e5f12bcc4f53 Mon Sep 17 00:00:00 2001 From: Rebecca Breu Date: Tue, 6 Jul 2021 19:50:10 +0200 Subject: [PATCH] Add build workflow --- .github/workflows/build.yml | 31 ++++++++++++++++++++++++ build.py | 48 +++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 build.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..66aa1ea --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,31 @@ +name: build Linux + +on: workflow_dispatch + +jobs: + + build: + name: build + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pyinstaller + pip install -e . + - name: Run build.py + run: | + python build.py + - uses: actions/upload-artifact@v2 + - name: Upload artifact + with: + name: build + path: dist/*.zip + retention-days: 5 \ No newline at end of file diff --git a/build.py b/build.py new file mode 100644 index 0000000..0737952 --- /dev/null +++ b/build.py @@ -0,0 +1,48 @@ +"""Build release files.""" + + +from distutils.sysconfig import get_python_lib +import os.path +import shutil +import subprocess +import sys + +from beeref import constants + + +def datapath(src, dest): + return os.path.join(*src) + os.pathsep + os.path.join(*dest) + + +pyqt_dir = os.path.join(get_python_lib(), 'PyQt6', 'Qt6') +appname= f'{constants.APPNAME}-{constants.VERSION}' + +subprocess.run( + [ + 'pyinstaller', + '--noconfirm', + '--onedir', + '--windowed', + '--name', appname, + '--hidden-import', 'PyQt6.sip', + '--hidden-import', 'PyQt6.QtPrintSupport', + '--icon', os.path.join('beeref', 'assets', 'logo.png'), + '--paths', os.path.join(pyqt_dir, 'bin'), + '--add-data', datapath( + [pyqt_dir, 'plugins', 'platforms'], ['platforms']), + '--add-data', datapath([pyqt_dir, 'lib'], ['.']), + '--add-data', datapath( + ['beeref', 'documentation'], ['beeref', 'documentation']), + '--add-data', datapath( + ['beeref', 'assets', '*.png'], ['beeref', 'assets']), + 'beeref/__main__.py' + ]) + +print('Zipping output...') +shutil.make_archive( + os.path.join('dist', appname), + 'zip', + root_dir='dist', + base_dir=appname) + +print('Done')