Skip to content

Commit 83a7fac

Browse files
author
Release Manager
committed
sagemathgh-36525: GH Actions: Fix build of macOS x86_64 wheels, build wheels for sagemath-{bliss,coxeter3,mcqd,tdlib} for PyPI <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes sagemath#1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> Because the GitHub runner `macos-latest` is now Apple Silicon, building x86_64 wheels is broken. We fix this here by using `macos-13` for building x86_64. We speed up the build on Linux by bootstrapping only once in each job, and configuring and building packages of the Sage distribution only once for each Linux platform. Bootstrapping is now done outside of the container, and we configure Sage to use a `--prefix` in a directory mounted from the host, and storing the `config.status`. We add wheels for the optional-extension packages **sagemath-bliss**, ... that can be built on top of the existing modularized distributions. (The packages **sagemath-meataxe** and **sagemath-sirocco** have to wait for **sagemath-modules** to become available.) Tests at https://github.com/mkoeppe/sage/actions/workflows/dist.yml: - Successful run at https://github.com/mkoeppe/sage/actions/runs/9100668826 (the failure in release_dist is unrelated) Follow-up: - sagemath#37541, refactor as reusable GH Actions workflow -- for use by cysignals, cypari2, pplpy etc. Part of: - sagemath#31251 <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes sagemath#12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - sagemath#12345: short description why this is a dependency - sagemath#34567: ... --> - Depends on sagemath#36521 - Depends on sagemath#37503 (merged here) <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: sagemath#36525 Reported by: Matthias Köppe Reviewer(s):
2 parents c4681e3 + 2b2bbb2 commit 83a7fac

File tree

5 files changed

+25
-9
lines changed

5 files changed

+25
-9
lines changed

.github/workflows/dist.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ jobs:
166166
arch: x86_64
167167
- os: ubuntu-latest
168168
arch: i686
169-
- os: macos-latest
169+
- os: macos-13
170170
arch: x86_64
171171
- os: macos-14
172172
arch: arm64
@@ -175,16 +175,16 @@ jobs:
175175
# SPKGs to install as system packages
176176
SPKGS: _bootstrap _prereq
177177
# Non-Python packages to install as spkgs
178-
TARGETS_PRE: gmpy2-build-deps
178+
TARGETS_PRE: gmp mpfr mpc bliss coxeter3 mcqd meataxe sirocco boost_cropped tdlib
179179
# Disable building PyPy wheels on all platforms
180180
# Disable musllinux until #33083 provides alpine package information
181181
CIBW_SKIP: "pp* *-musllinux*"
182182
#
183183
CIBW_ARCHS: ${{ matrix.arch }}
184184
# https://cibuildwheel.readthedocs.io/en/stable/options/#requires-python
185-
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9, <3.12"
185+
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9, <3.13"
186186
# Environment during wheel build
187-
CIBW_ENVIRONMENT: "PATH=$(pwd)/local/bin:$PATH CPATH=$(pwd)/local/include:$CPATH LIBRARY_PATH=$(pwd)/local/lib:$LIBRARY_PATH PKG_CONFIG_PATH=$(pwd)/local/share/pkgconfig:$PKG_CONFIG_PATH ACLOCAL_PATH=/usr/share/aclocal"
187+
CIBW_ENVIRONMENT: "PATH=$(pwd)/prefix/bin:$PATH CPATH=$(pwd)/prefix/include:$CPATH LIBRARY_PATH=$(pwd)/prefix/lib:$LIBRARY_PATH LD_LIBRARY_PATH=$(pwd)/prefix/lib:$LD_LIBRARY_PATH PKG_CONFIG_PATH=$(pwd)/prefix/share/pkgconfig:$PKG_CONFIG_PATH ACLOCAL_PATH=/usr/share/aclocal PIP_CONSTRAINT=$(pwd)/constraints.txt"
188188
# Use 'build', not 'pip wheel'
189189
CIBW_BUILD_FRONTEND: build
190190
steps:
@@ -203,23 +203,36 @@ jobs:
203203
python-version: "3.8 - 3.12"
204204
update-environment: false
205205

