Skip to content

111

111 #518

Workflow file for this run

name: Build Nuitka Standalone Executable
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install nuitka
pip install upx
pip install -r requirements.txt
- name: Install required tools
run: |
choco install upx -y
choco install 7zip -y
- name: Get UPX binary path
run: |
$UPXPath = (Get-Command upx).Source
echo "UPX_PATH=$UPXPath" >> $GITHUB_ENV
- name: Build executable with Nuitka
run: |
python -m nuitka --standalone --python-flag=-O `
--include-data-files=./favicon.ico=./favicon.ico `
--include-data-files=./favicon-d.ico=./favicon-d.ico `
--include-data-files=./CUL_update.exe=./CUL_update.exe `
--include-data-files=./frpc.exe=./frpc.exe `
--include-package=PyQt6 `
--upx-binary=$UPX_PATH `
--include-package-data=PyQt6 `
--include-qt-plugins=styles,platforms,qml `
--plugin-enable=pyqt6,upx `
--follow-import-to=PyQt6,PyQt6.QtCore,PyQt6.QtGui,PyQt6.QtWidgets,psutil,pyperclip,ipaddress,requests,dns `
--remove-output `
--windows-console-mode=disable `
--assume-yes-for-downloads `
--output-dir=./build_output `
--nofollow-import-to=psutil.tests,psutil.tests.test_testutils,dns.tests `
--windows-icon-from-ico=./favicon.ico `
./CHMLFRP_UI.py
- name: Copy _internal directory to build output
run: |
$buildOutputDir = "./build_output/CHMLFRP_UI.dist"
if (Test-Path $buildOutputDir) {
Copy-Item -Path "./_internal" -Destination $buildOutputDir -Recurse -Force
Write-Host "Successfully copied _internal directory to build output"
} else {
Write-Error "Build output directory not found at $buildOutputDir"
exit 1
}
- name: Check if output directory exists
run: |
$outputDir = "./build_output"
if (Test-Path $outputDir) {
Write-Host "Output directory exists, proceeding with compression."
} else {
Write-Error "Output directory not found at $outputDir"
exit 1
}
- name: Compress with maximum ZIP compression (7-Zip)
run: |
$currentDate = (Get-Date -Format "yyyy_MM_dd")
$zipFileName = "CHMLFRP_UI_$currentDate.zip"
& "C:\Program Files\7-Zip\7z.exe" a -tzip -mx=9 -mmt=on -mfb=273 -mpass=15 "$zipFileName" "./build_output/*"
Write-Output "Created high-compression ZIP archive: $zipFileName"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: CHMLFRP_UI-archive
path: ./*.zip
retention-days: 7