From 8c42d6c6c8f6d6d1b27737e5a7f795649872dcdb Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 23 Jul 2025 11:47:44 -0700 Subject: [PATCH 1/2] .github/workflows/dist.yml: Fixes --- .github/workflows/dist.yml | 40 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml index f79a0c2..d3e2beb 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -79,6 +79,39 @@ jobs: python-version: "3.9 - 3.13" update-environment: false + - name: Retrieve configure tarball cache + id: cache-configure + uses: actions/cache/restore@v4 + with: + path: | + build/pkgs/configure + upstream/configure* + key: >- + configure-build=${{ + hashFiles('build', + 'configure.ac', + 'm4') + }} + + - name: Bootstrap + if: steps.cache-configure.outputs.cache-hit != 'true' + # Patch python3 spkg-configure to allow Python 3.8.0 during the CIBW_BEFORE_ALL phase + run: | + export PATH=$(pwd)/build/bin:$PATH + eval $(sage-print-system-package-command auto --sudo --yes update) + eval $(sage-print-system-package-command auto --sudo --yes --no-install-recommends --spkg install _bootstrap bzip2 xz liblzma) + sed -i.bak '/m4_pushdef.*MIN_VERSION/s/3[0-9.]*/3.8.0/' build/pkgs/python3/spkg-configure.m4 + ./bootstrap -s + + - name: Save configure tarball cache + if: steps.cache-configure.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: | + build/pkgs/configure + upstream/configure* + key: ${{ steps.cache-configure.outputs.cache-primary-key }} + - name: Build platform wheels # We build the wheel from the sdist. # But we must run cibuildwheel with the unpacked source directory, not a tarball, @@ -88,8 +121,10 @@ jobs: # https://cibuildwheel.readthedocs.io/en/stable/options/#before-all run: | "${{ steps.python.outputs.python-path }}" -m pip install pipx + if [ ! -x ./configure ]; then ./bootstrap -D; fi + touch configure export PATH=build/bin:$PATH - 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)) || $(sage-print-system-package-command alpine --yes --no-install-recommends install $(sage-get-system-packages alpine $SPKGS)) || echo error ignored) ) && ./bootstrap && ./configure --enable-build-as-root --enable-fat-binary && MAKE=\"make -j6\" make V=0 $TARGETS_PRE" + 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)) || $(sage-print-system-package-command alpine --yes --no-install-recommends install $(sage-get-system-packages alpine $SPKGS)) || echo error ignored) ) && ./configure --enable-build-as-root --enable-fat-binary --disable-python-distutils-check && MAKE=\"make -j6\" make V=0 $TARGETS_PRE" mkdir -p unpacked for pkg in pplitepy; do (cd unpacked && tar xfz - ) < dist/$pkg*.tar.gz @@ -97,10 +132,11 @@ jobs: done - uses: actions/upload-artifact@v4 + if: always() with: name: ${{ matrix.os }}-${{ matrix.arch }}-wheels path: ./wheelhouse/*.whl - + pypi-publish: needs: build_wheels name: Upload release to PyPI From 514c482eb2952532cddcbc0cadf258ae39a2bb97 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 23 Jul 2025 17:13:23 -0700 Subject: [PATCH 2/2] .github/workflows/dist.yml: Skip the whole job, not just step, when cannot deploy to PyPI --- .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 d3e2beb..c7b050d 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -140,6 +140,7 @@ jobs: pypi-publish: needs: build_wheels name: Upload release to PyPI + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') runs-on: ubuntu-latest environment: name: pypi @@ -165,4 +166,3 @@ jobs: ## password: ${{ secrets.SAGEMATH_PYPI_API_TOKEN }} skip_existing: true verbose: true - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')