Add build workflow

This commit is contained in:
Rebecca Breu 2021-07-06 19:50:10 +02:00
parent b63714583b
commit 26e04767f5
2 changed files with 79 additions and 0 deletions

31
.github/workflows/build.yml vendored Normal file
View file

@ -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

48
build.py Normal file
View file

@ -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')