@@ -10,18 +10,37 @@ jobs:
1010 build :
1111 strategy :
1212 matrix :
13- os : [ubuntu-latest, macos-latest]
13+ os : [ubuntu-latest, macos-latest, windows-latest ]
1414
1515 runs-on : ${{ matrix.os }}
1616
1717 steps :
1818 - name : Checkout
1919 uses : actions/checkout@v4
2020
21- - name : Extract version
22- id : vars
21+ - name : Extract version (Unix)
22+ id : vars_unix
23+ if : runner.os != 'Windows'
2324 run : echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
2425
26+ - name : Extract version (Windows)
27+ id : vars_win
28+ if : runner.os == 'Windows'
29+ shell : pwsh
30+ run : |
31+ $version = $env:GITHUB_REF_NAME -replace '^v', ''
32+ echo "VERSION=$version" >> $env:GITHUB_OUTPUT
33+
34+ - name : Resolve version
35+ id : vars
36+ shell : bash
37+ run : |
38+ if [[ "$RUNNER_OS" == "Windows" ]]; then
39+ echo "VERSION=${{ steps.vars_win.outputs.VERSION }}" >> $GITHUB_OUTPUT
40+ else
41+ echo "VERSION=${{ steps.vars_unix.outputs.VERSION }}" >> $GITHUB_OUTPUT
42+ fi
43+
2544 - name : Setup Python
2645 uses : actions/setup-python@v5
2746 with :
@@ -38,18 +57,25 @@ jobs:
3857 run : |
3958 xcode-select -p || xcode-select --install || true
4059
60+ - name : Install MSVC build tools (Windows)
61+ if : runner.os == 'Windows'
62+ uses : ilammy/msvc-dev-cmd@v1
63+
4164 - name : Cache Nuitka
4265 uses : actions/cache@v4
4366 with :
44- path : ~/.cache/Nuitka
67+ path : |
68+ ~/.cache/Nuitka
69+ ~\AppData\Local\Nuitka\Nuitka\Cache
4570 key : nuitka-${{ runner.os }}-${{ hashFiles('**/*.py') }}
4671
4772 - name : Install Python dependencies
4873 run : |
4974 python -m pip install --upgrade pip
5075 pip install nuitka
5176
52- - name : Build with Nuitka
77+ - name : Build with Nuitka (Unix)
78+ if : runner.os != 'Windows'
5379 run : |
5480 python -m nuitka \
5581 --mode=onefile \
@@ -77,7 +103,37 @@ jobs:
77103 --static-libpython=yes \
78104 _entry.py
79105
80- - name : Prepare artifacts
106+ - name : Build with Nuitka (Windows)
107+ if : runner.os == 'Windows'
108+ shell : pwsh
109+ run : |
110+ python -m nuitka `
111+ --mode=onefile `
112+ --assume-yes-for-downloads `
113+ --output-dir=build `
114+ --output-filename=bangen `
115+ --include-package=bangen `
116+ --include-package=rich `
117+ --include-package-data=rich `
118+ --include-package=pyfiglet `
119+ --include-package-data=pyfiglet `
120+ --include-package=PIL `
121+ --include-package=typer `
122+ --include-package=click `
123+ --nofollow-import-to=tkinter `
124+ --nofollow-import-to=unittest `
125+ --nofollow-import-to=test `
126+ --nofollow-import-to=distutils `
127+ --nofollow-import-to=setuptools `
128+ --nofollow-import-to=pkg_resources `
129+ --python-flag=no_asserts `
130+ --python-flag=no_docstrings `
131+ --python-flag=isolated `
132+ "--onefile-tempdir-spec={CACHE_DIR}/bangen/${{ steps.vars.outputs.VERSION }}" `
133+ _entry.py
134+
135+ - name : Prepare artifacts (Unix)
136+ if : runner.os != 'Windows'
81137 run : |
82138 mkdir -p dist
83139 if [[ "$RUNNER_OS" == "Linux" ]]; then
@@ -86,6 +142,13 @@ jobs:
86142 mv build/bangen dist/bangen-${{ steps.vars.outputs.VERSION }}-macos
87143 fi
88144
145+ - name : Prepare artifacts (Windows)
146+ if : runner.os == 'Windows'
147+ shell : pwsh
148+ run : |
149+ New-Item -ItemType Directory -Force -Path dist
150+ Move-Item build\bangen.exe dist\bangen-${{ steps.vars.outputs.VERSION }}-windows.exe
151+
89152 - name : Strip binary (Linux only)
90153 if : runner.os == 'Linux'
91154 run : strip dist/bangen-${{ steps.vars.outputs.VERSION }}-linux
0 commit comments