4141 macos_version : " 14"
4242 platform_id : " macosx_arm64"
4343
44+ - name : " windows-latest"
45+ platform : " windows"
46+ platform_id : " win_amd64"
47+
4448 steps :
4549 - name : Checkout
4650 uses : actions/checkout@v4
@@ -50,13 +54,20 @@ jobs:
5054 with :
5155 python-version : ${{ matrix.python-version }}
5256
53- - name : Install poetry
54- run : pipx install poetry==1.8.3 --python $(which python3)
55- shell : bash
56-
57- - name : Test poetry
57+ - name : Install Poetry
58+ run : python -m pip install poetry==1.8.3
59+
60+ - name : Set up custom PATH and set py version to cpXYZ [windows]
61+ if : ${{matrix.os.platform_id == 'win_amd64'}}
62+ shell : pwsh
5863 run : |
59- poetry run python --version
64+ echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
65+ echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
66+ echo "C:\Users\runneradmin\.local\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
67+ echo "C:\nasm" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
68+ $version = "${{ matrix.python-version }}"
69+ $cp_version = "cp$($version -replace '\.', '')"
70+ Add-Content -Path $env:GITHUB_ENV -Value "python_cp_version=$cp_version"
6071
6172 - name : Setup pypi for poetry [for releases only]
6273 if : ${{ startsWith(github.ref, 'refs/tags/') }}
6576 poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
6677
6778 - name : Convert python version to cpXYZ
79+ if : ${{matrix.os.platform_id != 'win_amd64'}}
6880 run : |
6981 version=${{ matrix.python-version }}
7082 cp_version="cp${version//.}"
@@ -147,20 +159,6 @@ jobs:
147159 mkdir ./dist
148160 cp wheelhouse/*.whl ./dist/
149161
150- - name : publish wheels (dry run) [macos]
151- if : matrix.os.platform == 'macos'
152- run : |
153- ls -l ./
154- ls -l ./dist
155- poetry publish --dry-run --no-interaction -vvv
156-
157- - name : publish wheels (on publishing) [macos]
158- if : ${{ matrix.os.platform == 'macos' && startsWith(github.ref, 'refs/tags/') }}
159- run : |
160- ls -l ./
161- ls -l ./dist
162- poetry publish --no-interaction -vvv
163-
164162 - name : Set up QEMU [linux]
165163 if : matrix.os.name == 'ubuntu-latest'
166164 uses : docker/setup-qemu-action@v3
@@ -191,17 +189,69 @@ jobs:
191189 mkdir ./dist
192190 cp wheelhouse/*.whl ./dist/
193191
194- - name : publish wheels (dry run) [linux]
195- if : matrix.os.platform == 'linux'
192+ - name : Set up MSYS2 [windows]
193+ if : ${{matrix.os.platform_id == 'win_amd64'}}
194+ uses : msys2/setup-msys2@v2
195+ with :
196+ update : true
197+ install : >
198+ mingw-w64-x86_64-toolchain
199+ mingw-w64-i686-toolchain
200+
201+ - name : Set up QPDF external-libs [windows]
202+ if : ${{matrix.os.platform_id == 'win_amd64'}}
203+ shell : pwsh
204+ run : |
205+ New-Item -Path 'C:\windows-libs' -ItemType Directory -Force
206+ Invoke-WebRequest -Uri 'https://github.com/qpdf/external-libs/releases/download/release-2024-06-07/qpdf-external-libs-bin.zip' -OutFile 'C:\windows-libs\qpdf-external-libs-bin.zip'
207+ Expand-Archive -Path 'C:\windows-libs\qpdf-external-libs-bin.zip' -DestinationPath 'C:\windows-libs' -Force
208+ Get-ChildItem -Path 'C:\windows-libs' -Recurse
209+
210+ - name : Set up NASM assembler [windows]
211+ if : ${{matrix.os.platform_id == 'win_amd64'}}
212+ shell : pwsh
213+ run : |
214+ New-Item -Path 'C:\nasm' -ItemType Directory -Force
215+ Invoke-WebRequest -Uri 'https://fossies.org/windows/misc/nasm-2.16.03-win64.zip/nasm-2.16.03/nasm.exe' -OutFile 'C:\nasm\nasm.exe'
216+ nasm -v
217+
218+ - name : Build wheels
219+ if : ${{matrix.os.platform_id == 'win_amd64'}}
220+ env :
221+ CIBW_PLATFORM : windows
222+ CIBW_BUILD_VERBOSITY : 3
223+ CIBW_ARCHS : AMD64
224+ CIBW_PROJECT_REQUIRES_PYTHON : " ~=${{ matrix.python-version }}.0"
225+ PKG_CONFIG_PATH : " C:/msys64/mingw64/lib/pkgconfig"
226+ PKG_CONFIG_EXECUTABLE : " C:/msys64/usr/bin/pkg-config.exe"
227+ CMAKE_PREFIX_PATH : " C:/msys64/mingw64;C:/windows-libs/external-libs"
228+ CMAKE_LIBRARY_PATH : " C:/msys64/mingw64/lib;C:/windows-libs/external-libs/lib-mingw64"
229+ CMAKE_INCLUDE_PATH : " C:/msys64/mingw64/include;C:/windows-libs/external-libs/include"
230+ CMAKE_GENERATOR : " MSYS Makefiles"
231+ BUILD_THREADS : 1
232+ ASM_NASM : " C:/nasm/nasm.exe"
233+ shell : pwsh
234+ run : |
235+ Remove-Item -Recurse -Force "C:\Strawberry\"
236+ $env:CMAKE_ARGS = "-DZLIB_LIBRARY=C:/windows-libs/external-libs/lib-mingw64/libz.a -DZLIB_INCLUDE_DIR=C:/windows-libs/external-libs/include -DJPEG_LIBRARY=C:/windows-libs/external-libs/lib-mingw64/libjpeg.a -DJPEG_INCLUDE_DIR=C:/windows-libs/external-libs/include"
237+ poetry install --no-interaction --no-root --only=build
238+ poetry run python -m cibuildwheel --output-dir .\wheelhouse
239+ Get-ChildItem -Path .\wheelhouse -Filter *.whl | Format-List
240+ Get-ChildItem -Path .\wheelhouse -Filter *.whl | ForEach-Object {
241+ $file = $_.FullName
242+ Write-Output "Inspecting $file"
243+ poetry run python -m zipfile --list "$file"
244+ }
245+ if (-not (Test-Path -Path .\dist)) {
246+ New-Item -Path .\dist -ItemType Directory
247+ }
248+ Copy-Item -Path .\wheelhouse\*.whl -Destination .\dist\
249+
250+ - name : publish wheels (dry run)
196251 run : |
197- ls -l ./
198- ls -l ./dist
199252 poetry publish --dry-run --no-interaction -vvv
200253
201- - name : publish wheels (on publishing) [linux ]
202- if : ${{ matrix.os.platform == 'linux' && startsWith(github.ref, 'refs/tags/') }}
254+ - name : publish wheels (on publishing) [for releases only ]
255+ if : ${{ startsWith(github.ref, 'refs/tags/') }}
203256 run : |
204- ls -l ./
205- ls -l ./dist
206257 poetry publish --no-interaction -vvv
207-
0 commit comments