diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b3ab4796..fc02b6fa 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,9 +1,9 @@ -name: deploy +name: Deploy and release on: push: tags: - - '*' + - "v*.*.*" env: SRC_DIR: zxlive @@ -12,7 +12,7 @@ jobs: build_and_deploy: strategy: matrix: - os: [ ubuntu-latest, macos-latest, windows-latest ] + os: [ ubuntu-latest, windows-latest, macos-latest ] python-version: [ 3.11 ] runs-on: ${{ matrix.os }} steps: @@ -21,12 +21,33 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - name: Install base package - run: pip install cx_freeze - - name: Deploy + cache: 'pip' + - name: Download Dependency Walker - Specific to Windows + # If this is not done, Nuitka crashes weirdly. + if: matrix.os == 'windows-latest' run: | - python deploy.py build - - name: Publish + Invoke-WebRequest -Uri 'https://dependencywalker.com/depends22_x86.zip' -OutFile 'depends22_x86.zip' + Add-Type -AssemblyName System.IO.Compression.FileSystem ; + [System.IO.Compression.ZipFile]::ExtractToDirectory("depends22_x86.zip", "depends22_x86") + New-Item -ItemType Directory -Path C:\Users\runneradmin\AppData\Local\Nuitka\Nuitka\Cache\downloads\depends\x86_64\ -Force + Move-Item -Path depends22_x86\depends.exe -Destination C:\Users\runneradmin\AppData\Local\Nuitka\Nuitka\Cache\downloads\depends\x86_64\depends.exe + - name: Install dependencies + run: + pip install . + - name: Build ZXLive + run: pyside6-deploy -v -f -c pysidedeploy.spec --keep-deployment-files + - name: Rename files, fix deployment file location - Windows + if: matrix.os == 'windows-latest' + run: mv build/__main__.exe ./zxlive_app_windows.exe + - name: Rename files, fix deployment file location - Linux, MacOS + if: matrix.os != 'windows-latest' run: | - ls build - echo "TODO: publish build/zxlive and the related files" \ No newline at end of file + if [ "$RUNNER_OS" == "Linux" ]; then + mv build/__main__.bin ./zxlive_app_linux.bin + elif [ "$RUNNER_OS" == "macOS" ]; then + mv zxlive/deployment/__main__.app/Contents/MacOS/__main__ ./zxlive_app_macos.bin + fi + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: zxlive_app_* diff --git a/deploy.py b/deploy.py deleted file mode 100644 index 8936e5bc..00000000 --- a/deploy.py +++ /dev/null @@ -1,7 +0,0 @@ -import sys -from cx_Freeze import setup, Executable - -# base="Win32GUI" should be used only for Windows GUI app -base = "Win32GUI" if sys.platform == "win32" else None - -setup(executables=[Executable("zxlive/__main__.py", base=base, target_name="zxlive")]) diff --git a/pyproject.toml b/pyproject.toml index 9a352e57..123cf270 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,6 @@ test = [ "pylint", "pytest-qt", ] -deploy = ["cx_Freeze"] [project.urls] Homepage = "https://github.com/Quantomatic/zxlive" @@ -79,16 +78,3 @@ disallow_untyped_defs = true disable_error_code = [ "import", ] - -[tool.distutils.build_exe] -excludes = [ - "IPython", - "jupyter", - "pytest", - "mypy", -] -zip_include_packages = [ - "encodings", - "zxlive", - "pyzx", -] diff --git a/pysidedeploy.spec b/pysidedeploy.spec new file mode 100755 index 00000000..e8f25a1f --- /dev/null +++ b/pysidedeploy.spec @@ -0,0 +1,73 @@ +[app] +# title of your application +title = ZXLive +# project directory. the general assumption is that project_dir is the parent directory +# of input_file +project_dir = ./zxlive/ +# source file path +input_file = __main__.py +# directory where exec is stored +exec_directory = ./build/ +# path to .pyproject project file +project_file = + +[python] +# python path +python_path = python +# python packages to install +# ordered-set = increase compile time performance of nuitka packaging +# zstandard = provides final executable size optimization +packages = nuitka==1.8.*,ordered_set,zstandard +# buildozer = for deploying Android application +android_packages = buildozer==1.5.*,cython==0.29.* + +[qt] +# comma separated path to qml files required +# normally all the qml files are added automatically +qml_files = +# excluded qml plugin binaries +excluded_qml_plugins = +# path to pyside wheel +wheel_pyside = +# path to shiboken wheel +wheel_shiboken = + +[nuitka] +# (str) specify any extra nuitka arguments +# for arm macos add --macos-create-app-bundle +extra_args = + --noinclude-qt-translations + --nofollow-import-to=IPython + --nofollow-import-to=scipy + --nofollow-import-to=pytest + --nofollow-import-to=matplotlib + --nofollow-import-to=pandas + --nofollow-import-to=sympy + --nofollow-import-to=ipywidgets + --nofollow-import-to=tkinter + --deployment + --disable-console + --include-package-data=zxlive.icons + --macos-create-app-bundle + +[buildozer] +# build mode +# possible options = [release, debug] +# release creates an aab, while debug creates an apk +mode = debug +# contrains path to pyside6 and shiboken6 recipe dir +recipe_dir = +# path to extra qt android jars to be loaded by the application +jars_dir = +# if empty uses default ndk path downloaded by buildozer +ndk_path = +# if empty uses default sdk path downloaded by buildozer +sdk_path = +# modules used. comma separated +modules = +# other libraries to be loaded. comma separated. +local_libs = plugins_platforms_qtforandroid +# architecture of deployed platform +# possible values = ["aarch64", "armv7a", "i686", "x86_64"] +arch = +