Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH Actions: Build platform-independent wheels of sagemath-environment, sage-setup, sage-sws2rst for PyPI #37099

Merged
merged 5 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 37 additions & 18 deletions .github/workflows/dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
./configure && make dist
env:
MAKE: make -j8
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
path: |
Expand All @@ -61,7 +61,7 @@ jobs:
runs-on: ubuntu-latest
if: (success() || failure()) && github.repository == 'sagemath/sage' && startsWith(github.ref, 'refs/tags/') && !contains(github.ref, 'beta') && !contains(github.ref, 'rc')
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: release_dist
- uses: softprops/action-gh-release@v1
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
make pypi-sdists V=0
(mkdir dist && mv upstream/sage*.tar.gz dist/)
ls -l dist
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: "dist/*.tar.gz"
name: dist
Expand All @@ -103,6 +103,36 @@ jobs:
verbose: true
if: env.CAN_DEPLOY == 'true'

noarch_wheels_for_pypi:

runs-on: ubuntu-latest
env:
CAN_DEPLOY: ${{ secrets.SAGEMATH_PYPI_API_TOKEN != '' }}
steps:
- uses: actions/checkout@v4
- name: Install bootstrap prerequisites
run: |
sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install $(build/bin/sage-get-system-packages debian _bootstrap)
- name: make pypi-noarch-wheels
run: |
./bootstrap
./configure
make pypi-noarch-wheels V=0
(mkdir dist && mv venv/var/lib/sage/wheels/sage*-none-any.whl dist/)
ls -l dist
- uses: actions/upload-artifact@v4
with:
path: "dist/*.whl"
name: noarch-wheels
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.SAGEMATH_PYPI_API_TOKEN }}
skip-existing: true
verbose: true
if: env.CAN_DEPLOY == 'true'

build_wheels:
name: Build wheels on ${{ matrix.os }}, arch ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
Expand All @@ -118,6 +148,7 @@ jobs:
- os: macos-latest
arch: auto
env:
CAN_DEPLOY: ${{ secrets.SAGEMATH_PYPI_API_TOKEN != '' }}
# SPKGs to install as system packages
SPKGS: _bootstrap _prereq
# Non-Python packages to install as spkgs
Expand All @@ -136,7 +167,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
Expand All @@ -159,23 +190,11 @@ jobs:
pipx run cibuildwheel==2.16.2 unpacked/$pkg*
done

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: wheels
name: ${{ matrix.os }}-${{ matrix.arch }}-wheels
path: ./wheelhouse/*.whl

upload_wheels:
needs: build_wheels
runs-on: ubuntu-latest
env:
CAN_DEPLOY: ${{ secrets.SAGEMATH_PYPI_API_TOKEN != '' }}
steps:

- uses: actions/download-artifact@v3
with:
name: wheels
path: wheelhouse

- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
Expand Down
16 changes: 13 additions & 3 deletions build/make/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,14 @@ PIP_PACKAGES = @SAGE_PIP_PACKAGES@
# Packages that use the 'script' package build rules
SCRIPT_PACKAGES = @SAGE_SCRIPT_PACKAGES@

# Packages for which we build wheels for PyPI
PYPI_WHEEL_PACKAGES = \
# Packages for which we build platform-independent wheels for PyPI
PYPI_NOARCH_WHEEL_PACKAGES = \
sage_sws2rst \
sage_setup \
sagemath_environment \

# Packages for which we build wheels for PyPI
PYPI_WHEEL_PACKAGES = $(PYPI_NOARCH_WHEEL_PACKAGES) \
sagemath_objects \
sagemath_repl \
sagemath_categories \
Expand Down Expand Up @@ -220,7 +223,7 @@ SAGE_I_TARGETS = sagelib doc
# Tell make not to look for files with these names:
.PHONY: all all-sage all-toolchain all-build all-sageruntime \
all-start build-start base toolchain toolchain-deps base-toolchain \
pypi-sdists pypi-wheels wheels \
pypi-sdists pypi-noarch-wheels pypi-wheels wheels \
sagelib \
doc doc-html doc-html-jsmath doc-html-mathjax doc-pdf \
doc-uninstall \
Expand Down Expand Up @@ -453,6 +456,13 @@ pypi-sdists: $(PYPI_SDIST_PACKAGES:%=%-sdist)
# Ensuring wheels are present, even for packages that may have been installed
# as editable. Until we have better uninstallation of script packages, we
# just remove the timestamps, which will lead to rebuilds of the packages.
pypi-noarch-wheels:
for a in $(PYPI_NOARCH_WHEEL_PACKAGES); do \
rm -f $(SAGE_VENV)/var/lib/sage/installed/$$a-*; \
done
$(MAKE_REC) SAGE_EDITABLE=no SAGE_WHEELS=yes $(PYPI_NOARCH_WHEEL_PACKAGES)
@echo "Built wheels are in venv/var/lib/sage/wheels/"

pypi-wheels:
for a in $(PYPI_WHEEL_PACKAGES); do \
rm -f $(SAGE_VENV)/var/lib/sage/installed/$$a-*; \
Expand Down
Loading