From c106bbee2e2475b25af40368cd9ccb715c071440 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 18 Jan 2024 12:42:45 -0800 Subject: [PATCH 1/5] make pypi-noarch-wheels: New --- build/make/Makefile.in | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/build/make/Makefile.in b/build/make/Makefile.in index 28003ba0aff..d67bff95247 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -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 \ @@ -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 \ @@ -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-*; \ From ef8ac87b7bc3e18538b8b5496c28bd4fafedc24a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 18 Jan 2024 12:47:28 -0800 Subject: [PATCH 2/5] .github/workflows/dist.yml: Upload platform-independent wheels to PyPI --- .github/workflows/dist.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml index 5bf5729039c..1a48996f996 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -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 upstream/sage*-none-any.whl dist/) + ls -l dist + - uses: actions/upload-artifact@v3 + with: + path: "dist/*.whl" + name: dist + - 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 }} From c651697a0afef3e2a6bfd61c4b8db888dba5beb6 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 25 Apr 2024 21:15:21 -0700 Subject: [PATCH 3/5] .github/workflows/dist.yml: Fix location of noarch wheels --- .github/workflows/dist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml index 1a48996f996..1709b1703f5 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -119,7 +119,7 @@ jobs: ./bootstrap ./configure make pypi-noarch-wheels V=0 - (mkdir dist && mv upstream/sage*-none-any.whl dist/) + (mkdir dist && mv venv/var/lib/sage/wheels/sage*-none-any.whl dist/) ls -l dist - uses: actions/upload-artifact@v3 with: From 53dce76062e382cfa0a294ac40967d994d7682d5 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 25 Apr 2024 21:17:18 -0700 Subject: [PATCH 4/5] .github/workflows/dist.yml: Change artifact name for noarch wheels --- .github/workflows/dist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml index 1709b1703f5..5e46511ff14 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -124,7 +124,7 @@ jobs: - uses: actions/upload-artifact@v3 with: path: "dist/*.whl" - name: dist + name: noarch-wheels - uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ From c3eb320f491334715992d3f25fd917cb77e57ab9 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 25 Apr 2024 21:28:37 -0700 Subject: [PATCH 5/5] .github/workflows/dist.yml: Restructure for {upload,download}-artifact@v4 --- .github/workflows/dist.yml | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml index 5e46511ff14..20249612d36 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -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: | @@ -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 @@ -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 @@ -121,7 +121,7 @@ jobs: 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@v3 + - uses: actions/upload-artifact@v4 with: path: "dist/*.whl" name: noarch-wheels @@ -148,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 @@ -166,7 +167,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: dist path: dist @@ -189,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__