@@ -101,8 +101,223 @@ jobs:
101101 name : ${{ matrix.os }}-${{ matrix.arch }}-wheels
102102 path : ./wheelhouse/*.whl
103103
104+ build_wheels_windows :
105+ name : Build wheels on ${{ matrix.os }} using ${{ matrix.env }}
106+ runs-on : ${{ matrix.os }}
107+ needs : sdists_for_pypi
108+ strategy :
109+ fail-fast : false
110+ matrix :
111+ include :
112+ - os : windows-2022
113+ msystem : ucrt64
114+ env : ucrt-x86_64
115+ arch : auto
116+ build : " win_*64"
117+ - os : windows-11-arm
118+ msystem : clangarm64
119+ env : clang-aarch64
120+ arch : auto
121+ build : " win_*64"
122+ env :
123+ # SPKGs to install as system packages
124+ SPKGS : _bootstrap _prereq
125+ # Non-Python packages to install as spkgs
126+ TARGETS_PRE : pplite-ensure
127+ # Disable building PyPy wheels on all platforms
128+ CIBW_SKIP : " pp*"
129+ #
130+ CIBW_ARCHS : ${{ matrix.arch }}
131+ # https://cibuildwheel.readthedocs.io/en/stable/options/#requires-python
132+ CIBW_PROJECT_REQUIRES_PYTHON : " >=3.9"
133+ # Run before wheel build
134+ CIBW_BEFORE_BUILD_WINDOWS : |
135+ pip install delvewheel
136+ # Environment during wheel build
137+ # PYTHONUTF8=1 is for delvewheel
138+ CIBW_ENVIRONMENT : >-
139+ PATH="D:\\a\\sage\\sage\\sage-local\\bin;D:\\a\\sage\\sage\\build\\bin;$PATH"
140+ INCLUDE="D:\\a\\sage\\sage\\sage-local\\include;%INCLUDE%"
141+ LIB="D:\\a\\sage\\sage\\sage-local\\bin;D:\\a\\sage\\sage\\sage-local\\lib;%LIB%"
142+ PKG_CONFIG_PATH=$(pwd)/prefix/lib/pkgconfig:$PKG_CONFIG_PATH
143+ ACLOCAL_PATH=/usr/share/aclocal
144+ PIP_FIND_LINKS=D:\\a\\sage\\sage\\wheelhouse' 'D:\\a\\sage\\sage\\dist
145+ SAGE_NUM_THREADS=6
146+ PYTHONUTF8=1
147+ # Use 'build', not 'pip wheel'
148+ CIBW_BUILD_FRONTEND : build
149+ # CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -vv --custom-patch -w {dest_dir} {wheel}"
150+ CIBW_REPAIR_WHEEL_COMMAND_WINDOWS : " delvewheel repair -vv -w {dest_dir} {wheel}"
151+ #
152+ CIBW_PLATFORM : windows
153+ steps :
154+ - uses : actions/checkout@v4
155+ with :
156+ repository : passagemath/passagemath
157+ ref : main
158+
159+ - uses : actions/download-artifact@v4
160+ with :
161+ name : dist
162+ path : dist
163+
164+ - uses : msys2/setup-msys2@v2
165+ name : Setup msys2
166+ with :
167+ install : >-
168+ mingw-w64-${{ matrix.env }}-gcc
169+ autotools
170+ python
171+ python-pip
172+ python-setuptools
173+ patch
174+ bison
175+ mingw-w64-${{ matrix.env }}-cmake
176+ mingw-w64-${{ matrix.env }}-ninja
177+ mingw-w64-${{ matrix.env }}-gtest
178+ mingw-w64-${{ matrix.env }}-ncurses
179+ mingw-w64-${{ matrix.env }}-readline
180+ mingw-w64-${{ matrix.env }}-texinfo
181+ msystem : ${{ matrix.msystem }}
182+ path-type : inherit
183+
184+ - name : Retrieve configure tarball cache
185+ id : cache-configure
186+ uses : actions/cache/restore@v4
187+ with :
188+ path : |
189+ build/pkgs/configure
190+ upstream/configure*
191+ key : >-
192+ configure-build=${{
193+ hashFiles('build',
194+ 'configure.ac',
195+ 'm4')
196+ }}
197+
198+ - name : Bootstrap
199+ if : steps.cache-configure.outputs.cache-hit != 'true'
200+ # Patch python3 spkg-configure to allow Python 3.8.0 during the CIBW_BEFORE_ALL phase
201+ run : |
202+ export PATH=$(pwd)/build/bin:$PATH
203+ eval $(sage-print-system-package-command auto --yes update)
204+ eval $(sage-print-system-package-command auto --yes --no-install-recommends --spkg install _bootstrap bzip2 xz liblzma)
205+ sed -i.bak '/m4_pushdef.*MIN_VERSION/s/3[0-9.]*/3.8.0/' build/pkgs/python3/spkg-configure.m4
206+ ./bootstrap -s
207+ shell : msys2 {0}
208+
209+ - name : Save configure tarball cache
210+ if : steps.cache-configure.outputs.cache-hit != 'true'
211+ uses : actions/cache/save@v4
212+ with :
213+ path : |
214+ build/pkgs/configure
215+ upstream/configure*
216+ key : ${{ steps.cache-configure.outputs.cache-primary-key }}
217+
218+ - name : Retrieve SAGE_LOCAL cache
219+ id : cache-sage-local
220+ uses : actions/cache/restore@v4
221+ with :
222+ path : |
223+ config.status
224+ sage-local
225+ key : >-
226+ ${{ runner.os }}-cibuildwheel-${{ matrix.arch }}-build=${{
227+ hashFiles('build',
228+ 'configure.ac',
229+ 'm4')
230+ }}
231+ restore-keys : |
232+ ${{ runner.os }}-cibuildwheel-${{ matrix.arch }}
233+
234+ - name : Unpack and prepare
235+ id : unpack
236+ # We build the wheels from the sdists so that MANIFEST filtering becomes effective.
237+ # But we must run cibuildwheel with the unpacked source directory, not a tarball,
238+ # so that SAGE_ROOT is copied into the build containers.
239+ #
240+ # In the CIBW_BEFORE_ALL phase, we install libraries using the Sage distribution.
241+ # https://cibuildwheel.readthedocs.io/en/stable/options/#before-all
242+ # For Linux, this is repeated for each of the packages that we build wheels for
243+ # because CIBW starts with a fresh container on each invocation.
244+ # Therefore we cache it in a directory mounted from the host: /host
245+ # https://cibuildwheel.pypa.io/en/stable/faq/#linux-builds-in-containers
246+ #
247+ # - configure --with-sage-venv makes the SAGE_VENV separate from SAGE_LOCAL.
248+ # SAGE_LOCAL is put in PATH for the wheel building.
249+ # SAGE_VENV must not be in PATH so it does not shadow cibuildwheel's build tools.
250+ #
251+ run : |
252+ if [ ! -x ./configure ]; then ./bootstrap -D; fi
253+ touch configure
254+ SAGE_LOCAL=$(pwd)/sage-local
255+ # We set the installation records to the same mtime so that no rebuilds due to dependencies
256+ # among these packages are triggered.
257+ dummy="$SAGE_LOCAL"/var/lib/sage/installed/.dummy
258+ if [ -f "$dummy" ]; then
259+ touch "$dummy"
260+ for tree in "$SAGE_LOCAL" "$SAGE_LOCAL"/var/lib/sage/venv*; do
261+ inst="$tree"/var/lib/sage/installed
262+ if [ -d "$inst" ]; then
263+ # -r is --reference; the macOS version of touch does not accept the long option.
264+ (cd "$inst" && touch -r "$dummy" .dummy *)
265+ # Show what has been built already.
266+ ls -l "$tree" "$inst"
267+ fi
268+ done
269+ fi
270+
271+ export PATH=build/bin:$PATH
272+ echo CIBW_BEFORE_ALL="msys2 tools/cibw_before_all_windows.sh" >> "$GITHUB_ENV"
273+ mkdir -p unpacked
274+ set -x
275+ for sdist in dist/$pkg*.tar.gz; do
276+ (cd unpacked && tar xfz - && base=${sdist#dist/} && mv ${base%.tar.gz} ${base%-*}) < $sdist
277+ done
278+ shell : msys2 {0}
279+
280+ - name : pplitepy wheels
281+ id : pplitepy
282+ uses : pypa/cibuildwheel@v2.23.0
283+ with :
284+ package-dir : unpacked/pplitepy
285+
286+ - name : Save SAGE_LOCAL cache
287+ if : (success() || failure()) && steps.unpack.outcome == 'success'
288+ uses : actions/cache/save@v4
289+ with :
290+ path : |
291+ config.status
292+ sage-local
293+ !sage-local/lib64
294+ key : ${{ steps.cache-sage-local.outputs.cache-primary-key }}
295+
296+ - uses : actions/upload-artifact@v4
297+ with :
298+ name : ${{ matrix.os }}-${{ matrix.arch }}-wheels
299+ path : ./wheelhouse/*.whl
300+
301+ - uses : actions/upload-artifact@v4
302+ if : always()
303+ with :
304+ name : unpacked-${{ matrix.os }}
305+ path : ./unpacked
306+
307+ - uses : actions/upload-artifact@v4
308+ if : always()
309+ with :
310+ name : sage-local-${{ matrix.os }}
311+ path : ./sage-local
312+
313+ - uses : actions/upload-artifact@v4
314+ if : always()
315+ with :
316+ name : logs-${{ matrix.os }}
317+ path : ./logs
318+
104319 pypi-publish :
105- needs : build_wheels
320+ needs : [ build_wheels, build_wheels_windows]
106321 name : Upload release to PyPI
107322 runs-on : ubuntu-latest
108323 environment :
0 commit comments