diff --git a/.github/workflows/flatpak.yml b/.github/workflows/flatpak.yml index d9c8366..c964b00 100644 --- a/.github/workflows/flatpak.yml +++ b/.github/workflows/flatpak.yml @@ -13,7 +13,8 @@ jobs: options: --privileged steps: - uses: actions/checkout@v4 - - uses: flatpak/flatpak-github-actions/flatpak-builder@v6 + - name: Build Flatpak + uses: flatpak/flatpak-github-actions/flatpak-builder@v6 with: bundle: yafi-${{ github.sha }}.flatpak manifest-path: au.stevetech.yafi.json diff --git a/.github/workflows/pyinstaller-linux.yml b/.github/workflows/pyinstaller-linux.yml index 0446641..7da0eb4 100644 --- a/.github/workflows/pyinstaller-linux.yml +++ b/.github/workflows/pyinstaller-linux.yml @@ -7,16 +7,21 @@ on: jobs: pyinstaller-linux: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: awalsh128/cache-apt-pkgs-action@latest + # We shouldn't use actions/setup-python since PyGObject is compiled against the system Python + - name: Install System Dependencies + uses: awalsh128/cache-apt-pkgs-action@latest with: packages: python3-gi gir1.2-gtk-4.0 gir1.2-adw-1 version: 0 - - run: pip install pyinstaller - - run: pip install . - - run: pyinstaller yafi.spec + - name: Install PyInstaller + run: pip install pyinstaller + - name: Build YAFI via Pip + run: pip install . + - name: Build with PyInstaller + run: pyinstaller yafi.spec working-directory: pyinstaller - name: Upload PyInstaller Artifact uses: actions/upload-artifact@v4 diff --git a/.github/workflows/pyinstaller-windows.yml b/.github/workflows/pyinstaller-windows.yml new file mode 100644 index 0000000..1ac0f04 --- /dev/null +++ b/.github/workflows/pyinstaller-windows.yml @@ -0,0 +1,53 @@ +name: PyInstaller Build Windows + +on: + push: + branches: [main] + pull_request: + +jobs: + pyinstaller-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.13' + cache: 'pip' + + - name: Cache GTK4 + id: cache-gtk4 + uses: actions/cache@v4 + with: + path: C:\gtk + key: Gvsbuild_2025.8.0 + + - name: Download GTK4 Gvsbuild zip + if: steps.cache-gtk4.outputs.cache-hit != 'true' + run: Start-BitsTransfer -Source https://github.com/wingtk/gvsbuild/releases/download/2025.8.0/GTK4_Gvsbuild_2025.8.0_x64.zip -Destination Gvsbuild.zip + + - name: Extract Gvsbuild zip + if: steps.cache-gtk4.outputs.cache-hit != 'true' + run: Expand-Archive -Path Gvsbuild.zip -DestinationPath C:\gtk -Force + + - name: Install PyGObject wheel + run: pip install --force-reinstall (Resolve-Path C:\gtk\wheels\PyGObject*.whl) (Resolve-Path C:\gtk\wheels\pycairo*.whl) + + - name: Add GTK bin to PATH + run: echo "C:\gtk\bin" | Out-File -Append -Encoding ascii $env:GITHUB_PATH + + - name: Install PyInstaller + run: pip install pyinstaller + + - name: Build YAFI via Pip + run: pip install . + + - name: Build with PyInstaller + run: python -m PyInstaller yafi.spec + working-directory: pyinstaller + + - name: Upload PyInstaller Artifact + uses: actions/upload-artifact@v4 + with: + path: pyinstaller/dist/YAFI.exe + name: yafi-windows-${{ github.sha }} diff --git a/pyinstaller/entrypoint.py b/pyinstaller/entrypoint.py index 3cd7bbc..b78322e 100644 --- a/pyinstaller/entrypoint.py +++ b/pyinstaller/entrypoint.py @@ -1,5 +1,8 @@ import os -os.environ["GDK_SCALE"] = "2" +if os.name == 'nt' and os.environ.get('GDK_SCALE') is None: + import ctypes + scale_factor = ctypes.windll.shcore.GetScaleFactorForDevice(0) + os.environ["GDK_SCALE"] = f"{scale_factor//100}" from yafi import main main()