fix: Remove unnecessary noupx-exclude option for PyInstaller builds #230
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: "pip" | |
| - name: Install dependencies and PyInstaller | |
| run: pip install -r requirements.txt pyinstaller -U | |
| - name: Install UPX for compression | |
| shell: pwsh | |
| run: | | |
| $ProgressPreference = 'SilentlyContinue' | |
| Invoke-WebRequest -Uri "https://github.com/upx/upx/releases/download/v5.0.0/upx-5.0.0-win64.zip" -OutFile "upx.zip" | |
| Expand-Archive -Path "upx.zip" -DestinationPath "upx" | |
| $env:PATH = "$env:PATH;$pwd\upx\upx-5.0.0-win64" | |
| # Verify UPX is available | |
| upx --version | |
| - name: Cache PyInstaller build files | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ./build | |
| ./dist | |
| key: ${{ runner.os }}-pyinstaller-${{ hashFiles('**/*.py', 'requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pyinstaller- | |
| - name: Analyze imports | |
| run: | | |
| pip install pyinstaller-versioninfo | |
| # Create basic spec files for analysis | |
| pyi-makespec --name "DUCE-GUI-windows" gui.py | |
| pyi-makespec --name "DUCE-CLI-windows" cli.py | |
| - name: Build Executables | |
| shell: pwsh | |
| run: | | |
| # Build GUI | |
| pyinstaller -y -F -w -i "extra/DUCE-LOGO.ico" --clean --name "DUCE-GUI-windows" ` | |
| --add-data "base.py;." ` | |
| --add-data "colors.py;." ` | |
| --add-data "default-duce-gui-settings.json;." ` | |
| --add-data "README.md;." ` | |
| --add-data "LICENSE;." ` | |
| --strip ` | |
| --upx-dir="$pwd\upx\upx-5.0.0-win64" ` | |
| --exclude-module tkinter ` | |
| --exclude-module matplotlib ` | |
| --exclude-module numpy ` | |
| --exclude-module pytest ` | |
| --exclude-module unittest ` | |
| "gui.py" | |
| # Build CLI | |
| pyinstaller -y -F -c -i "extra/DUCE-LOGO.ico" --clean --name "DUCE-CLI-windows" ` | |
| --add-data "base.py;." ` | |
| --add-data "colors.py;." ` | |
| --add-data "default-duce-cli-settings.json;." ` | |
| --add-data "README.md;." ` | |
| --add-data "LICENSE;." ` | |
| --strip ` | |
| --upx-dir="$pwd\upx\upx-5.0.0-win64" ` | |
| --exclude-module tkinter ` | |
| --exclude-module matplotlib ` | |
| --exclude-module numpy ` | |
| --exclude-module pytest ` | |
| --exclude-module unittest ` | |
| "cli.py" | |
| # Print size information | |
| Write-Output "File sizes:" | |
| Get-ChildItem -Path "./dist" | Select-Object Name, @{Name="SizeInMB";Expression={"{0:N2} MB" -f ($_.Length/1MB)}} | |
| - name: Upload Windows Package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: DUCE-windows-package | |
| path: ./dist/ |