mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-03 17:39:42 +02:00
fix: update Python version to 3.12 and switch from PyInstaller to Nuitka for building executables
This commit is contained in:
+52
-40
@@ -15,7 +15,7 @@ permissions:
|
|||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
env:
|
env:
|
||||||
PYTHON_VERSION: "3.11"
|
PYTHON_VERSION: "3.12"
|
||||||
APP_NAME: "SoftwareManager"
|
APP_NAME: "SoftwareManager"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -57,7 +57,7 @@ jobs:
|
|||||||
- name: Install Python dependencies
|
- name: Install Python dependencies
|
||||||
run: |
|
run: |
|
||||||
uv pip install -r requirements.txt
|
uv pip install -r requirements.txt
|
||||||
uv pip install pyinstaller backports.tarfile pillow
|
uv pip install nuitka
|
||||||
env:
|
env:
|
||||||
UV_SYSTEM_PYTHON: 1
|
UV_SYSTEM_PYTHON: 1
|
||||||
|
|
||||||
@@ -82,56 +82,68 @@ jobs:
|
|||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
- name: Build executable with PyInstaller (Windows)
|
- name: Install UPX
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [ "$RUNNER_OS" == "Windows" ]; then
|
||||||
|
curl -sL https://github.com/upx/upx/releases/download/v5.1.0/upx-5.1.0-win64.zip -o upx.zip
|
||||||
|
7z x upx.zip -oupx-dir
|
||||||
|
echo "$(pwd)/upx-dir" >> $GITHUB_PATH
|
||||||
|
elif [ "$RUNNER_OS" == "Linux" ]; then
|
||||||
|
curl -sL https://github.com/upx/upx/releases/download/v5.1.0/upx-5.1.0-amd64_linux.tar.xz -o upx.tar.xz
|
||||||
|
tar xf upx.tar.xz
|
||||||
|
echo "$(pwd)/upx-5.1.0-amd64_linux" >> $GITHUB_PATH
|
||||||
|
else
|
||||||
|
brew install upx
|
||||||
|
fi
|
||||||
|
upx --version | head -1
|
||||||
|
|
||||||
|
- name: Build with Nuitka (Windows)
|
||||||
if: runner.os == 'Windows'
|
if: runner.os == 'Windows'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
pyinstaller --onefile --windowed \
|
python -m nuitka \
|
||||||
--add-data "build_info.json;." \
|
--onefile \
|
||||||
--add-data "build_info.json;core" \
|
--onefile-no-compression \
|
||||||
--add-data "build_info.json;core/interface" \
|
--onefile-tempdir-spec="{CACHE_DIR}/${{ env.APP_NAME }}/${{ env.VERSION }}" \
|
||||||
--add-data "core/interface/assets;core/interface/assets" \
|
--windows-console-mode=disable \
|
||||||
--icon "core/interface/assets/logo.png" \
|
--enable-plugin=pyside6 \
|
||||||
--exclude-module PyQt6 \
|
--enable-plugin=upx \
|
||||||
--exclude-module PyQt5 \
|
--include-data-dir=core/interface/assets=core/interface/assets \
|
||||||
--hidden-import=backports.tarfile \
|
--include-data-files=build_info.json=build_info.json \
|
||||||
--hidden-import=backports \
|
--include-data-files=build_info.json=core/build_info.json \
|
||||||
--hidden-import=jaraco.context \
|
--include-data-files=build_info.json=core/interface/build_info.json \
|
||||||
--hidden-import=jaraco.text \
|
--output-filename=${{ env.APP_NAME }}.exe \
|
||||||
--hidden-import=jaraco.functools \
|
|
||||||
--name ${{ env.APP_NAME }} \
|
|
||||||
main.py
|
main.py
|
||||||
|
|
||||||
- name: Build executable with PyInstaller (Unix)
|
- name: Build with Nuitka (Unix)
|
||||||
if: runner.os != 'Windows'
|
if: runner.os != 'Windows'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
pyinstaller --onefile --windowed \
|
python -m nuitka \
|
||||||
--add-data "build_info.json:." \
|
--onefile \
|
||||||
--add-data "build_info.json:core" \
|
--onefile-no-compression \
|
||||||
--add-data "build_info.json:core/interface" \
|
--onefile-tempdir-spec="{CACHE_DIR}/${{ env.APP_NAME }}/${{ env.VERSION }}" \
|
||||||
--add-data "core/interface/assets:core/interface/assets" \
|
--enable-plugin=pyside6 \
|
||||||
--icon "core/interface/assets/logo.png" \
|
--enable-plugin=upx \
|
||||||
--exclude-module PyQt6 \
|
--include-data-dir=core/interface/assets=core/interface/assets \
|
||||||
--exclude-module PyQt5 \
|
--include-data-files=build_info.json=build_info.json \
|
||||||
--hidden-import=backports.tarfile \
|
--include-data-files=build_info.json=core/build_info.json \
|
||||||
--hidden-import=backports \
|
--include-data-files=build_info.json=core/interface/build_info.json \
|
||||||
--hidden-import=jaraco.context \
|
--output-filename=${{ env.APP_NAME }} \
|
||||||
--hidden-import=jaraco.text \
|
|
||||||
--hidden-import=jaraco.functools \
|
|
||||||
--name ${{ env.APP_NAME }} \
|
|
||||||
main.py
|
main.py
|
||||||
|
|
||||||
- name: Make executable (Unix)
|
- name: Prepare artifact
|
||||||
if: runner.os != 'Windows'
|
|
||||||
run: chmod +x dist/${{ env.APP_NAME }}
|
|
||||||
|
|
||||||
- name: Rename artifact
|
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd dist
|
mkdir -p dist
|
||||||
mv ${{ env.APP_NAME }}${{ runner.os == 'Windows' && '.exe' || '' }} ${{ matrix.artifact_name }}
|
if [ "$RUNNER_OS" == "Windows" ]; then
|
||||||
ls -la
|
mv ${{ env.APP_NAME }}.exe dist/${{ matrix.artifact_name }}
|
||||||
|
else
|
||||||
|
mv ${{ env.APP_NAME }} dist/${{ matrix.artifact_name }}
|
||||||
|
chmod +x dist/${{ matrix.artifact_name }}
|
||||||
|
fi
|
||||||
|
ls -la dist/
|
||||||
|
|
||||||
- name: Upload build artifact
|
- name: Upload build artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
|||||||
Reference in New Issue
Block a user