206+
- name: Bootstrap
207+
run: |
208+
export PATH=$(pwd)/build/bin:$PATH
209+
eval $(sage-print-system-package-command auto --sudo --yes --no-install-recommends --spkg install _bootstrap)
210+
./bootstrap
211+
206212
- name: Build platform wheels
207213
# We build the wheels from the sdists so that MANIFEST filtering becomes effective.
208214
# But we must run cibuildwheel with the unpacked source directory, not a tarball,
209215
# so that SAGE_ROOT is copied into the build containers.
210216
#
211217
# In the CIBW_BEFORE_ALL phase, we install libraries using the Sage distribution.
212218
# https://cibuildwheel.readthedocs.io/en/stable/options/#before-all
213-
# This is unfortunately repeated for each of the packages that we build wheels for
219+
# For Linux, this is repeated for each of the packages that we build wheels for
214220
# because CIBW starts with a fresh container on each invocation.
221+
# Therefore we cache it in a directory mounted from the host: /host
222+
# https://cibuildwheel.pypa.io/en/stable/faq/#linux-builds-in-containers
223+
#
224+
# omit sagemath-{meataxe,sirocco} for now -- needs sagemath-modules
215225
run: |
216226
"${{ steps.python.outputs.python-path }}" -m pip install pipx
217227
export PATH=build/bin:$PATH
218-
export CIBW_BEFORE_ALL="( $(sage-print-system-package-command debian --yes --no-install-recommends install $(sage-get-system-packages debian $SPKGS)) || $(sage-print-system-package-command fedora --yes --no-install-recommends install $(sage-get-system-packages fedora $SPKGS | sed s/pkg-config/pkgconfig/)) || ( $(sage-print-system-package-command homebrew --yes --no-install-recommends install $(sage-get-system-packages homebrew $SPKGS)) || echo error ignored) ) && ./bootstrap && ./configure --enable-build-as-root && make -j4 V=0 $TARGETS_PRE"
228+
export CIBW_BEFORE_ALL="( $(sage-print-system-package-command debian --yes --no-install-recommends install $(sage-get-system-packages debian $SPKGS)) || $(sage-print-system-package-command fedora --yes --no-install-recommends install $(sage-get-system-packages fedora $SPKGS | sed s/pkg-config/pkgconfig/)) || ( $(sage-print-system-package-command homebrew --yes --no-install-recommends install $(sage-get-system-packages homebrew $SPKGS)) || echo error ignored) ) && if cp /host/sage-\$AUDITWHEEL_PLAT/config.status . 2>/dev/null; then chmod +x config.status; fi && if [ -x ./config.status ]; then ./config.status; else ./configure --enable-build-as-root ${{ startsWith(matrix.os, 'ubuntu') && '--prefix=/host/sage-\$AUDITWHEEL_PLAT' || '' }} && cp config.status prefix/; fi && MAKE=\"make -j6\" make V=0 $TARGETS_PRE && (echo \"sage_conf @ file://\$(pwd)/pkgs/sage-conf\" && echo \"sage_setup @ file://\$(pwd)/pkgs/sage-setup\") > constraints.txt"
219229
mkdir -p unpacked
220-
for pkg in sagemath-objects sagemath-categories; do
230+
for pkg in sagemath*objects sagemath*categories sagemath*bliss sagemath*coxeter3 sagemath*mcqd sagemath*tdlib; do
231+
case "$pkg:${{ matrix.arch }}" in
232+
sagemath*tdlib:i686) continue;; # broken - boost-related
233+
esac
221234
(cd unpacked && tar xfz - ) < dist/$pkg*.tar.gz
222-
"${{ steps.python.outputs.python-path }}" -m pipx run cibuildwheel==2.17.0 unpacked/$pkg*
235+
"${{ steps.python.outputs.python-path }}" -m pipx run cibuildwheel==2.18.0 unpacked/$pkg*
223236
done
224237
225238
- uses: actions/upload-artifact@v4
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
tdlib cysignals | $(PYTHON_TOOLCHAIN) sage_setup sagemath_environment cython pkgconfig $(PYTHON)
1+
tdlib cysignals boost_cropped | $(PYTHON_TOOLCHAIN) sage_setup sagemath_environment cython pkgconfig $(PYTHON)

build/pkgs/sirocco/dependencies

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mpfr

pkgs/sagemath-coxeter3/pyproject.toml.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ requires = [
55
SPKG_INSTALL_REQUIRES_setuptools
66
SPKG_INSTALL_REQUIRES_sage_setup
77
SPKG_INSTALL_REQUIRES_sagemath_environment
8+
SPKG_INSTALL_REQUIRES_sagemath_objects
89
SPKG_INSTALL_REQUIRES_cython
910
SPKG_INSTALL_REQUIRES_cysignals
1011
SPKG_INSTALL_REQUIRES_pkgconfig

pkgs/sagemath-meataxe/pyproject.toml.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ requires = [
55
SPKG_INSTALL_REQUIRES_setuptools
66
SPKG_INSTALL_REQUIRES_sage_setup
77
SPKG_INSTALL_REQUIRES_sagemath_environment
8+
SPKG_INSTALL_REQUIRES_sagemath_objects
89
SPKG_INSTALL_REQUIRES_cython
910
SPKG_INSTALL_REQUIRES_cysignals
1011
SPKG_INSTALL_REQUIRES_pkgconfig

0 commit comments

Comments
 (0)