Skip to content

Commit 271e220

Browse files
committed
Add pyinstaller Windows CI build
1 parent 2c02c00 commit 271e220

4 files changed

Lines changed: 69 additions & 7 deletions

File tree

.github/workflows/flatpak.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ jobs:
1313
options: --privileged
1414
steps:
1515
- uses: actions/checkout@v4
16-
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6
16+
- name: Build Flatpak
17+
uses: flatpak/flatpak-github-actions/flatpak-builder@v6
1718
with:
1819
bundle: yafi-${{ github.sha }}.flatpak
1920
manifest-path: au.stevetech.yafi.json

.github/workflows/pyinstaller-linux.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,21 @@ on:
77

88
jobs:
99
pyinstaller-linux:
10-
runs-on: ubuntu-24.04
10+
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13-
- uses: awalsh128/cache-apt-pkgs-action@latest
13+
# We shouldn't use actions/setup-python since PyGObject is compiled against the system Python
14+
- name: Install System Dependencies
15+
uses: awalsh128/cache-apt-pkgs-action@latest
1416
with:
1517
packages: python3-gi gir1.2-gtk-4.0 gir1.2-adw-1
1618
version: 0
17-
- run: pip install pyinstaller
18-
- run: pip install .
19-
- run: pyinstaller yafi.spec
19+
- name: Install PyInstaller
20+
run: pip install pyinstaller
21+
- name: Build YAFI via Pip
22+
run: pip install .
23+
- name: Build with PyInstaller
24+
run: pyinstaller yafi.spec
2025
working-directory: pyinstaller
2126
- name: Upload PyInstaller Artifact
2227
uses: actions/upload-artifact@v4
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: PyInstaller Build Linux
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
pyinstaller-linux:
10+
runs-on: windows-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v5
14+
with:
15+
python-version: '3.13'
16+
cache: 'pip'
17+
18+
- name: Cache GTK4
19+
id: cache-gtk4
20+
uses: actions/cache@v4
21+
with:
22+
path: C:\gtk
23+
key: Gvsbuild_2025.8.0
24+
25+
- name: Download GTK4 Gvsbuild zip
26+
if: steps.cache-gtk4.outputs.cache-hit != 'true'
27+
run: Start-BitsTransfer -Source https://github.com/wingtk/gvsbuild/releases/download/2025.8.0/GTK4_Gvsbuild_2025.8.0_x64.zip -Destination Gvsbuild.zip
28+
29+
- name: Extract Gvsbuild zip
30+
if: steps.cache-gtk4.outputs.cache-hit != 'true'
31+
run: Expand-Archive -Path Gvsbuild.zip -DestinationPath C:\gtk -Force
32+
33+
- name: Install PyGObject wheel
34+
run: pip install --force-reinstall (Resolve-Path C:\gtk\wheels\PyGObject*.whl) (Resolve-Path C:\gtk\wheels\pycairo*.whl)
35+
36+
- name: Add GTK bin to PATH
37+
run: echo "C:\gtk\bin" | Out-File -Append -Encoding ascii $env:GITHUB_PATH
38+
39+
- name: Install PyInstaller
40+
run: pip install pyinstaller
41+
42+
- name: Build YAFI via Pip
43+
run: pip install .
44+
45+
- name: Build with PyInstaller
46+
run: python -m PyInstaller yafi.spec
47+
working-directory: pyinstaller
48+
49+
- name: Upload PyInstaller Artifact
50+
uses: actions/upload-artifact@v4
51+
with:
52+
path: pyinstaller/dist/YAFI.exe
53+
name: yafi-windows-${{ github.sha }}

pyinstaller/entrypoint.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import os
2-
os.environ["GDK_SCALE"] = "2"
2+
if os.name == 'nt' and os.environ.get('GDK_SCALE') is None:
3+
import ctypes
4+
scale_factor = ctypes.windll.shcore.GetScaleFactorForDevice(0)
5+
os.environ["GDK_SCALE"] = f"{scale_factor//100}"
36

47
from yafi import main
58
main()

0 commit comments

Comments
 (0)