diff --git a/.github/workflows/_build-cibuildwheel.yml b/.github/workflows/_build-cibuildwheel.yml index bcf57d1e921..ad757b53526 100644 --- a/.github/workflows/_build-cibuildwheel.yml +++ b/.github/workflows/_build-cibuildwheel.yml @@ -14,13 +14,20 @@ on: description: Package version being built. required: true type: string + source: + description: Source provider (checkout or pypi-sdist). + required: false + default: checkout + type: string repository: - description: Upstream owner/repository to check out. - required: true + description: Upstream owner/repository to check out when source is checkout. + required: false + default: '' type: string ref: - description: Upstream ref to check out. - required: true + description: Upstream ref to check out when source is checkout. + required: false + default: '' type: string artifact-tag: description: Platform or ABI suffix used in the uploaded artifact name. @@ -262,7 +269,24 @@ jobs: runs-on: ubuntu-24.04-riscv timeout-minutes: ${{ inputs['timeout-minutes'] }} steps: + - name: Validate source configuration + env: + SOURCE: ${{ inputs.source }} + REPOSITORY: ${{ inputs.repository }} + run: | + case "$SOURCE" in + checkout) + test -n "$REPOSITORY" + ;; + pypi-sdist) ;; + *) + echo "unsupported source: $SOURCE" >&2 + exit 1 + ;; + esac + - name: Checkout ${{ inputs.repository }} ${{ inputs.ref }} + if: inputs.source == 'checkout' uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: ${{ inputs.repository }} @@ -274,6 +298,91 @@ jobs: sparse-checkout: ${{ inputs['checkout-sparse-checkout'] }} persist-credentials: false + - name: Download and extract PyPI sdist + if: inputs.source == 'pypi-sdist' + env: + PACKAGE: ${{ inputs.package }} + VERSION: ${{ inputs.version }} + DESTINATION: ${{ inputs.package }} + run: | + python3 - <<'PY' + import hashlib + import json + import os + import shutil + import stat + import tarfile + import tempfile + import urllib.parse + import urllib.request + import zipfile + from pathlib import Path, PurePosixPath + + distribution = os.environ["PACKAGE"] + version = os.environ["VERSION"] + destination = Path(os.environ["GITHUB_WORKSPACE"], os.environ["DESTINATION"]) + api = "https://pypi.org/pypi/{}/{}/json".format( + urllib.parse.quote(distribution, safe=""), + urllib.parse.quote(version, safe=""), + ) + request = urllib.request.Request( + api, + headers={"User-Agent": "riseproject-dev/python-wheels"}, + ) + with urllib.request.urlopen(request) as response: + metadata = json.load(response) + sdists = [item for item in metadata["urls"] if item["packagetype"] == "sdist"] + if len(sdists) != 1: + raise SystemExit( + f"expected exactly one PyPI sdist for {distribution} {version}, found {len(sdists)}" + ) + + sdist = sdists[0] + parsed = urllib.parse.urlparse(sdist["url"]) + if parsed.scheme != "https" or parsed.hostname != "files.pythonhosted.org": + raise SystemExit(f"unexpected PyPI sdist URL: {sdist['url']}") + filename = Path(sdist["filename"]).name + if filename != sdist["filename"]: + raise SystemExit(f"unsafe PyPI sdist filename: {sdist['filename']}") + + archive = Path(os.environ["RUNNER_TEMP"], filename) + digest = hashlib.sha256() + request = urllib.request.Request( + sdist["url"], + headers={"User-Agent": "riseproject-dev/python-wheels"}, + ) + with urllib.request.urlopen(request) as response, archive.open("wb") as stream: + while chunk := response.read(1024 * 1024): + digest.update(chunk) + stream.write(chunk) + expected = sdist["digests"]["sha256"] + if digest.hexdigest() != expected: + raise SystemExit(f"SHA-256 mismatch for {filename}") + + staging = Path(tempfile.mkdtemp(prefix="pypi-sdist-", dir=os.environ["RUNNER_TEMP"])) + if tarfile.is_tarfile(archive): + with tarfile.open(archive) as source: + source.extractall(staging, filter="data") + elif zipfile.is_zipfile(archive): + with zipfile.ZipFile(archive) as source: + for member in source.infolist(): + path = PurePosixPath(member.filename) + mode = member.external_attr >> 16 + if path.is_absolute() or ".." in path.parts or stat.S_ISLNK(mode): + raise SystemExit(f"unsafe path in {filename}: {member.filename}") + source.extractall(staging) + else: + raise SystemExit(f"unsupported PyPI sdist archive: {filename}") + + roots = [path for path in staging.iterdir() if path.name != "__MACOSX"] + if len(roots) != 1 or not roots[0].is_dir(): + raise SystemExit(f"expected one source directory in {filename}") + if destination.exists(): + raise SystemExit(f"source destination already exists: {destination}") + shutil.move(roots[0], destination) + print(f"Downloaded {filename} with SHA-256 {expected}") + PY + - name: Checkout patches if: inputs.patches uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 diff --git a/.github/workflows/build-acora.yml b/.github/workflows/build-acora.yml index 4f04e30f671..4e331f777dd 100644 --- a/.github/workflows/build-acora.yml +++ b/.github/workflows/build-acora.yml @@ -43,88 +43,26 @@ jobs: package: acora version: ${{ inputs.version }} - build_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - name: Build acora ${{ matrix.version }} sdist - runs-on: ubuntu-latest - permissions: - contents: read - env: - ACORA_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout acora acora-${{ env.ACORA_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: scoder/acora - ref: acora-${{ env.ACORA_VERSION }} - persist-credentials: false - - - name: setup uv - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Build sdist - run: | - uv pip install setuptools wheel "Cython>=3.0.11" - python setup.py sdist - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: acora-${{ env.ACORA_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build acora ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - ACORA_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: acora-${{ env.ACORA_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - output-dir: wheelhouse/ - env: - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # test.py sits next to the acora/ source package at the sdist root; without - # staging it would shadow the installed wheel (gotcha 25). - CIBW_TEST_SOURCES: test.py README.rst - CIBW_TEST_COMMAND: python test.py -v - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: acora-${{ env.ACORA_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: acora + version: ${{ matrix.version }} + source: pypi-sdist + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + # test.py sits next to the acora/ source package at the sdist root; without + # staging it would shadow the installed wheel (gotcha 25). + cibw-test-sources: test.py README.rst + cibw-test-command: python test.py -v publish: name: Publish acora ${{ matrix.version }} diff --git a/.github/workflows/build-apache-tvm-ffi.yml b/.github/workflows/build-apache-tvm-ffi.yml index 7b43c9bdbbe..69b64d708a9 100644 --- a/.github/workflows/build-apache-tvm-ffi.yml +++ b/.github/workflows/build-apache-tvm-ffi.yml @@ -49,161 +49,77 @@ jobs: package: apache-tvm-ffi version: ${{ inputs.version }} - build_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - # The sdist is architecture-independent: it just packages the source tree, - # the vendored submodules (dlpack, libbacktrace) and a setuptools-scm-derived - # _version.py. Build it once on x86 instead of burning a scarce riscv runner - # (see CLAUDE.md gotcha 4). The resulting sdist is self-contained, so the - # riscv wheel job below needs neither git history nor submodules. - name: Build apache-tvm-ffi ${{ matrix.version }} sdist - runs-on: ubuntu-latest - permissions: - contents: read - env: - TVM_FFI_VERSION: ${{ matrix.version }} - - steps: - # Upstream tags post-releases with a dash (v0.1.13-post2), but the PyPI - # version this repo tracks normalizes that to a dot (0.1.13.post2); GitHub - # Actions expressions have no replace(), so the substitution happens here. - - name: Determine upstream tag - id: tag - run: echo "tag=v${TVM_FFI_VERSION/.post/-post}" >> "$GITHUB_OUTPUT" - - - name: Checkout tvm-ffi ${{ steps.tag.outputs.tag }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: apache/tvm-ffi - ref: ${{ steps.tag.outputs.tag }} - # submodules must be present so pyproject's sdist.include /3rdparty/** - # globs actually bundle dlpack + libbacktrace; setuptools-scm needs the - # full history + tags to derive the version from the checked-out tag. - submodules: recursive - fetch-depth: 0 - fetch-tags: true - persist-credentials: false - - - name: Install Python - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Build sdist - id: sdist - run: | - uv pip install build twine - python -m build --sdist - twine check dist/* - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: apache-tvm-ffi-${{ env.TVM_FFI_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build apache-tvm-ffi ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - permissions: - contents: read strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - TVM_FFI_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: apache-tvm-ffi-${{ env.TVM_FFI_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - # cibuildwheel accepts an sdist tarball directly: it extracts it and - # builds from the self-contained tree (no submodules/git needed here). - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - # pyproject pins [tool.cibuildwheel.linux] archs to x86_64+aarch64; - # override so this native riscv runner builds the riscv64 wheel. - CIBW_ARCHS: riscv64 - CIBW_SKIP: '*-musllinux_*' - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # Override upstream's build-frontend = "build[uv]". cibuildwheel's audit - # step creates a venv on the *host* runner (not in the container) and, - # when the frontend is build[uv], insists on a host `uv` binary - # (venv.py: `assert uv_path is not None`). The self-hosted riscv runner - # has no host uv, so the abi3 wheel builds fine but the run crashes in - # "Auditing wheel...". Plain `build` uses pip/virtualenv on the host - # instead - the way our local container build was validated. - CIBW_BUILD_FRONTEND: build - # The test-command (pytest {package}/tests/python) and test-groups - # (["test"] pulls in torch/numpy/ml_dtypes/pytest/ninja) are inherited - # from the sdist's pyproject.toml, so we build and test exactly the way - # upstream does. - # - # CIBW_ENVIRONMENT applies to BOTH the build and test phases. We only - # point pip/uv at our registry here (needed so test deps resolve, and - # harmless at build time). We deliberately do NOT set ONLY_BINARY here: - # the build backend needs cython>=3.0, which has no riscv64 wheel on - # any index and must be compiled from its sdist inside the container. - CIBW_ENVIRONMENT: >- - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - UV_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - UV_INDEX_STRATEGY=unsafe-best-match - # Test phase only: force wheels-only so a missing riscv64 wheel for a - # heavy test dep (torch/numpy/ml_dtypes) fails fast instead of silently - # kicking off a multi-hour source build under the runner. GPU-only tests - # self-skip via torch.cuda.is_available(). - CIBW_TEST_ENVIRONMENT: >- - PIP_ONLY_BINARY=:all: - UV_ONLY_BINARY=:all: - # Mirror upstream's test-command (pytest {package}/tests/python -vvs) - # but drop two tests that fail only because of this riscv64 runner's - # environment, not the wheel (2300+ others pass; cp314t, which pulls no - # torch, is fully green): - # * test_libinfo.py - every test there shells out to `tvm-ffi-config` - # and asserts the subprocess's stderr is empty. Importing tvm_ffi - # pulls in torch, whose bundled libcpuinfo can't parse this runner's - # /sys CPU topology (core_id reads "-1") and prints - # "Error in cpuinfo: failed to parse ... core_id" to stderr. The - # noise is nondeterministic across the module's subprocess tests, so - # the whole file is dropped via --ignore (an absolute path, so it's - # unambiguous regardless of pytest's rootdir). - # * test_filelock.py::test_concurrent_access - spawns 16 concurrent - # torch-importing workers under a hard 60s wait; the slower riscv64 - # runner blows the timeout. Dropped with -k by its (unique) name - - # rootdir-independent, unlike a path-based --deselect (which silently - # no-ops when the nodeid prefix doesn't match pytest's rootdir). - CIBW_TEST_COMMAND: >- - pytest {package}/tests/python -vvs - --ignore {package}/tests/python/test_libinfo.py - -k "not test_concurrent_access" - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: apache-tvm-ffi-${{ env.TVM_FFI_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + # The reusable workflow extracts the self-contained PyPI sdist, so this + # build needs neither Git history nor submodules. + # pyproject pins [tool.cibuildwheel.linux] archs to x86_64+aarch64; + # override so this native riscv runner builds the riscv64 wheel. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: apache-tvm-ffi + version: ${{ matrix.version }} + # The PyPI sdist contains the generated version and vendored dlpack/libbacktrace sources. + source: pypi-sdist + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-skip: "*-musllinux_*" + # Override upstream's build-frontend = "build[uv]". cibuildwheel's audit + # step creates a venv on the *host* runner (not in the container) and, + # when the frontend is build[uv], insists on a host `uv` binary + # (venv.py: `assert uv_path is not None`). The self-hosted riscv runner + # has no host uv, so the abi3 wheel builds fine but the run crashes in + # "Auditing wheel...". Plain `build` uses pip/virtualenv on the host + # instead - the way our local container build was validated. + cibw-build-frontend: build + # The test-command (pytest {package}/tests/python) and test-groups + # (["test"] pulls in torch/numpy/ml_dtypes/pytest/ninja) are inherited + # from the sdist's pyproject.toml, so we build and test exactly the way + # upstream does. + # + # CIBW_ENVIRONMENT applies to BOTH the build and test phases. We only + # point pip/uv at our registry here (needed so test deps resolve, and + # harmless at build time). We deliberately do NOT set ONLY_BINARY here: + # the build backend needs cython>=3.0, which has no riscv64 wheel on + # any index and must be compiled from its sdist inside the container. + cibw-environment-linux: > + UV_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + UV_INDEX_STRATEGY=unsafe-best-match + # Test phase only: force wheels-only so a missing riscv64 wheel for a + # heavy test dep (torch/numpy/ml_dtypes) fails fast instead of silently + # kicking off a multi-hour source build under the runner. GPU-only tests + # self-skip via torch.cuda.is_available(). + cibw-test-environment: > + PIP_ONLY_BINARY=:all: + UV_ONLY_BINARY=:all: + # Mirror upstream's test-command (pytest {package}/tests/python -vvs) + # but drop two tests that fail only because of this riscv64 runner's + # environment, not the wheel (2300+ others pass; cp314t, which pulls no + # torch, is fully green): + # * test_libinfo.py - every test there shells out to `tvm-ffi-config` + # and asserts the subprocess's stderr is empty. Importing tvm_ffi + # pulls in torch, whose bundled libcpuinfo can't parse this runner's + # /sys CPU topology (core_id reads "-1") and prints + # "Error in cpuinfo: failed to parse ... core_id" to stderr. The + # noise is nondeterministic across the module's subprocess tests, so + # the whole file is dropped via --ignore (an absolute path, so it's + # unambiguous regardless of pytest's rootdir). + # * test_filelock.py::test_concurrent_access - spawns 16 concurrent + # torch-importing workers under a hard 60s wait; the slower riscv64 + # runner blows the timeout. Dropped with -k by its (unique) name - + # rootdir-independent, unlike a path-based --deselect (which silently + # no-ops when the nodeid prefix doesn't match pytest's rootdir). + cibw-test-command: > + pytest {package}/tests/python -vvs + --ignore {package}/tests/python/test_libinfo.py + -k "not test_concurrent_access" publish: name: Publish apache-tvm-ffi ${{ matrix.version }} diff --git a/.github/workflows/build-awkward-cpp.yml b/.github/workflows/build-awkward-cpp.yml index 06df8cef40a..1a96ba0687f 100644 --- a/.github/workflows/build-awkward-cpp.yml +++ b/.github/workflows/build-awkward-cpp.yml @@ -51,106 +51,41 @@ jobs: package: awkward-cpp version: ${{ inputs.version }} - build_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - # The sdist is architecture-independent; build it once on x86 instead of - # burning a scarce riscv runner (CLAUDE.md gotcha 4). - name: Build awkward-cpp ${{ matrix.version }} sdist - runs-on: ubuntu-latest - permissions: - contents: read - env: - AWKWARD_CPP_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout scikit-hep/awkward ${{ env.AWKWARD_CPP_REF }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: scikit-hep/awkward - ref: ${{ env.AWKWARD_CPP_REF }} - # rapidjson is a submodule of awkward-cpp/, and its LICENSE is one of - # the project's declared license-files. - submodules: true - persist-credentials: false - - - name: Prepare build files - run: pipx run nox -s prepare - - - name: Build awkward-cpp sdist - id: sdist - run: | - pipx run build --sdist awkward-cpp - pipx run twine check awkward-cpp/dist/* - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: awkward-cpp-${{ env.AWKWARD_CPP_VERSION }}-sdist - path: awkward-cpp/dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build awkward-cpp ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 180 - permissions: - contents: read strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - AWKWARD_CPP_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: awkward-cpp-${{ env.AWKWARD_CPP_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # Override upstream's build-frontend = "build[uv]": cibuildwheel's - # audit step makes a venv on the host and asserts a host `uv` - # exists, which this self-hosted runner has none of (gotcha 13). - CIBW_BUILD_FRONTEND: build - CIBW_ENVIRONMENT: >- - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - PIP_ONLY_BINARY=cmake,numpy - CIBW_TEST_REQUIRES: pytest>=6 - CIBW_TEST_SOURCES: >- - tests-cpu-kernels tests-cpu-kernels-explicit - tests-spec tests-spec-explicit - # Upstream's own test-command also runs {project}/tests, which is - # the parent `awkward` package's suite (imports `awkward`, not - # awkward_cpp) - out of scope here since we only build awkward-cpp - # and `awkward` has no riscv64 wheel of its own. - CIBW_TEST_COMMAND: >- - pytest {package}/tests-cpu-kernels {package}/tests-cpu-kernels-explicit - {package}/tests-spec {package}/tests-spec-explicit - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: awkward-cpp-${{ env.AWKWARD_CPP_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: awkward-cpp + version: ${{ matrix.version }} + # The PyPI sdist contains rapidjson and its licence from awkward-cpp's submodule. + source: pypi-sdist + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + timeout-minutes: 180 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + # Override upstream's build-frontend = "build[uv]": cibuildwheel's + # audit step makes a venv on the host and asserts a host `uv` + # exists, which this self-hosted runner has none of (gotcha 13). + cibw-build-frontend: build + cibw-environment-linux: > + PIP_ONLY_BINARY=cmake,numpy + cibw-test-requires: pytest>=6 + cibw-test-sources: > + tests-cpu-kernels tests-cpu-kernels-explicit + tests-spec tests-spec-explicit + # Upstream's own test-command also runs {project}/tests, which is + # the parent `awkward` package's suite (imports `awkward`, not + # awkward_cpp) - out of scope here since we only build awkward-cpp + # and `awkward` has no riscv64 wheel of its own. + cibw-test-command: > + pytest {package}/tests-cpu-kernels {package}/tests-cpu-kernels-explicit + {package}/tests-spec {package}/tests-spec-explicit publish: name: Publish awkward-cpp ${{ matrix.version }} diff --git a/.github/workflows/build-bcrypt.yml b/.github/workflows/build-bcrypt.yml index f5b195019a5..a7e7af3e87d 100644 --- a/.github/workflows/build-bcrypt.yml +++ b/.github/workflows/build-bcrypt.yml @@ -49,147 +49,62 @@ jobs: package: bcrypt version: ${{ inputs.version }} - build_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - name: Build bcrypt ${{ matrix.version }} sdist - runs-on: ubuntu-latest - env: - BCRYPT_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout bcrypt ${{ env.BCRYPT_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: pyca/bcrypt - ref: ${{ env.BCRYPT_VERSION }} - persist-credentials: false - - - name: Install Python - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Build sdist - id: sdist - run: | - set -euo pipefail - rm -rf dist - uv pip install build twine - python -m build --sdist --outdir dist - twine check dist/* - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: bcrypt-${{ env.BCRYPT_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - # One cp312-abi3 wheel: cibuildwheel builds it once and reuses+tests it on # cp313/cp314 (find_compatible_wheel), so all three tags share one wheel. build_abi3: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' strategy: fail-fast: false matrix: version: ${{ fromJSON(needs.setup.outputs.versions) }} name: Build bcrypt ${{ matrix.version }} cp312-abi3-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 - env: - BCRYPT_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: bcrypt-${{ env.BCRYPT_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build and test wheel - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: 'cp312-* cp313-* cp314-*' - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # setuptools-rust emits abi3 only when bdist_wheel gets --py-limited-api - # (cibuildwheel won't); without this it's per-interpreter wheels, not abi3. - CIBW_CONFIG_SETTINGS: --build-option=--py-limited-api=${{ env.ABI3_FLOOR }} - # No Rust in the manylinux image; install it and put cargo on PATH. - CIBW_BEFORE_ALL_LINUX: >- - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin"' - # Upstream's suite; {package} is the extracted sdist dir (gotcha 5). - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: pytest -q {package}/tests - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: bcrypt-${{ env.BCRYPT_VERSION }}-cp312-abi3-manylinux_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: bcrypt + version: ${{ matrix.version }} + source: pypi-sdist + artifact-tag: cp312-abi3-manylinux_riscv64 + timeout-minutes: 90 + cibw-build: cp312-* cp313-* cp314-* + # setuptools-rust emits abi3 only when bdist_wheel gets --py-limited-api + # (cibuildwheel won't); without this it's per-interpreter wheels, not abi3. + cibw-config-settings: --build-option=--py-limited-api=cp312 + # No Rust in the manylinux image; install it and put cargo on PATH. + cibw-before-all-linux: > + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + cibw-environment-linux: PATH="$PATH:$HOME/.cargo/bin" + # Upstream's suite; {package} is the extracted sdist dir (gotcha 5). + cibw-test-requires: pytest + cibw-test-command: pytest -q {package}/tests # Free-threaded wheel: per-interpreter, no abi3 (pyo3 disables abi3 under # Py_GIL_DISABLED). Only cp314t - the riscv64 image has no cp313t interpreter. build_freethreaded: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' strategy: fail-fast: false matrix: version: ${{ fromJSON(needs.setup.outputs.versions) }} name: Build bcrypt ${{ matrix.version }} cp314t-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 - env: - BCRYPT_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: bcrypt-${{ env.BCRYPT_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build and test wheel - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: 'cp314t-*' # no --py-limited-api: abi3 has no free-threaded ABI - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_BEFORE_ALL_LINUX: >- - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin"' - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: pytest -q {package}/tests - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: bcrypt-${{ env.BCRYPT_VERSION }}-cp314t-manylinux_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: bcrypt + version: ${{ matrix.version }} + source: pypi-sdist + artifact-tag: cp314t-manylinux_riscv64 + timeout-minutes: 90 + cibw-build: cp314t-* + cibw-before-all-linux: > + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + cibw-environment-linux: PATH="$PATH:$HOME/.cargo/bin" + cibw-test-requires: pytest + cibw-test-command: pytest -q {package}/tests publish: name: Publish bcrypt ${{ matrix.version }} - needs: [setup, build_sdist, build_abi3, build_freethreaded] + needs: [setup, build_abi3, build_freethreaded] if: needs.setup.outputs.versions != '[]' strategy: fail-fast: false diff --git a/.github/workflows/build-boost-histogram.yml b/.github/workflows/build-boost-histogram.yml index ef9b650052a..9d27bee6150 100644 --- a/.github/workflows/build-boost-histogram.yml +++ b/.github/workflows/build-boost-histogram.yml @@ -45,63 +45,10 @@ jobs: package: boost-histogram version: ${{ inputs.version }} - build_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - # The sdist packages the source tree plus the vendored Boost.Histogram/Core/Mp11/ - # Config/ThrowException/Assert/Variant2 headers (git submodules) and a - # setuptools-scm-derived version. It's architecture-independent, so build it once - # on x86 instead of burning a scarce riscv runner (CLAUDE.md gotcha 4). - name: Build boost-histogram ${{ matrix.version }} sdist - runs-on: ubuntu-latest - permissions: - contents: read - env: - BOOST_HISTOGRAM_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout boost-histogram v${{ env.BOOST_HISTOGRAM_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: scikit-hep/boost-histogram - ref: v${{ env.BOOST_HISTOGRAM_VERSION }} - submodules: recursive - fetch-depth: 0 - fetch-tags: true - persist-credentials: false - - - name: Install Python - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Build sdist - id: sdist - run: | - uv pip install build twine - python -m build --sdist - twine check --strict dist/*.tar.gz - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: boost-histogram-${{ env.BOOST_HISTOGRAM_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build boost-histogram ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - permissions: - contents: read strategy: fail-fast: false matrix: @@ -117,51 +64,31 @@ jobs: - python: "cp314t" test_requires: "hypothesis==6.165.10" - env: - BOOST_HISTOGRAM_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: boost-histogram-${{ env.BOOST_HISTOGRAM_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_BUILD: ${{ matrix.python }}-* - CIBW_ARCHS: riscv64 - # numpy (a hard runtime dependency) ships no musllinux riscv64 wheel - # anywhere, so musllinux is dropped (workflow-anatomy.md: an accepted - # outcome). - CIBW_SKIP: '*-musllinux_*' - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # CIBW_ENVIRONMENT replaces, rather than merges into, upstream's own - # [tool.cibuildwheel] environment table (CLAUDE.md gotcha 107), so its - # four keys are repeated here alongside our registry. The test-install - # step resolves with uv, which only reads UV_* names, not PIP_* (CLAUDE.md - # gotcha 244), so both are set. - CIBW_ENVIRONMENT: >- - PIP_ONLY_BINARY=numpy - PIP_PREFER_BINARY=1 - UV_ONLY_BINARY=numpy - UV_PREFER_BINARY=1 - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - UV_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - UV_INDEX_STRATEGY=unsafe-best-match - CIBW_TEST_REQUIRES: ${{ matrix.test_requires }} - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: boost-histogram-${{ env.BOOST_HISTOGRAM_VERSION }}-${{ matrix.python }}-manylinux_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: boost-histogram + version: ${{ matrix.version }} + # The PyPI sdist contains the vendored Boost.Histogram/Core/Mp11 headers. + source: pypi-sdist + artifact-tag: ${{ matrix.python }}-manylinux_riscv64 + cibw-build: ${{ matrix.python }}-* + # numpy (a hard runtime dependency) ships no musllinux riscv64 wheel + # anywhere, so musllinux is dropped (workflow-anatomy.md: an accepted + # outcome). + cibw-skip: "*-musllinux_*" + # CIBW_ENVIRONMENT replaces, rather than merges into, upstream's own + # [tool.cibuildwheel] environment table (CLAUDE.md gotcha 107), so its + # four keys are repeated here alongside our registry. The test-install + # step resolves with uv, which only reads UV_* names, not PIP_* (CLAUDE.md + # gotcha 244), so both are set. + cibw-environment-linux: > + PIP_ONLY_BINARY=numpy + PIP_PREFER_BINARY=1 + UV_ONLY_BINARY=numpy + UV_PREFER_BINARY=1 + UV_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + UV_INDEX_STRATEGY=unsafe-best-match + cibw-test-requires: ${{ matrix.test_requires }} publish: name: Publish boost-histogram ${{ matrix.version }} diff --git a/.github/workflows/build-correctionlib.yml b/.github/workflows/build-correctionlib.yml index 0861b56b13a..99ae9b85c6f 100644 --- a/.github/workflows/build-correctionlib.yml +++ b/.github/workflows/build-correctionlib.yml @@ -45,63 +45,10 @@ jobs: package: correctionlib version: ${{ inputs.version }} - build_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - # The sdist is architecture-independent: it just packages the source tree - # and the vendored submodules (pybind11, rapidjson, cpp-peglib, pcg-cpp, - # xxhash, lwtnn) plus a setuptools-scm-derived version.py. Build it once on - # x86 instead of burning a scarce riscv runner (CLAUDE.md gotcha 4). - name: Build correctionlib ${{ matrix.version }} sdist - runs-on: ubuntu-latest - permissions: - contents: read - env: - CORRECTIONLIB_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout correctionlib v${{ env.CORRECTIONLIB_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: cms-nanoAOD/correctionlib - ref: v${{ env.CORRECTIONLIB_VERSION }} - submodules: recursive - fetch-depth: 0 - fetch-tags: true - persist-credentials: false - - - name: Install Python - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Build sdist - id: sdist - run: | - uv pip install build twine - python -m build --sdist - twine check dist/* - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: correctionlib-${{ env.CORRECTIONLIB_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build correctionlib ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - permissions: - contents: read strategy: fail-fast: false matrix: @@ -116,70 +63,50 @@ jobs: - python: "cp314t" test_skip: "*" - env: - CORRECTIONLIB_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: correctionlib-${{ env.CORRECTIONLIB_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_BUILD: ${{ matrix.python }}-* - CIBW_ARCHS: riscv64 - # numpy (a hard runtime dependency) ships no musllinux riscv64 wheel - # anywhere, so musllinux is dropped (workflow-anatomy.md: an accepted - # outcome). - CIBW_SKIP: '*-musllinux_*' - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_ENVIRONMENT: >- - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - PIP_ONLY_BINARY=:all: - CIBW_TEST_SKIP: ${{ matrix.test_skip }} - # CIBW_TEST_REQUIRES adds to, not replaces, the pyproject `test-groups` - # dependency group, so it has to be cleared here (empty string wins - # over the inherited value, same as CIBW_BEFORE_BUILD: ''). - CIBW_TEST_GROUPS: '' - # Same list as upstream's `test` dependency-group minus uproot (which - # no test here actually imports) and awkward/dask-awkward (both need - # awkward-cpp, which has no riscv64 wheel published yet - still in - # flight as its own port). Drop the two test files that hard-import - # awkward at module scope so collection doesn't fail. - CIBW_TEST_REQUIRES: >- - pandas requests scipy "pytest>=6.0" pytest-run-parallel - pytest-benchmark - # test_lwtnn_example asserts an exact float equality on the output of a - # lwtnn (Eigen-based) neural-network evaluation; it diverges from riscv64 - # starting at the 15th significant digit (0.9518682535564676 vs the - # asserted 0.95186825355646787, ~3e-16 relative, i.e. a couple of ULP) - - # an architecture float-rounding difference in the vectorized matmul, not - # a functional bug (CLAUDE.md gotcha 304). Upstream hit the identical - # failure on manylinux_aarch64 and deselected it there too (see upstream - # PR cms-nanoAOD/correctionlib#348), confirming the mechanism is - # architecture-generic, not riscv64-specific. - # A path-based --deselect here silently no-ops (gotcha 14/283): pytest is - # invoked from a staged copy, so its own rootdir-relative nodeids don't - # match the {package}-prefixed absolute-style path. Use -k instead. - CIBW_TEST_COMMAND: >- - pytest {package}/tests - --ignore {package}/tests/test_highlevel.py - --ignore {package}/tests/test_issue296.py - -k "not test_lwtnn_example" - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: correctionlib-${{ env.CORRECTIONLIB_VERSION }}-${{ matrix.python }}-manylinux_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: correctionlib + version: ${{ matrix.version }} + # The PyPI sdist contains the vendored pybind11, rapidjson, cpp-peglib, pcg-cpp, xxhash and lwtnn sources. + source: pypi-sdist + artifact-tag: ${{ matrix.python }}-manylinux_riscv64 + cibw-build: ${{ matrix.python }}-* + # numpy (a hard runtime dependency) ships no musllinux riscv64 wheel + # anywhere, so musllinux is dropped (workflow-anatomy.md: an accepted + # outcome). + cibw-skip: "*-musllinux_*" + cibw-environment-linux: > + PIP_ONLY_BINARY=:all: + cibw-test-skip: ${{ matrix.test_skip }} + # CIBW_TEST_REQUIRES adds to, not replaces, the pyproject `test-groups` + # dependency group, so it has to be cleared here (empty string wins + # over the inherited value, same as CIBW_BEFORE_BUILD: ''). + cibw-test-groups: '' + # Same list as upstream's `test` dependency-group minus uproot (which + # no test here actually imports) and awkward/dask-awkward (both need + # awkward-cpp, which has no riscv64 wheel published yet - still in + # flight as its own port). Drop the two test files that hard-import + # awkward at module scope so collection doesn't fail. + cibw-test-requires: > + pandas requests scipy "pytest>=6.0" pytest-run-parallel + pytest-benchmark + # test_lwtnn_example asserts an exact float equality on the output of a + # lwtnn (Eigen-based) neural-network evaluation; it diverges from riscv64 + # starting at the 15th significant digit (0.9518682535564676 vs the + # asserted 0.95186825355646787, ~3e-16 relative, i.e. a couple of ULP) - + # an architecture float-rounding difference in the vectorized matmul, not + # a functional bug (CLAUDE.md gotcha 304). Upstream hit the identical + # failure on manylinux_aarch64 and deselected it there too (see upstream + # PR cms-nanoAOD/correctionlib#348), confirming the mechanism is + # architecture-generic, not riscv64-specific. + # A path-based --deselect here silently no-ops (gotcha 14/283): pytest is + # invoked from a staged copy, so its own rootdir-relative nodeids don't + # match the {package}-prefixed absolute-style path. Use -k instead. + cibw-test-command: > + pytest {package}/tests + --ignore {package}/tests/test_highlevel.py + --ignore {package}/tests/test_issue296.py + -k "not test_lwtnn_example" publish: name: Publish correctionlib ${{ matrix.version }} diff --git a/.github/workflows/build-cydifflib.yml b/.github/workflows/build-cydifflib.yml index 30bd1bf6f65..67c39157230 100644 --- a/.github/workflows/build-cydifflib.yml +++ b/.github/workflows/build-cydifflib.yml @@ -45,97 +45,33 @@ jobs: package: cydifflib version: ${{ inputs.version }} - build_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - name: Build cydifflib ${{ matrix.version }} sdist - runs-on: ubuntu-latest - env: - CYDIFFLIB_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout CyDifflib v${{ env.CYDIFFLIB_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: rapidfuzz/CyDifflib - ref: v${{ env.CYDIFFLIB_VERSION }} - persist-credentials: false - - - name: Install Python - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Build sdist - id: sdist - run: | - uv pip install "Cython>=3.1.6,<3.3.0" build twine - chmod +x ./src/cydifflib/generate.sh - ./src/cydifflib/generate.sh - git apply ./tools/sdist.patch - python -m build --sdist - twine check dist/* - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: cydifflib-${{ env.CYDIFFLIB_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build cydifflib ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - CYDIFFLIB_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: cydifflib-${{ env.CYDIFFLIB_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - # Upstream feeds cibuildwheel the sdist tarball too: it bundles the - # cythonised .cxx, so the wheel build needs no Cython. - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # Matches upstream's own build.yml CIBW_TEST_REQUIRES/CIBW_TEST_COMMAND; - # cydifflib carries no [tool.cibuildwheel] table of its own. - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: pytest {package}/tests - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: cydifflib-${{ matrix.version }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + # Upstream feeds cibuildwheel the sdist tarball too: it bundles the + # cythonised .cxx, so the wheel build needs no Cython. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: cydifflib + version: ${{ matrix.version }} + source: pypi-sdist + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + timeout-minutes: 90 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + # Matches upstream's own build.yml CIBW_TEST_REQUIRES/CIBW_TEST_COMMAND; + # cydifflib carries no [tool.cibuildwheel] table of its own. + cibw-test-requires: pytest + cibw-test-command: pytest {package}/tests publish: name: Publish cydifflib ${{ matrix.version }} - needs: [setup, build_sdist, build_wheels] + needs: [setup, build_wheels] if: needs.setup.outputs.versions != '[]' strategy: fail-fast: false diff --git a/.github/workflows/build-dimod.yml b/.github/workflows/build-dimod.yml index bc3047125ec..44072813bff 100644 --- a/.github/workflows/build-dimod.yml +++ b/.github/workflows/build-dimod.yml @@ -48,138 +48,51 @@ jobs: package: dimod version: ${{ inputs.version }} - build_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - # The sdist packages the source tree plus the vendored filereaderlp sources (checked - # in, not a submodule). It's architecture-independent, so build it once on x86 instead - # of burning a scarce riscv runner (CLAUDE.md gotcha 4). - name: Build dimod ${{ matrix.version }} sdist - runs-on: ubuntu-latest - permissions: - contents: read - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - env: - DIMOD_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout dimod v${{ env.DIMOD_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: dwavesystems/dimod - ref: ${{ env.DIMOD_VERSION }} - path: dimod - persist-credentials: false - - - name: Checkout python-wheels - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - path: python-wheels - persist-credentials: false - - - name: Apply patches - working-directory: dimod - run: | - git apply -v ../python-wheels/patches/dimod/${{ env.DIMOD_VERSION }}/*.patch - # From 0.12.23 the build backend is meson-python, whose sdist is cut by - # `meson dist` from the committed tree, so the patched files must be committed. - git add -A - git -c user.name=ci -c user.email=ci@invalid commit -q -m "python-wheels patches" - - - name: Install Python - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Build sdist - working-directory: dimod - run: | - uv pip install build twine - python -m build --sdist - twine check --strict dist/*.tar.gz - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: dimod-${{ env.DIMOD_VERSION }}-sdist - path: dimod/dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build dimod ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - permissions: - contents: read strategy: fail-fast: false matrix: # pandas, a tests/requirements.txt dependency, has no riscv64 cp314t wheel yet. include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - DIMOD_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: dimod-${{ env.DIMOD_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_BUILD: ${{ matrix.python }}-* - CIBW_ARCHS: riscv64 - # Upstream itself skips musllinux (`skip = "pp* *musllinux*"` in pyproject.toml); - # CIBW_BUILD overrides that config wholesale, so repeat the musllinux skip here. - CIBW_SKIP: '*-musllinux_*' - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_ENVIRONMENT: >- - PIP_ONLY_BINARY=numpy - PIP_PREFER_BINARY=1 - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - UV_ONLY_BINARY=numpy - UV_PREFER_BINARY=1 - UV_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - UV_INDEX_STRATEGY=unsafe-best-match - CIBW_TEST_SKIP: ${{ case(endsWith(matrix.python, 't'), '*', '') }} - - - name: Check the Cython extensions made it into the wheel - run: | - python3 - wheelhouse/*.whl <<'EOF' - import sys, zipfile - expected = { - "dimod/binary/cybqm/cybqm_float32", "dimod/binary/cybqm/cybqm_float64", - "dimod/constrained/cyconstrained", "dimod/constrained/cyexpression", - "dimod/cylp", "dimod/cyqmbase/cyqmbase_float32", "dimod/cyqmbase/cyqmbase_float64", - "dimod/cyutilities", "dimod/cyvariables", "dimod/discrete/cydiscrete_quadratic_model", - "dimod/quadratic/cyqm/cyqm_float32", "dimod/quadratic/cyqm/cyqm_float64", - } - for whl in sys.argv[1:]: - names = zipfile.ZipFile(whl).namelist() - got = {n.split(".", 1)[0] for n in names if n.endswith(".so")} - assert got == expected, f"{whl}: got {got}, expected {expected}" - print(whl, "ok") - EOF - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: dimod-${{ env.DIMOD_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: dimod + version: ${{ matrix.version }} + source: pypi-sdist + patches: true + post-build: |- + python3 - $GITHUB_WORKSPACE/wheelhouse/*.whl <<'EOF' + import sys, zipfile + expected = { + "dimod/binary/cybqm/cybqm_float32", "dimod/binary/cybqm/cybqm_float64", + "dimod/constrained/cyconstrained", "dimod/constrained/cyexpression", + "dimod/cylp", "dimod/cyqmbase/cyqmbase_float32", "dimod/cyqmbase/cyqmbase_float64", + "dimod/cyutilities", "dimod/cyvariables", "dimod/discrete/cydiscrete_quadratic_model", + "dimod/quadratic/cyqm/cyqm_float32", "dimod/quadratic/cyqm/cyqm_float64", + } + for whl in sys.argv[1:]: + names = zipfile.ZipFile(whl).namelist() + got = {n.split(".", 1)[0] for n in names if n.endswith(".so")} + assert got == expected, f"{whl}: got {got}, expected {expected}" + print(whl, "ok") + EOF + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-build: ${{ matrix.python }}-* + # Upstream itself skips musllinux (`skip = "pp* *musllinux*"` in pyproject.toml); + # CIBW_BUILD overrides that config wholesale, so repeat the musllinux skip here. + cibw-skip: "*-musllinux_*" + cibw-environment-linux: > + PIP_ONLY_BINARY=numpy + PIP_PREFER_BINARY=1 + UV_ONLY_BINARY=numpy + UV_PREFER_BINARY=1 + UV_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + UV_INDEX_STRATEGY=unsafe-best-match + cibw-test-skip: ${{ case(endsWith(matrix.python, 't'), '*', '') }} publish: name: Publish dimod ${{ matrix.version }} diff --git a/.github/workflows/build-fabio.yml b/.github/workflows/build-fabio.yml index 1070356c8ed..3088783513b 100644 --- a/.github/workflows/build-fabio.yml +++ b/.github/workflows/build-fabio.yml @@ -45,111 +45,41 @@ jobs: package: fabio version: ${{ inputs.version }} - build_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - name: Build fabio ${{ matrix.version }} sdist - runs-on: ubuntu-latest - env: - FABIO_VERSION: ${{ matrix.version }} - - steps: - # Upstream's tags are not PEP 440 (v2026.06 ships as 2026.6.0). - - id: tag - run: | - case "$FABIO_VERSION" in - 2026.6.0) echo "ref=v2026.06" ;; - *) echo "ref=v$FABIO_VERSION" ;; - esac >> "$GITHUB_OUTPUT" - - - name: Checkout fabio ${{ steps.tag.outputs.ref }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: silx-kit/fabio - ref: ${{ steps.tag.outputs.ref }} - persist-credentials: false - - - name: Install Python - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Build sdist - id: sdist - run: | - uv pip install build twine - python -m build --sdist - twine check dist/* - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: fabio-${{ env.FABIO_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build fabio ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - FABIO_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: fabio-${{ env.FABIO_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_ENVIRONMENT_LINUX: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - # hdf5plugin (a hard runtime dep) has no riscv64 wheel and its sdist - # vendors a large set of its own compression libraries - a separate - # port in its own right. Keep the wheel install bare and pre-install - # what the test suite actually exercises instead (gotcha 122). - CIBW_TEST_ENVIRONMENT: PIP_NO_DEPS=1 - CIBW_BEFORE_TEST_LINUX: >- - PIP_NO_DEPS=0 PIP_ONLY_BINARY=numpy,h5py,lxml,pillow pip install numpy h5py lxml pillow filelock - # fabio.test.test_import unconditionally imports every module, - # including fabio/qt/dialogs.py, which needs a real Qt binding - # (PySide6/PyQt); none publish a riscv64 wheel anywhere. Skip that - # one module - test_all.suite() picks up test_import by name, so - # stubbing its suite() before building the suite drops just it. - CIBW_TEST_COMMAND: >- - python3 -c "import sys, unittest; from fabio.test import test_all, test_import; test_import.suite = lambda: unittest.TestSuite(); r = unittest.TextTestRunner().run(test_all.suite()); sys.exit(0 if r.wasSuccessful() else 1)" - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: fabio-${{ matrix.version }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: fabio + version: ${{ matrix.version }} + source: pypi-sdist + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + timeout-minutes: 90 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + # hdf5plugin (a hard runtime dep) has no riscv64 wheel and its sdist + # vendors a large set of its own compression libraries - a separate + # port in its own right. Keep the wheel install bare and pre-install + # what the test suite actually exercises instead (gotcha 122). + cibw-test-environment: PIP_NO_DEPS=1 + cibw-before-test-linux: > + PIP_NO_DEPS=0 PIP_ONLY_BINARY=numpy,h5py,lxml,pillow pip install numpy h5py lxml pillow filelock + # fabio.test.test_import unconditionally imports every module, + # including fabio/qt/dialogs.py, which needs a real Qt binding + # (PySide6/PyQt); none publish a riscv64 wheel anywhere. Skip that + # one module - test_all.suite() picks up test_import by name, so + # stubbing its suite() before building the suite drops just it. + cibw-test-command: > + python3 -c "import sys, unittest; from fabio.test import test_all, test_import; test_import.suite = lambda: unittest.TestSuite(); r = unittest.TextTestRunner().run(test_all.suite()); sys.exit(0 if r.wasSuccessful() else 1)" publish: name: Publish fabio ${{ matrix.version }} - needs: [setup, build_sdist, build_wheels] + needs: [setup, build_wheels] if: needs.setup.outputs.versions != '[]' strategy: fail-fast: false diff --git a/.github/workflows/build-gpiod.yml b/.github/workflows/build-gpiod.yml index 26441d5137a..cd184e7a945 100644 --- a/.github/workflows/build-gpiod.yml +++ b/.github/workflows/build-gpiod.yml @@ -49,121 +49,48 @@ jobs: package: gpiod version: ${{ inputs.version }} - python_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - # Upstream's own generate_pypi_artifacts.sh builds the sdist with - # LIBGPIOD_VERSION set, then feeds *that* sdist to cibuildwheel. Doing the - # same matters: setup.py's fetch_tarball wrapper only skips its - # post-build cleanup (which deletes LICENSE/lib/include again) when - # libgpiod-version.txt is already present and matches -- true for a wheel - # built from this sdist, false for a wheel built straight from a checkout. - runs-on: ubuntu-24.04-riscv - env: - GPIOD_VERSION: ${{ matrix.version }} - - steps: - # The Python bindings live in git.kernel.org/libgpiod, tagged - # python-v; that tag isn't mirrored to github.com/brgl/libgpiod, - # so actions/checkout can't reach it. - - name: Checkout gpiod python-v${{ env.GPIOD_VERSION }} - run: | - git clone --depth 1 --branch "python-v${{ env.GPIOD_VERSION }}" \ - https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git gpiod-src - - - name: setup uv - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: build sdist - id: build_sdist - working-directory: gpiod-src/bindings/python - env: - LIBGPIOD_VERSION: ${{ env.LIBGPIOD_VERSION }} - run: | - rm -rf dist/ - uv pip install build packaging - python -m build --sdist - - - name: upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: gpiod-${{ env.GPIOD_VERSION }}-sdist - path: gpiod-src/bindings/python/dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, python_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build gpiod ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - GPIOD_VERSION: ${{ matrix.version }} - - steps: - - name: fetch sdist artifact - id: fetch_sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: gpiod-${{ env.GPIOD_VERSION }}-sdist - - - id: sdist_path - run: echo "path=$(echo "${{ steps.fetch_sdist.outputs.download-path }}"/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - # cibuildwheel accepts an sdist tarball directly and extracts it. - package-dir: ${{ steps.sdist_path.outputs.path }} - output-dir: wheelhouse/ - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_MUSLLINUX_RISCV64_IMAGE: ${{ env.MUSLLINUX_RISCV64_IMAGE }} - # lib/uapi/gpio.h pulls in the system linux/const.h,linux/ioctl.h, - # linux/types.h; musllinux's Alpine base needs linux-headers for - # those, manylinux already has them via glibc-devel. - CIBW_BEFORE_ALL_LINUX: (command -v apk && apk add linux-headers) || true - # Upstream's own generate_pypi_artifacts.sh builds wheels with no test - # step at all: the real test suite needs a gpio-sim kernel module and - # the separately-built libgpiosim helper library (tests/gpiosim/, - # tests/system/), neither available in the build container. Exercise - # the compiled extension and the real chip-open/ioctl error path instead. - CIBW_TEST_COMMAND: | - python3 - <<'PYEOF' - import gpiod - from gpiod import _ext - assert _ext.__file__.endswith(".so"), _ext.__file__ - assert gpiod.__version__ == "${{ env.GPIOD_VERSION }}", gpiod.__version__ - assert gpiod.api_version == "${{ env.LIBGPIOD_VERSION }}", gpiod.api_version - try: - gpiod.Chip("/dev/null") - except OSError: - pass - else: - raise SystemExit("expected OSError for a non-gpiochip device") - PYEOF - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: gpiod-${{ env.GPIOD_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error - + # The reusable workflow downloads and extracts the self-contained PyPI sdist. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: gpiod + version: ${{ matrix.version }} + # The PyPI sdist contains libgpiod-version.txt, so setup.py retains the bundled headers and library. + source: pypi-sdist + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-musllinux-riscv64-image: quay.io/pypa/musllinux_1_2_riscv64 + # lib/uapi/gpio.h pulls in the system linux/const.h,linux/ioctl.h, + # linux/types.h; musllinux's Alpine base needs linux-headers for + # those, manylinux already has them via glibc-devel. + cibw-before-all-linux: (command -v apk && apk add linux-headers) || true + # Upstream's own generate_pypi_artifacts.sh builds wheels with no test + # step at all: the real test suite needs a gpio-sim kernel module and + # the separately-built libgpiosim helper library (tests/gpiosim/, + # tests/system/), neither available in the build container. Exercise + # the compiled extension and the real chip-open/ioctl error path instead. + cibw-test-command: |- + python3 - <<'PYEOF' + import gpiod + from gpiod import _ext + assert _ext.__file__.endswith(".so"), _ext.__file__ + assert gpiod.__version__ == "${{ matrix.version }}", gpiod.__version__ + assert gpiod.api_version == "${{ inputs.libgpiod_version || '2.3' }}", gpiod.api_version + try: + gpiod.Chip("/dev/null") + except OSError: + pass + else: + raise SystemExit("expected OSError for a non-gpiochip device") + PYEOF publish: name: Publish gpiod ${{ matrix.version }} needs: [setup, build_wheels] diff --git a/.github/workflows/build-igwn-ligolw.yml b/.github/workflows/build-igwn-ligolw.yml index 50d051dde05..0fb3641c330 100644 --- a/.github/workflows/build-igwn-ligolw.yml +++ b/.github/workflows/build-igwn-ligolw.yml @@ -44,90 +44,31 @@ jobs: package: igwn-ligolw version: ${{ inputs.version }} - python_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - runs-on: ubuntu-latest - env: - IGWN_LIGOLW_VERSION: ${{ matrix.version }} - - steps: - # The repo lives on git.ligo.org, not GitHub, so actions/checkout can't - # reach it. - - name: Checkout igwn-ligolw v${{ env.IGWN_LIGOLW_VERSION }} - run: | - git clone --depth 1 --branch "v${{ env.IGWN_LIGOLW_VERSION }}" \ - https://git.ligo.org/computing/software/igwn-ligolw.git igwn-ligolw-src - - - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Build sdist - working-directory: igwn-ligolw-src - run: | - uv pip install build - python -m build --sdist - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: igwn-ligolw-${{ env.IGWN_LIGOLW_VERSION }}-sdist - path: igwn-ligolw-src/dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, python_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build igwn-ligolw ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - IGWN_LIGOLW_VERSION: ${{ matrix.version }} - - steps: - - name: fetch sdist artifact - id: fetch_sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: igwn-ligolw-${{ env.IGWN_LIGOLW_VERSION }}-sdist - - - id: sdist_path - run: echo "path=$(echo "${{ steps.fetch_sdist.outputs.download-path }}"/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - # cibuildwheel accepts an sdist tarball directly and extracts it. - package-dir: ${{ steps.sdist_path.outputs.path }} - output-dir: wheelhouse/ - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # numpy has no riscv64 wheel on public PyPI. - CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ PIP_ONLY_BINARY=numpy - CIBW_TEST_REQUIRES: pytest pytest-benchmark pytest-doctestplus - CIBW_TEST_SOURCES: test - # test_dtt needs lalsuite's LIGOTimeGPS type, which has no riscv64 - # build anywhere; the rest of the suite (and the tokenizer C - # extension it covers) needs no optional dependency. - CIBW_TEST_COMMAND: pytest test --deselect test/test_array.py::test_dtt - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: igwn-ligolw-${{ env.IGWN_LIGOLW_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # The reusable workflow downloads and extracts the self-contained PyPI sdist. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: igwn-ligolw + version: ${{ matrix.version }} + source: pypi-sdist + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + # numpy has no riscv64 wheel on public PyPI. + cibw-environment-linux: PIP_ONLY_BINARY=numpy + cibw-test-requires: pytest pytest-benchmark pytest-doctestplus + cibw-test-sources: test + # test_dtt needs lalsuite's LIGOTimeGPS type, which has no riscv64 + # build anywhere; the rest of the suite (and the tokenizer C + # extension it covers) needs no optional dependency. + cibw-test-command: pytest test --deselect test/test_array.py::test_dtt publish: name: Publish igwn-ligolw ${{ matrix.version }} diff --git a/.github/workflows/build-igwn-segments.yml b/.github/workflows/build-igwn-segments.yml index 0c6f6e96c93..e54e0dbabb3 100644 --- a/.github/workflows/build-igwn-segments.yml +++ b/.github/workflows/build-igwn-segments.yml @@ -45,86 +45,27 @@ jobs: package: igwn-segments version: ${{ inputs.version }} - python_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - runs-on: ubuntu-latest - env: - IGWN_SEGMENTS_VERSION: ${{ matrix.version }} - - steps: - # The repo lives on git.ligo.org, not GitHub, so actions/checkout can't - # reach it. - - name: Checkout igwn-segments v${{ env.IGWN_SEGMENTS_VERSION }} - run: | - git clone --depth 1 --branch "v${{ env.IGWN_SEGMENTS_VERSION }}" \ - https://git.ligo.org/computing/software/igwn-segments.git igwn-segments-src - - - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Build sdist - working-directory: igwn-segments-src - run: | - uv pip install build - python -m build --sdist - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: igwn-segments-${{ env.IGWN_SEGMENTS_VERSION }}-sdist - path: igwn-segments-src/dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, python_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build igwn-segments ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - IGWN_SEGMENTS_VERSION: ${{ matrix.version }} - - steps: - - name: fetch sdist artifact - id: fetch_sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: igwn-segments-${{ env.IGWN_SEGMENTS_VERSION }}-sdist - - - id: sdist_path - run: echo "path=$(echo "${{ steps.fetch_sdist.outputs.download-path }}"/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - # cibuildwheel accepts an sdist tarball directly and extracts it. - package-dir: ${{ steps.sdist_path.outputs.path }} - output-dir: wheelhouse/ - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_MUSLLINUX_RISCV64_IMAGE: ${{ env.MUSLLINUX_RISCV64_IMAGE }} - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_SOURCES: test - CIBW_TEST_COMMAND: pytest test - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: igwn-segments-${{ env.IGWN_SEGMENTS_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # The reusable workflow downloads and extracts the self-contained PyPI sdist. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: igwn-segments + version: ${{ matrix.version }} + source: pypi-sdist + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-musllinux-riscv64-image: quay.io/pypa/musllinux_1_2_riscv64 + cibw-test-requires: pytest + cibw-test-sources: test + cibw-test-command: pytest test publish: name: Publish igwn-segments ${{ matrix.version }} diff --git a/.github/workflows/build-iminuit.yml b/.github/workflows/build-iminuit.yml index 38ec7fde260..4c282cd5aa3 100644 --- a/.github/workflows/build-iminuit.yml +++ b/.github/workflows/build-iminuit.yml @@ -45,122 +45,43 @@ jobs: package: iminuit version: ${{ inputs.version }} - build_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - # The sdist packages the iminuit wrapper plus the vendored MINUIT2/mathcore - # sources pulled from the extern/root submodule; it's architecture-independent, - # so build it once on x86 instead of burning a scarce riscv runner (CLAUDE.md - # gotcha 4). - name: Build iminuit ${{ matrix.version }} sdist - runs-on: ubuntu-latest - env: - IMINUIT_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout iminuit v${{ env.IMINUIT_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: scikit-hep/iminuit - ref: v${{ env.IMINUIT_VERSION }} - submodules: true - persist-credentials: false - - - name: Checkout python-wheels - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - path: python-wheels - persist-credentials: false - - - name: Install Python - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - # extern/root/LICENSE (LGPL v2.1, the MINUIT2 sources' own license) is - # never packaged: sdist.exclude drops extern/root wholesale and - # sdist.include only re-adds the compiled sources, not the license - # text (CLAUDE.md gotcha 32/123 shape). - - name: Patch iminuit source - run: git apply python-wheels/patches/iminuit/${{ env.IMINUIT_VERSION }}/00*.patch - - - name: Build sdist - id: sdist - run: | - uv pip install build twine - python -m build --sdist - twine check dist/* - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: iminuit-${{ env.IMINUIT_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build iminuit ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - IMINUIT_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: iminuit-${{ env.IMINUIT_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # CIBW_ENVIRONMENT replaces, rather than merges into, upstream's own - # [tool.cibuildwheel.environment] table (CLAUDE.md gotcha 107), so its - # two keys are repeated here alongside our registry for numpy (a - # runtime dependency numpy ships no riscv64 wheel for on PyPI itself). - CIBW_ENVIRONMENT: >- - PIP_ONLY_BINARY=:all: - UV_ONLY_BINARY=:all: - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - UV_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - UV_INDEX_STRATEGY=unsafe-best-match - # Upstream's own test-requires/test-command (pytest only) come from - # the sdist's pyproject.toml; only the licence assertion is ours. - CIBW_TEST_COMMAND: >- - python -c "import importlib.metadata as m; l = sorted(str(p).rsplit('/', 1)[-1] for p in m.files('iminuit') if '.dist-info/licenses/' in str(p)); assert l == ['LICENSE', 'LICENSE.minuit2'], l" - && python -m pytest {package}/tests - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: iminuit-${{ matrix.version }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: iminuit + version: ${{ matrix.version }} + # The PyPI sdist contains the vendored MINUIT2 sources; the patches add their missing LGPL text. + source: pypi-sdist + patches: true + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + timeout-minutes: 90 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + # CIBW_ENVIRONMENT replaces, rather than merges into, upstream's own + # [tool.cibuildwheel.environment] table (CLAUDE.md gotcha 107), so its + # two keys are repeated here alongside our registry for numpy (a + # runtime dependency numpy ships no riscv64 wheel for on PyPI itself). + cibw-environment-linux: > + PIP_ONLY_BINARY=:all: + UV_ONLY_BINARY=:all: + UV_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + UV_INDEX_STRATEGY=unsafe-best-match + # Upstream's own test-requires/test-command (pytest only) come from + # the sdist's pyproject.toml; only the licence assertion is ours. + cibw-test-command: > + python -c "import importlib.metadata as m; l = sorted(str(p).rsplit('/', 1)[-1] for p in m.files('iminuit') if '.dist-info/licenses/' in str(p)); assert l == ['LICENSE', 'LICENSE.minuit2'], l" + && python -m pytest {package}/tests publish: name: Publish iminuit ${{ matrix.version }} - needs: [setup, build_sdist, build_wheels] + needs: [setup, build_wheels] if: needs.setup.outputs.versions != '[]' strategy: fail-fast: false diff --git a/.github/workflows/build-leptris.yml b/.github/workflows/build-leptris.yml index ead312d4bbc..db55e5b65b6 100644 --- a/.github/workflows/build-leptris.yml +++ b/.github/workflows/build-leptris.yml @@ -53,88 +53,10 @@ jobs: package: leptris version: ${{ inputs.version }} - sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - runs-on: ubuntu-latest - env: - LEPTRIS_VERSION: ${{ matrix.version }} - - steps: - # libleptris tags as v, one component short of the wheel - # version's trailing iteration digit (libleptris-version.txt / family - # law), same mapping build-teptris.yml uses for libteptris. - - id: tag - run: echo "libleptris_ref=v${LEPTRIS_VERSION%.*}" >> "$GITHUB_OUTPUT" - - - name: Checkout leptris-py @ ${{ env.LEPTRIS_PY_REF }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: leptris/leptris-py - ref: ${{ env.LEPTRIS_PY_REF }} - persist-credentials: false - - - name: Checkout libleptris ${{ steps.tag.outputs.libleptris_ref }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: leptris/leptris - ref: ${{ steps.tag.outputs.libleptris_ref }} - path: libleptris-src - persist-credentials: false - - # Mirrors scripts/prepare_sdist_vendor.sh: the pinned engine release, - # grafted under vendor/ (MANIFEST.in's `graft vendor/libleptris`) so - # setup.py's self-contained mode cmake-builds it at install time on - # any platform with a C compiler + cmake - no CIBW_BEFORE_ALL archive, - # no PGO (that is upstream's own release pipeline only). - - name: Vendor libleptris into the sdist - run: | - set -eux - mkdir -p vendor/libleptris - cp -R libleptris-src/. vendor/libleptris/ - rm -rf vendor/libleptris/.git - - - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Build sdist - run: | - uv pip install build - python -m build --sdist - - - name: Self-test the sdist - run: | - uv venv /tmp/sdt - uv pip install --python /tmp/sdt/bin/python "$PWD"/dist/*.tar.gz - cd /tmp - /tmp/sdt/bin/python -c ' - import leptris - root = leptris.fromstring("") - assert root.tag == "a" - assert root[0].get("id") == "1" - assert root.xpath("count(//b)") == 1.0 - print("sdist self-test OK") - ' - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: leptris-${{ env.LEPTRIS_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build leptris ${{ matrix.version }} ${{ matrix.tag }}-${{ matrix.libc }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 strategy: fail-fast: false matrix: @@ -147,80 +69,61 @@ jobs: - tag: cp314t build: cp314t - env: - LEPTRIS_VERSION: ${{ matrix.version }} - - steps: - - name: Fetch sdist artifact - id: fetch_sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: leptris-${{ env.LEPTRIS_VERSION }}-sdist - - - id: sdist_path - run: echo "path=$(echo ${{ steps.fetch_sdist.outputs.download-path }}/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - output-dir: wheelhouse/ - only: ${{ matrix.build }}-${{ matrix.libc }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_MUSLLINUX_RISCV64_IMAGE: ${{ env.MUSLLINUX_RISCV64_IMAGE }} - # setup.py's build_with_engine command cmake-builds vendor/libleptris - # into leptris/_vendor/ itself (the sdist's zero-setup source-install - # path - no LEPTRIS_LIB_PATH, no prebuilt archive); it only needs - # cmake on PATH. The engine SOURCE + licence are staged under - # leptris/_vendor/engine/ beside it so the wheel carries both, same - # layout scripts/vendor_libleptris.sh produces for upstream's own - # wheels (pyproject.toml's package-data globs already expect it). - # tests/test_packaging.py's TestVendoredLayout also requires the - # top-level engine/CMakeLists.txt (not just src/'s own nested one) - # and a _vendor/README.md rebuild note - both are what - # vendor_libleptris.sh stages for upstream's own wheels. - CIBW_BEFORE_BUILD: >- - pip install cmake && - mkdir -p leptris/_vendor/engine && - cp vendor/libleptris/CMakeLists.txt leptris/_vendor/engine/CMakeLists.txt && - cp -r vendor/libleptris/src leptris/_vendor/engine/src && - cp -r vendor/libleptris/cmake leptris/_vendor/engine/cmake && - cp vendor/libleptris/LICENSE.md leptris/_vendor/engine/LICENSE.md && - echo "libleptris is vendored here; see engine/ for its source and CMakeLists.txt to rebuild." > leptris/_vendor/README.md - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: pytest {project}/tests -q - # cp39-abi3's _leptrisaccel.abi3.so calls PyObject_CallNoArgs, a - # real CPython API function that was only added to the LIMITED - # (abi3) API in 3.10 - cibuildwheel's default - # abi3audit --strict flags that as a baseline/computed mismatch - # against our cp39 floor (gotcha 134). Confirmed on upstream's own - # released manylinux2014_x86_64 wheel for 1.9.402.0 too (identical - # abi3audit report), so this is a property of leptris-py itself, - # not of the riscv64 port - disable the redundant audit rather - # than patch around someone else's wheel-compat metadata. - CIBW_AUDIT_COMMAND: '' - - - name: Check the wheel carries the compiled accelerator, engine and licences - run: | - python3 - wheelhouse/*.whl <<'EOF' - import sys, zipfile - for whl in sys.argv[1:]: - names = zipfile.ZipFile(whl).namelist() - assert any(n.startswith("leptris/_leptrisaccel") and n.endswith(".so") for n in names), names - assert any(n == "leptris/_vendor/libleptris.so" for n in names), names - assert "leptris/_vendor/engine/LICENSE.md" in names, names - sources = [n for n in names if n.startswith("leptris/_vendor/engine/src/") and n.endswith(".c")] - assert len(sources) >= 10, (whl, len(sources)) - licenses = {n.rsplit("/", 1)[1] for n in names if ".dist-info/licenses/" in n} - {""} - assert licenses == {"LICENSE"}, (whl, licenses) - print(whl, "ok") - EOF - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: leptris-${{ env.LEPTRIS_VERSION }}-${{ matrix.tag }}-${{ matrix.libc }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: leptris + version: ${{ matrix.version }} + # The PyPI sdist contains the vendored libleptris sources and licence. + source: pypi-sdist + post-build: |- + python3 - $GITHUB_WORKSPACE/wheelhouse/*.whl <<'EOF' + import sys, zipfile + for whl in sys.argv[1:]: + names = zipfile.ZipFile(whl).namelist() + assert any(n.startswith("leptris/_leptrisaccel") and n.endswith(".so") for n in names), names + assert any(n == "leptris/_vendor/libleptris.so" for n in names), names + assert "leptris/_vendor/engine/LICENSE.md" in names, names + sources = [n for n in names if n.startswith("leptris/_vendor/engine/src/") and n.endswith(".c")] + assert len(sources) >= 10, (whl, len(sources)) + licenses = {n.rsplit("/", 1)[1] for n in names if ".dist-info/licenses/" in n} - {""} + assert licenses == {"LICENSE"}, (whl, licenses) + print(whl, "ok") + EOF + artifact-tag: ${{ matrix.tag }}-${{ matrix.libc }}_riscv64 + timeout-minutes: 90 + cibw-build: ${{ matrix.build }}-${{ matrix.libc }}_riscv64 + cibw-musllinux-riscv64-image: quay.io/pypa/musllinux_1_2_riscv64 + # setup.py's build_with_engine command cmake-builds vendor/libleptris + # into leptris/_vendor/ itself (the sdist's zero-setup source-install + # path - no LEPTRIS_LIB_PATH, no prebuilt archive); it only needs + # cmake on PATH. The engine SOURCE + licence are staged under + # leptris/_vendor/engine/ beside it so the wheel carries both, same + # layout scripts/vendor_libleptris.sh produces for upstream's own + # wheels (pyproject.toml's package-data globs already expect it). + # tests/test_packaging.py's TestVendoredLayout also requires the + # top-level engine/CMakeLists.txt (not just src/'s own nested one) + # and a _vendor/README.md rebuild note - both are what + # vendor_libleptris.sh stages for upstream's own wheels. + cibw-before-build: > + pip install cmake && + mkdir -p leptris/_vendor/engine && + cp vendor/libleptris/CMakeLists.txt leptris/_vendor/engine/CMakeLists.txt && + cp -r vendor/libleptris/src leptris/_vendor/engine/src && + cp -r vendor/libleptris/cmake leptris/_vendor/engine/cmake && + cp vendor/libleptris/LICENSE.md leptris/_vendor/engine/LICENSE.md && + echo "libleptris is vendored here; see engine/ for its source and CMakeLists.txt to rebuild." > leptris/_vendor/README.md + cibw-test-requires: pytest + cibw-test-command: pytest {project}/tests -q + # cp39-abi3's _leptrisaccel.abi3.so calls PyObject_CallNoArgs, a + # real CPython API function that was only added to the LIMITED + # (abi3) API in 3.10 - cibuildwheel's default + # abi3audit --strict flags that as a baseline/computed mismatch + # against our cp39 floor (gotcha 134). Confirmed on upstream's own + # released manylinux2014_x86_64 wheel for 1.9.402.0 too (identical + # abi3audit report), so this is a property of leptris-py itself, + # not of the riscv64 port - disable the redundant audit rather + # than patch around someone else's wheel-compat metadata. + cibw-audit-command: '' publish: name: Publish leptris ${{ matrix.version }} diff --git a/.github/workflows/build-levenshtein.yml b/.github/workflows/build-levenshtein.yml index 9b1f862b9cc..8069101d91f 100644 --- a/.github/workflows/build-levenshtein.yml +++ b/.github/workflows/build-levenshtein.yml @@ -45,113 +45,37 @@ jobs: package: levenshtein version: ${{ inputs.version }} - build_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - name: Build levenshtein ${{ matrix.version }} sdist - runs-on: ubuntu-latest - env: - LEVENSHTEIN_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout Levenshtein v${{ env.LEVENSHTEIN_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: rapidfuzz/Levenshtein - ref: v${{ env.LEVENSHTEIN_VERSION }} - submodules: 'true' - persist-credentials: false - - - name: Checkout python-wheels - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - path: python-wheels - persist-credentials: false - - - name: Install Python - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - # The extension compiles in the bundled rapidfuzz-cpp headers, whose MIT - # terms want the notice to travel with the binary; upstream's wheel carries - # only Levenshtein's own LICENSE. - - name: Patch Levenshtein source - run: | - git apply python-wheels/patches/levenshtein/${{ env.LEVENSHTEIN_VERSION }}/00*.patch - - - name: Build sdist - id: sdist - run: | - uv pip install "Cython>=3.1.6,<3.3.0" build twine - chmod +x ./src/Levenshtein/generate.sh - ./src/Levenshtein/generate.sh - git apply ./tools/sdist.patch - python -m build --sdist - twine check dist/* - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: levenshtein-${{ env.LEVENSHTEIN_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build levenshtein ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - LEVENSHTEIN_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: levenshtein-${{ env.LEVENSHTEIN_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - # Upstream feeds cibuildwheel the sdist tarball too: it bundles the - # cythonised .cxx, so the wheel build needs no Cython, and it carries - # the tests the inherited test-command runs. - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # Upstream's test-requires/test-command come from the sdist's - # pyproject.toml; only the licence assertion is ours. - CIBW_TEST_COMMAND: >- - python -c "import importlib.metadata as m; l = sorted(str(p).rsplit('/', 1)[-1] for p in m.files('levenshtein') if '.dist-info/licenses/' in str(p)); assert l == ['LICENSE', 'LICENSE.rapidfuzz-cpp'], l" - && pytest {package}/tests - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: levenshtein-${{ matrix.version }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + # Upstream feeds cibuildwheel the sdist tarball too: it bundles the + # cythonised .cxx, so the wheel build needs no Cython, and it carries + # the tests the inherited test-command runs. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: levenshtein + version: ${{ matrix.version }} + # The PyPI sdist contains the generated C++ and tests; the patches add the bundled rapidfuzz-cpp licence. + source: pypi-sdist + patches: true + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + timeout-minutes: 90 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + # Upstream's test-requires/test-command come from the sdist's + # pyproject.toml; only the licence assertion is ours. + cibw-test-command: > + python -c "import importlib.metadata as m; l = sorted(str(p).rsplit('/', 1)[-1] for p in m.files('levenshtein') if '.dist-info/licenses/' in str(p)); assert l == ['LICENSE', 'LICENSE.rapidfuzz-cpp'], l" + && pytest {package}/tests publish: name: Publish levenshtein ${{ matrix.version }} - needs: [setup, build_sdist, build_wheels] + needs: [setup, build_wheels] if: needs.setup.outputs.versions != '[]' strategy: fail-fast: false diff --git a/.github/workflows/build-litellm.yml b/.github/workflows/build-litellm.yml index a88ad666ec3..d3f17bdcb83 100644 --- a/.github/workflows/build-litellm.yml +++ b/.github/workflows/build-litellm.yml @@ -49,174 +49,102 @@ jobs: package: litellm version: ${{ inputs.version }} - python_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - runs-on: ubuntu-latest - env: - LITELLM_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout litellm v${{ env.LITELLM_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: BerriAI/litellm - ref: v${{ env.LITELLM_VERSION }} - persist-credentials: false - - - name: Install Python - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Set a fixed abi3 floor for the pyo3 extension - run: | - set -euo pipefail - # litellm ships a single abi3 wheel per arch on PyPI, and the floor that - # produces it keeps moving: <=1.97 carried it on the pyo3 dependency line, - # 1.100 dropped it entirely, 1.101 reintroduced it as a default crate - # feature with a py310 floor. We pin our own floor of abi3-py312 (RISE's - # minimum published Python) whichever shape the tag has. - # - # The floor must be explicit, not the bare `abi3` feature: bare `abi3` tags - # Abi3Version::CurrentPython, i.e. a different cpNN-abi3 per build - # interpreter, which is exactly the spray we must not publish. With - # abi3-py312 maturin always tags cp312-abi3, so every interpreter in the - # matrix yields the one identical wheel (deduped by find_compatible_wheel). - # Bake it in BEFORE building the sdist so maturin captures it. - python3 - <<'PY' - import pathlib, re, sys - - p = pathlib.Path("litellm-rust/crates/python-bridge/Cargo.toml") - s = p.read_text() - out = re.sub(r'(abi3 = \["pyo3/abi3-py)\d+("\])', r'\g<1>312\g<2>', s) - if out == s: - out = re.sub(r'(pyo3 = \{ workspace = true, features = \["extension-module")("?\] \})', - r'\1, "abi3-py312"\2', s) - if out == s: - out = s.replace("[features]\n", '[features]\nabi3 = ["pyo3/abi3-py312"]\n', 1) - out = re.sub(r'default = \[([^\]]*)\]', r'default = [\1, "abi3"]', out, count=1) - if "abi3-py312" not in out or out == s: - sys.exit("::error::could not set the abi3-py312 floor (manifest shape changed?)") - p.write_text(out) - PY - grep -nE 'abi3|^default' litellm-rust/crates/python-bridge/Cargo.toml - - - name: Build sdist - id: build_sdist - run: | - set -euo pipefail - rm -rf dist - # maturin is the build backend; `python -m build --sdist` invokes it to - # assemble the source tree (Cargo.lock + prebuilt frontend already in the - # checkout, plus the abi3 floor set above, are packaged in). - # twine check validates the metadata. - uv pip install 'maturin==1.9.4' build twine - python -m build --sdist --outdir dist - twine check dist/* - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: litellm-${{ env.LITELLM_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, python_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' strategy: fail-fast: false matrix: version: ${{ fromJSON(needs.setup.outputs.versions) }} name: Build litellm ${{ matrix.version }} cp312-abi3-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 240 - env: - LITELLM_VERSION: ${{ matrix.version }} - - steps: - - name: Fetch sdist artifact - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: litellm-${{ env.LITELLM_VERSION }}-sdist - path: dist - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build and test wheel - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - # cibuildwheel accepts an sdist tarball directly: it extracts it and - # builds from the self-contained tree (Cargo.lock + prebuilt frontend + - # the abi3 floor we set are all bundled). - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_ARCHS: riscv64 - # With the abi3-py312 floor set on the sdist, maturin tags every build - # `cp312-abi3` regardless of the interpreter. Selecting three interpreters - # therefore does NOT rebuild three times: cibuildwheel compiles the Rust - # once (first tag -> cp312-abi3 wheel), then find_compatible_wheel matches - # that wheel for cp313/cp314 ("Skipping build step...") while STILL running - # the test phase on each - so we get ONE cp312-abi3 wheel out but genuine - # load-and-test coverage on 3.12/3.13/3.14. cp314t is excluded (abi3 can't - # target free-threaded, and fastuuid/other riscv64 runtime deps have no - # cp314t wheels). - CIBW_BUILD: "cp312-* cp313-* cp314-*" - # rustup.rs has no riscv64 musl host toolchain (same reason - # build-fastuuid/tiktoken skip it). - CIBW_SKIP: "*-musllinux_*" - # litellm ships no [tool.cibuildwheel], so install the Rust toolchain its - # maturin backend needs in-container and put it on PATH. Upstream builds - # on stable (test-rust.yml); the crate is edition 2024 / rust-version 1.88 - # with no nightly features, so the default stable rustup satisfies it. - CIBW_BEFORE_ALL_LINUX: >- - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - # CIBW_ENVIRONMENT applies to BOTH build and test. Point pip at our - # registry (needed so riscv64-only test deps - fastuuid, tiktoken, hf-xet, - # multidict, frozenlist, pyyaml - resolve; harmless at build time) and add - # cargo to PATH for the maturin build. We deliberately do NOT set - # only-binary here - see CIBW_TEST_ENVIRONMENT (gotcha 12). - CIBW_ENVIRONMENT: >- - PATH="$PATH:$HOME/.cargo/bin" - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - # Test phase only: force wheels-only so the full runtime closure (13 deps) - # must resolve as riscv64 wheels instead of silently source-building a - # heavy dep on the runner. Verified the closure resolves to riscv64 wheels - # across public PyPI + our registry for cp312/cp313/cp314. - CIBW_TEST_ENVIRONMENT: >- - PIP_ONLY_BINARY=:all: - # Smoke-test the COMPILED extension, not just `import litellm`. The bridge - # loader (litellm/rust_bridge/loader.py) catches ImportError and returns - # None, so a plain import would pass even with a broken/missing _native. - # Assert the native module is really loaded and call gil_stats() (a - # zero-arg native fn returning {"releases": int}, no network/side effects). - CIBW_TEST_COMMAND: >- - python -c "import litellm; - from litellm.rust_bridge import _native; - from litellm.rust_bridge.loader import native_bridge_available, get_native_bridge; - assert native_bridge_available() is True, 'native bridge unavailable'; - assert get_native_bridge() is _native; - s = _native.gil_stats(); - assert isinstance(s, dict) and 'releases' in s, s; - print('litellm _native OK on', __import__('sys').version.split()[0], '-> gil_stats()=', s)" - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: litellm-${{ env.LITELLM_VERSION }}-cp312-abi3-manylinux_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: litellm + version: ${{ matrix.version }} + source: pypi-sdist + pre-build: |- + set -euo pipefail + # litellm ships a single abi3 wheel per arch on PyPI, and the floor that + # produces it keeps moving: <=1.97 carried it on the pyo3 dependency line, + # 1.100 dropped it entirely, 1.101 reintroduced it as a default crate + # feature with a py310 floor. We pin our own floor of abi3-py312 (RISE's + # minimum published Python) whichever shape the tag has. + # + # The floor must be explicit, not the bare `abi3` feature: bare `abi3` tags + # Abi3Version::CurrentPython, i.e. a different cpNN-abi3 per build + # interpreter, which is exactly the spray we must not publish. With + # abi3-py312 maturin always tags cp312-abi3, so every interpreter in the + # matrix yields the one identical wheel (deduped by find_compatible_wheel). + # Apply it to the extracted sdist before cibuildwheel builds the wheel. + python3 - <<'PY' + import pathlib, re, sys + + p = pathlib.Path("litellm-rust/crates/python-bridge/Cargo.toml") + s = p.read_text() + out = re.sub(r'abi3-py\d+', 'abi3-py312', s) + if out == s: + out = re.sub(r'(pyo3 = \{ workspace = true, features = \["extension-module")("?\] \})', + r'\1, "abi3-py312"\2', s) + if out == s: + out = s.replace("[features]\n", '[features]\nabi3 = ["pyo3/abi3-py312"]\n', 1) + out = re.sub(r'default = \[([^\]]*)\]', r'default = [\1, "abi3"]', out, count=1) + if "abi3-py312" not in out or out == s: + sys.exit("::error::could not set the abi3-py312 floor (manifest shape changed?)") + p.write_text(out) + PY + grep -nE 'abi3|^default' litellm-rust/crates/python-bridge/Cargo.toml + artifact-tag: cp312-abi3-manylinux_riscv64 + timeout-minutes: 240 + # With the abi3-py312 floor set in the extracted source, maturin tags every build + # `cp312-abi3` regardless of the interpreter. Selecting three interpreters + # therefore does NOT rebuild three times: cibuildwheel compiles the Rust + # once (first tag -> cp312-abi3 wheel), then find_compatible_wheel matches + # that wheel for cp313/cp314 ("Skipping build step...") while STILL running + # the test phase on each - so we get ONE cp312-abi3 wheel out but genuine + # load-and-test coverage on 3.12/3.13/3.14. cp314t is excluded (abi3 can't + # target free-threaded, and fastuuid/other riscv64 runtime deps have no + # cp314t wheels). + cibw-build: cp312-* cp313-* cp314-* + # rustup.rs has no riscv64 musl host toolchain (same reason + # build-fastuuid/tiktoken skip it). + cibw-skip: "*-musllinux_*" + # litellm ships no [tool.cibuildwheel], so install the Rust toolchain its + # maturin backend needs in-container and put it on PATH. Upstream builds + # on stable (test-rust.yml); the crate is edition 2024 / rust-version 1.88 + # with no nightly features, so the default stable rustup satisfies it. + cibw-before-all-linux: > + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + # CIBW_ENVIRONMENT applies to BOTH build and test. Point pip at our + # registry (needed so riscv64-only test deps - fastuuid, tiktoken, hf-xet, + # multidict, frozenlist, pyyaml - resolve; harmless at build time) and add + # cargo to PATH for the maturin build. We deliberately do NOT set + # only-binary here - see CIBW_TEST_ENVIRONMENT (gotcha 12). + cibw-environment-linux: > + PATH="$PATH:$HOME/.cargo/bin" + # Test phase only: force wheels-only so the full runtime closure (13 deps) + # must resolve as riscv64 wheels instead of silently source-building a + # heavy dep on the runner. Verified the closure resolves to riscv64 wheels + # across public PyPI + our registry for cp312/cp313/cp314. + cibw-test-environment: > + PIP_ONLY_BINARY=:all: + # Smoke-test the COMPILED extension, not just `import litellm`. The bridge + # loader (litellm/rust_bridge/loader.py) catches ImportError and returns + # None, so a plain import would pass even with a broken/missing _native. + # Assert the native module is really loaded and call gil_stats() (a + # zero-arg native fn returning {"releases": int}, no network/side effects). + cibw-test-command: > + python -c "import litellm; + from litellm.rust_bridge import _native; + from litellm.rust_bridge.loader import native_bridge_available, get_native_bridge; + assert native_bridge_available() is True, 'native bridge unavailable'; + assert get_native_bridge() is _native; + s = _native.gil_stats(); + assert isinstance(s, dict) and 'releases' in s, s; + print('litellm _native OK on', __import__('sys').version.split()[0], '-> gil_stats()=', s)" publish: name: Publish litellm ${{ matrix.version }} - needs: [setup, python_sdist, build_wheels] + needs: [setup, build_wheels] if: needs.setup.outputs.versions != '[]' strategy: fail-fast: false diff --git a/.github/workflows/build-minorminer.yml b/.github/workflows/build-minorminer.yml index 7e5ab9d55fc..f28a5ca5769 100644 --- a/.github/workflows/build-minorminer.yml +++ b/.github/workflows/build-minorminer.yml @@ -46,122 +46,35 @@ jobs: package: minorminer version: ${{ inputs.version }} - build_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - # The sdist packages the source tree plus the vendored glasgow-subgraph-solver and - # portable-snippets headers (git submodules). It's architecture-independent, so - # build it once on x86 instead of burning a scarce riscv runner (CLAUDE.md gotcha 4). - name: Build minorminer ${{ matrix.version }} sdist - runs-on: ubuntu-latest - permissions: - contents: read - env: - MINORMINER_VERSION: ${{ matrix.version }} - - steps: - # .gitmodules pins submodules via git@github.com: SSH URLs; no deploy key is - # configured on our runners, so rewrite to HTTPS before actions/checkout resolves them. - - name: Use HTTPS for submodule fetches - run: git config --global url."https://github.com/".insteadOf "git@github.com:" - - - name: Checkout minorminer v${{ env.MINORMINER_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: dwavesystems/minorminer - ref: ${{ env.MINORMINER_VERSION }} - submodules: recursive - path: minorminer - persist-credentials: false - - - name: Checkout python-wheels - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - path: python-wheels - persist-credentials: false - - - name: Apply patches - working-directory: minorminer - run: git apply -v ../python-wheels/patches/minorminer/${{ env.MINORMINER_VERSION }}/*.patch - - - name: Install Python - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Build sdist - id: sdist - working-directory: minorminer - run: | - uv pip install build twine - python -m build --sdist - twine check --strict dist/*.tar.gz - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: minorminer-${{ env.MINORMINER_VERSION }}-sdist - path: minorminer/dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build minorminer ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - permissions: - contents: read strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - MINORMINER_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: minorminer-${{ env.MINORMINER_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_ARCHS: riscv64 - # Upstream itself skips musllinux (`skip = "pp* *musllinux*"` in pyproject.toml); - # CIBW_BUILD overrides that config wholesale, so repeat the musllinux skip here. - CIBW_SKIP: '*-musllinux_*' - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_ENVIRONMENT: >- - PIP_ONLY_BINARY=numpy,scipy - PIP_PREFER_BINARY=1 - UV_ONLY_BINARY=numpy,scipy - UV_PREFER_BINARY=1 - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - UV_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - UV_INDEX_STRATEGY=unsafe-best-match - CIRCLECI=true - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: minorminer-${{ env.MINORMINER_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error - + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: minorminer + version: ${{ matrix.version }} + # The PyPI sdist contains the vendored glasgow-subgraph-solver and portable-snippets sources. + source: pypi-sdist + patches: true + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + # Upstream itself skips musllinux (`skip = "pp* *musllinux*"` in pyproject.toml); + # CIBW_BUILD overrides that config wholesale, so repeat the musllinux skip here. + cibw-skip: "*-musllinux_*" + cibw-environment-linux: > + PIP_ONLY_BINARY=numpy,scipy + PIP_PREFER_BINARY=1 + UV_ONLY_BINARY=numpy,scipy + UV_PREFER_BINARY=1 + UV_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + UV_INDEX_STRATEGY=unsafe-best-match + CIRCLECI=true publish: name: Publish minorminer ${{ matrix.version }} needs: [setup, build_wheels] diff --git a/.github/workflows/build-ndindex.yml b/.github/workflows/build-ndindex.yml index 09a38d4b982..2a306cc0d30 100644 --- a/.github/workflows/build-ndindex.yml +++ b/.github/workflows/build-ndindex.yml @@ -45,112 +45,45 @@ jobs: package: ndindex version: ${{ inputs.version }} - build_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - name: Build ndindex ${{ matrix.version }} sdist - runs-on: ubuntu-latest - env: - NDINDEX_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout ndindex ${{ env.NDINDEX_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: Quansight-Labs/ndindex - ref: ${{ env.NDINDEX_VERSION }} - # versioneer derives the version from the tag history - fetch-depth: 0 - persist-credentials: false - - - name: Install Python - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Build sdist - id: sdist - run: | - uv pip install build twine - python -m build --sdist . - twine check --strict dist/* - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: ndindex-${{ env.NDINDEX_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build ndindex ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 240 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - NDINDEX_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: ndindex-${{ env.NDINDEX_VERSION }}-sdist - path: dist/ - - # Extracted at the workspace root so cibuildwheel's cwd is the sdist tree - # and CIBW_TEST_SOURCES can stage upstream's conftest.py. - - name: Extract sdist - run: tar zxf dist/*.tar.gz --strip-components=1 - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_TEST_REQUIRES: numpy hypothesis pytest sympy packaging - CIBW_TEST_SOURCES: conftest.py - # Upstream's wheel job only imports the module; run the suite that - # ships inside the wheel instead. --hypothesis-disable-deadline is - # upstream's own flag: the per-example deadline is sized for their x86 - # runners. - CIBW_TEST_COMMAND: >- - python -c "import ndindex._slice as s, ndindex._tuple as t; assert s.__file__.endswith('.so') and t.__file__.endswith('.so'), (s.__file__, t.__file__)" && - python -m pytest --pyargs ndindex -v --hypothesis-disable-deadline - CIBW_TEST_ENVIRONMENT: >- - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - PIP_ONLY_BINARY=numpy,hypothesis - with: - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - - - name: Check the wheel ships the extension modules - run: | - python3 - wheelhouse/*.whl <<'EOF' - import sys, zipfile - names = {n.rsplit("/", 1)[-1].split(".")[0] - for n in zipfile.ZipFile(sys.argv[1]).namelist() if n.endswith(".so")} - assert names == {"_slice", "_tuple"}, names - EOF - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: ndindex-${{ matrix.version }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error - + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: ndindex + version: ${{ matrix.version }} + # The PyPI sdist contains conftest.py and the package test suite. + source: pypi-sdist + post-build: |- + python3 - $GITHUB_WORKSPACE/wheelhouse/*.whl <<'EOF' + import sys, zipfile + names = {n.rsplit("/", 1)[-1].split(".")[0] + for n in zipfile.ZipFile(sys.argv[1]).namelist() if n.endswith(".so")} + assert names == {"_slice", "_tuple"}, names + EOF + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + timeout-minutes: 240 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-test-requires: numpy hypothesis pytest sympy packaging + cibw-test-sources: conftest.py + # Upstream's wheel job only imports the module; run the suite that + # ships inside the wheel instead. --hypothesis-disable-deadline is + # upstream's own flag: the per-example deadline is sized for their x86 + # runners. + cibw-test-command: > + python -c "import ndindex._slice as s, ndindex._tuple as t; assert s.__file__.endswith('.so') and t.__file__.endswith('.so'), (s.__file__, t.__file__)" && + python -m pytest --pyargs ndindex -v --hypothesis-disable-deadline + cibw-test-environment: > + PIP_ONLY_BINARY=numpy,hypothesis publish: name: Publish ndindex ${{ matrix.version }} - needs: [setup, build_sdist, build_wheels] + needs: [setup, build_wheels] if: needs.setup.outputs.versions != '[]' strategy: fail-fast: false diff --git a/.github/workflows/build-p4p.yml b/.github/workflows/build-p4p.yml index a57e721292e..2ec6f434a82 100644 --- a/.github/workflows/build-p4p.yml +++ b/.github/workflows/build-p4p.yml @@ -47,142 +47,63 @@ jobs: package: p4p version: ${{ inputs.version }} - python_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - # p4p's own setup.py cythonizes its two Extensions (p4p._p4p, p4p._gw) at - # parse time (setuptools_dso's cythonize()), and nothing in that source - # tree is arch-specific, so build the sdist once on x86 rather than on a - # scarce riscv runner (same shape as pvxslibs'/epicscorelibs' own - # python_sdist job). - name: Build p4p ${{ matrix.version }} sdist - runs-on: ubuntu-latest - env: - P4P_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout p4p v${{ env.P4P_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: ${{ env.P4P_REPO }} - ref: ${{ env.P4P_VERSION }} - submodules: recursive - persist-credentials: false - - - name: Install Python - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - # setup.py imports epicscorelibs.path/version and pvxslibs.path/version - # at parse time (to locate their headers/compiled libs and read their - # ABI-compatible version pins), and setuptools_dso's cythonize() needs - # Cython present too - all four must be importable before `sdist` can - # even run, same as pvxslibs needing setuptools_dso+epicscorelibs. - - name: Build sdist - run: | - set -euo pipefail - uv pip install setuptools wheel numpy 'setuptools_dso>=2.11a2' Cython epicscorelibs pvxslibs - python setup.py sdist --formats=gztar - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: p4p-${{ env.P4P_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, python_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build p4p ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - P4P_VERSION: ${{ matrix.version }} - - steps: - - name: Fetch sdist artifact - id: fetch_sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: p4p-${{ env.P4P_VERSION }}-sdist - - - name: Extract sdist - run: | - set -euo pipefail - mkdir p4p - tar zxf "${{ steps.fetch_sdist.outputs.download-path }}"/*.tar.gz \ - --strip-components=1 -C p4p - - # Upstream's own manylinux job (build.yml) resolves setuptools_dso, - # Cython, numpy, epicscorelibs and pvxslibs from PyPI before building; - # point pip at our own registry too so epicscorelibs/pvxslibs (which - # have no riscv64 sdist build story of their own) resolve as the - # already-published wheels instead of falling back to source. - - name: Build and test wheel - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - package-dir: p4p - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # EVENT_NOEPOLL forces libevent off its epoll backend: riscv64 has no - # epoll_wait syscall (only epoll_pwait), and this runner's container - # returns ENOSYS for it ("libevent Warn: epoll_wait: Function not - # implemented"), which kills pvxs's event-loop worker thread on - # startup and hangs any test that touches a live server. - CIBW_ENVIRONMENT: >- - PIP_EXTRA_INDEX_URL=${{ env.PIP_EXTRA_INDEX_URL }} - PIP_ONLY_BINARY=epicscorelibs,pvxslibs - EVENT_NOEPOLL=1 - # p4p._p4p and p4p._gw both link pvxslibs.lib.pvxs and - # epicscorelibs.lib.Com directly (setup.py's dsos=[...]), and - # libpvxs.so itself links libCom/libdbCore/libdbRecStd from - # epicscorelibs transitively - exclude all four from auditwheel - # repair, same as pvxslibs' own build excludes the epicscorelibs - # trio (gotcha 17's dep-wheel pattern); they resolve at runtime via - # the pvxslibs/epicscorelibs wheels' own $ORIGIN RPATH. - CIBW_REPAIR_WHEEL_COMMAND_LINUX: >- - auditwheel repair -w {dest_dir} {wheel} - --exclude 'libpvxs.so*' --exclude 'libCom.so*' - --exclude 'libdbCore.so*' --exclude 'libdbRecStd.so*' - CIBW_TEST_REQUIRES: nose2 - CIBW_TEST_COMMAND: >- - python -c "import p4p; print('IMPORT', p4p.__file__)" - && python -m nose2 -v p4p - - - name: Check the wheel ships both extensions and the licence - run: | - python3 - wheelhouse/*.whl <<'EOF' - import sys, zipfile - for whl in sys.argv[1:]: - names = zipfile.ZipFile(whl).namelist() - for ext in ("_p4p", "_gw"): - assert any(n.startswith(f"p4p/{ext}.") and n.endswith(".so") for n in names), (whl, ext) - licences = {n.rsplit("/", 1)[1] - for n in names if ".dist-info/licenses/" in n} - {""} - assert "LICENSE" in licences, (whl, licences) - print(whl, "ok") - EOF - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: p4p-${{ env.P4P_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + # Upstream's own manylinux job (build.yml) resolves setuptools_dso, + # Cython, numpy, epicscorelibs and pvxslibs from PyPI before building; + # point pip at our own registry too so epicscorelibs/pvxslibs (which + # have no riscv64 sdist build story of their own) resolve as the + # already-published wheels instead of falling back to source. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: p4p + version: ${{ matrix.version }} + source: pypi-sdist + post-build: |- + python3 - $GITHUB_WORKSPACE/wheelhouse/*.whl <<'EOF' + import sys, zipfile + for whl in sys.argv[1:]: + names = zipfile.ZipFile(whl).namelist() + for ext in ("_p4p", "_gw"): + assert any(n.startswith(f"p4p/{ext}.") and n.endswith(".so") for n in names), (whl, ext) + licences = {n.rsplit("/", 1)[1] + for n in names if ".dist-info/licenses/" in n} - {""} + assert "LICENSE" in licences, (whl, licences) + print(whl, "ok") + EOF + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + timeout-minutes: 90 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + # EVENT_NOEPOLL forces libevent off its epoll backend: riscv64 has no + # epoll_wait syscall (only epoll_pwait), and this runner's container + # returns ENOSYS for it ("libevent Warn: epoll_wait: Function not + # implemented"), which kills pvxs's event-loop worker thread on + # startup and hangs any test that touches a live server. + cibw-environment-linux: > + PIP_ONLY_BINARY=epicscorelibs,pvxslibs + EVENT_NOEPOLL=1 + # p4p._p4p and p4p._gw both link pvxslibs.lib.pvxs and + # epicscorelibs.lib.Com directly (setup.py's dsos=[...]), and + # libpvxs.so itself links libCom/libdbCore/libdbRecStd from + # epicscorelibs transitively - exclude all four from auditwheel + # repair, same as pvxslibs' own build excludes the epicscorelibs + # trio (gotcha 17's dep-wheel pattern); they resolve at runtime via + # the pvxslibs/epicscorelibs wheels' own $ORIGIN RPATH. + cibw-repair-wheel-command-linux: > + auditwheel repair -w {dest_dir} {wheel} + --exclude 'libpvxs.so*' --exclude 'libCom.so*' + --exclude 'libdbCore.so*' --exclude 'libdbRecStd.so*' + cibw-test-requires: nose2 + cibw-test-command: > + python -c "import p4p; print('IMPORT', p4p.__file__)" + && python -m nose2 -v p4p publish: name: Publish p4p ${{ matrix.version }} diff --git a/.github/workflows/build-passagemath-bliss.yml b/.github/workflows/build-passagemath-bliss.yml index 02216491eac..d3f4236e7a5 100644 --- a/.github/workflows/build-passagemath-bliss.yml +++ b/.github/workflows/build-passagemath-bliss.yml @@ -56,84 +56,6 @@ jobs: package: passagemath-bliss version: ${{ inputs.version }} - python_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - runs-on: ubuntu-24.04-riscv - env: - PASSAGEMATH_BLISS_VERSION: ${{ matrix.version }} - - steps: - - name: checkout passagemath/passagemath passagemath-${{ env.PASSAGEMATH_BLISS_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: passagemath/passagemath - ref: passagemath-${{ env.PASSAGEMATH_BLISS_VERSION }} - filter: blob:none - sparse-checkout: | - /bootstrap - /pyproject.toml - build - m4 - pkgs/sagemath-bliss - src/sage/graphs/bliss.p* - src/sage/graphs/bliss_cpp - src/sage/graphs/all__sagemath_bliss.py - src/sage/all__sagemath_bliss.py - sparse-checkout-cone-mode: false - persist-credentials: false - - - name: Checkout python-wheels - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - path: python-wheels - persist-credentials: false - - - name: Patch passagemath-bliss source - run: git apply python-wheels/patches/passagemath-bliss/${{ env.PASSAGEMATH_BLISS_VERSION }}/00*.patch - - - name: Render pyproject.toml - run: ./bootstrap - - # ./bootstrap's own per-package render (sage-package bootstrap) runs all - # ~650 spkgs in parallel batches and aborts a batch outright if any - # member fails (sage_conf's needs the full configure.ac, absent from - # this sparse checkout); render this one package ourselves so it is - # not at the mercy of that batch's luck. - - name: Render pkgs/sagemath-bliss/pyproject.toml.m4 - working-directory: pkgs/sagemath-bliss - run: | - export M4PATH="$GITHUB_WORKSPACE/m4" - for f in *.m4; do m4 "$f" > "${f%.m4}"; done - - - name: setup uv - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: build sdist - working-directory: pkgs/sagemath-bliss - run: | - rm -rf dist/ *.egg-info - uv pip install build setuptools "passagemath-setup==${{ env.PASSAGEMATH_BLISS_VERSION }}" "passagemath-environment==${{ env.PASSAGEMATH_BLISS_VERSION }}" - python -m build --sdist --no-isolation --skip-dependency-check - - - name: upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: passagemath-bliss-${{ env.PASSAGEMATH_BLISS_VERSION }}-sdist - path: pkgs/sagemath-bliss/dist/*.tar.gz - if-no-files-found: error - - # bliss (LGPL-3.0-or-later) is compiled straight into the wheel from the - # pinned commit, which is not in the image's repos, so its source and - # licence text are collected here rather than from an RPM. gpl_sources: needs: [setup] if: needs.setup.outputs.versions != '[]' @@ -162,71 +84,27 @@ jobs: if-no-files-found: error linux: - needs: [setup, python_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build passagemath-bliss ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - PASSAGEMATH_BLISS_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: passagemath-bliss-${{ env.PASSAGEMATH_BLISS_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # Replays build/pkgs/bliss/spkg-install.in. No riscv64 bliss-devel - # exists (EPEL ships no riscv64 repo at all), so this always builds - # from source, same as upstream's own spkg-configure.m4 fallback. - CIBW_BEFORE_ALL_LINUX: | - set -euo pipefail - if command -v apk >/dev/null; then - apk add --no-cache cmake ninja unzip curl - else - dnf install -y --setopt=install_weak_deps=False cmake ninja-build unzip - fi - curl -fsSLo /tmp/bliss.zip https://github.com/scipopt/bliss/archive/${{ env.BLISS_COMMIT }}.zip - echo "${{ env.BLISS_SHA256 }} /tmp/bliss.zip" | sha256sum -c - - unzip -q /tmp/bliss.zip -d /tmp - cd /tmp/bliss-${{ env.BLISS_COMMIT }} - cmake -GNinja -DUSE_GMP=OFF -DCMAKE_INSTALL_PREFIX=/usr/local . - cmake --build . - cmake --install . - ldconfig || true - CIBW_ENVIRONMENT_LINUX: >- - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH - LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH - CPATH=/usr/local/include:$CPATH - # sagemath-repl/-graphs (the real test extras) are unported, so this - # stands in a minimal duck-typed graph rather than sage's own. - CIBW_TEST_COMMAND: >- - python -c "from sage.graphs.bliss import canonical_form; - G=type('G',(object,),{'order':lambda s:4,'is_directed':lambda s:False,'edge_iterator':lambda s,labels=False:iter([(0,1),(1,2),(2,0),(2,3)]),'__iter__':lambda s:iter(range(4))}); - r=canonical_form(G(), use_edge_labels=False); - assert len(r)==4, r; - print('bliss ok', r)" - - - name: Check the wheel ships the extension and the vendored licence - run: | - python3 - wheelhouse/*.whl <<'EOF' + # Replays build/pkgs/bliss/spkg-install.in. No riscv64 bliss-devel + # exists (EPEL ships no riscv64 repo at all), so this always builds + # from source, same as upstream's own spkg-configure.m4 fallback. + # sagemath-repl/-graphs (the real test extras) are unported, so this + # stands in a minimal duck-typed graph rather than sage's own. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: passagemath-bliss + version: ${{ matrix.version }} + source: pypi-sdist + patches: true + post-build: |- + python3 - $GITHUB_WORKSPACE/wheelhouse/*.whl <<'EOF' import sys, zipfile for whl in sys.argv[1:]: names = zipfile.ZipFile(whl).namelist() @@ -245,12 +123,33 @@ jobs: assert licences == {"LICENSE", "LICENSE.bliss"}, (whl, licences) print(whl, "ok") EOF - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: passagemath-bliss-${{ env.PASSAGEMATH_BLISS_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-before-all-linux: |- + set -euo pipefail + if command -v apk >/dev/null; then + apk add --no-cache cmake ninja unzip curl + else + dnf install -y --setopt=install_weak_deps=False cmake ninja-build unzip + fi + curl -fsSLo /tmp/bliss.zip https://github.com/scipopt/bliss/archive/eddc188c79ea1e1f4f865ec0e87b6a1eb955b54c.zip + echo "ce288d386692d6693fef92127180db8cccd3945704037b7bdeaf41d43350c7cf /tmp/bliss.zip" | sha256sum -c - + unzip -q /tmp/bliss.zip -d /tmp + cd /tmp/bliss-eddc188c79ea1e1f4f865ec0e87b6a1eb955b54c + cmake -GNinja -DUSE_GMP=OFF -DCMAKE_INSTALL_PREFIX=/usr/local . + cmake --build . + cmake --install . + ldconfig || true + cibw-environment-linux: > + LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH + LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH + CPATH=/usr/local/include:$CPATH + cibw-test-command: > + python -c "from sage.graphs.bliss import canonical_form; + G=type('G',(object,),{'order':lambda s:4,'is_directed':lambda s:False,'edge_iterator':lambda s,labels=False:iter([(0,1),(1,2),(2,0),(2,3)]),'__iter__':lambda s:iter(range(4))}); + r=canonical_form(G(), use_edge_labels=False); + assert len(r)==4, r; + print('bliss ok', r)" publish: name: Publish passagemath-bliss ${{ matrix.version }} diff --git a/.github/workflows/build-passagemath-categories.yml b/.github/workflows/build-passagemath-categories.yml index 637325d6d09..78c4e4d2b73 100644 --- a/.github/workflows/build-passagemath-categories.yml +++ b/.github/workflows/build-passagemath-categories.yml @@ -52,338 +52,47 @@ jobs: package: passagemath-categories version: ${{ inputs.version }} - python_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - runs-on: ubuntu-24.04-riscv - env: - PASSAGEMATH_CATEGORIES_VERSION: ${{ matrix.version }} - - steps: - - name: checkout passagemath/passagemath passagemath-${{ env.PASSAGEMATH_CATEGORIES_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: passagemath/passagemath - ref: passagemath-${{ env.PASSAGEMATH_CATEGORIES_VERSION }} - filter: blob:none - sparse-checkout: | - /bootstrap - /pyproject.toml - build - m4 - pkgs/sagemath-categories - # sage_setup.find.find_python_sources() (run by setup.py at - # wheel-build time, not at sdist time -- see - # src/sage_setup/find.py and src/sage/misc/package_dir.py in - # the passagemath/passagemath checkout) treats a directory as - # a non-package and os.walk-prunes it unless it has - # __init__.py/__init__.pxd/all.py, or an - # all__sagemath_.py matching this distribution. Every - # loose-file-globbed directory below (sage/rings and its - # integer*/rational*/polynomial/* etc.) is shared with other - # passagemath-* distributions and only carries - # all__sagemath_categories.py, which MANIFEST.in's own - # `global-include all__sagemath_categories.py` already expects - # to find on disk -- but no glob below happens to match that - # filename, so it was never checked out, and sage_setup drops - # the whole directory from the wheel even though the sdist step - # (plain MANIFEST copying, no package-discovery check) ships it - # fine. Confirmed from real logs: python_sdist's "Render - # pyproject.toml"/"build sdist" steps DO copy e.g. - # sage/rings/integer_ring.pyx into the sdist, while the Build - # wheels step's own build_py/zip output never creates - # build/lib.../sage/rings or adds sage/rings/integer* at all - # (only rings/function_field, rings/semirings and - # rings/finite_rings/integer_mod_limits.h survive, each for its - # own unrelated reason). One recursive pattern below pulls in - # every all__sagemath_categories.py this distribution's own - # MANIFEST.in already wants, fixing sage/rings plus the same - # latent gap in sage/misc, sage/monoids, sage/groups, - # sage/geometry, sage/databases, sage/numerical/backends, - # sage/combinat(+/matrices), sage/ext, sage/schemes and - # sage/tests. - src/sage/**/all__sagemath_categories.py - src/sage/all__sagemath_categories.py - src/sage/categories - src/sage/databases/sql_db.py - src/sage/geometry/abc.p* - src/sage/interfaces/all.p* - src/sage/interfaces/abc.p* - src/sage/interfaces/process.p* - src/sage/interfaces/tab_completion.p* - src/sage/misc/object_multiplexer.p* - src/sage/misc/multireplace.p* - src/sage/interfaces/sagespawn.p* - src/sage/interfaces/quit.p* - src/sage/interfaces/expect.p* - src/sage/interfaces/interface.p* - src/sage/interfaces/sage0.p* - src/sage/interfaces/khoca.p* - src/sage/interfaces/regina.p* - src/sage/parallel - src/sage/typeset - src/sage/groups/generic.p* - src/sage/groups/groups_catalog.p* - src/sage/monoids/monoid.p* - src/sage/monoids/indexed_free_monoid.p* - src/sage/rings/ring.* - src/sage/rings/quotient_ring*.p* - src/sage/rings/homset.p* - src/sage/rings/ideal*.p* - src/sage/rings/noncommutative_ideals.p* - src/sage/rings/localization.p* - src/sage/rings/morphism.p* - src/sage/rings/abc.* - src/sage/rings/integer*.p* - src/sage/rings/rational*.* - src/sage/rings/infinity.* - src/sage/rings/factorint.p* - src/sage/rings/sum_of_squares.p* - src/sage/rings/generic.p* - src/sage/misc/allocator.* - src/sage/misc/latex*.* - src/sage/misc/html.p* - src/sage/misc/mathml.p* - src/sage/misc/table.p* - src/sage/misc/map_threaded.p* - src/sage/misc/mrange.p* - src/sage/misc/defaults.p* - src/sage/misc/converting_dict.p* - src/sage/misc/parser.p* - src/sage/misc/method_decorator.p* - src/sage/misc/random_testing.p* - src/sage/misc/rest_index_of_methods.p* - src/sage/misc/callable_dict.p* - src/sage/misc/search.p* - src/sage/misc/stopgap.p* - src/sage/misc/citation.p* - src/sage/misc/binary_tree.p* - src/sage/data_structures - src/sage/groups/perm_gps/partn_ref - src/sage/arith - src/sage/calculus/functional.p* - src/sage/calculus/functions.p* - src/sage/misc/derivative.p* - src/sage/misc/functional.p* - src/sage/symbolic/symbols.p* - src/sage/symbolic/function.p* - src/sage/functions - src/sage/rings/finite_rings/element_base.* - src/sage/rings/finite_rings/stdint.* - src/sage/rings/finite_rings/finite_field_base.p* - src/sage/rings/finite_rings/finite_field_constructor.p* - src/sage/rings/finite_rings/finite_field_prime_modn.p* - src/sage/rings/finite_rings/residue_field.p* - src/sage/rings/finite_rings/hom_finite_field.p* - src/sage/rings/finite_rings/hom_prime_finite_field.p* - src/sage/rings/finite_rings/homset.p* - src/sage/rings/fast_arith.* - src/sage/rings/finite_rings/integer_mod_limits.h - src/sage/rings/finite_rings/integer_mod.p* - src/sage/rings/finite_rings/integer_mod_ring.p* - src/sage/rings/finite_rings/conway_polynomials.p* - src/sage/rings/finite_rings/galois_group.p* - src/sage/rings/algebraic_closure_finite_field.p* - src/sage/rings/number_field/number_field_base.p* - src/sage/rings/number_field/number_field_element_base.p* - src/sage/rings/number_field/number_field_ideal.p* - src/sage/rings/real_double.p* - src/sage/rings/real_lazy.p* - src/sage/rings/fraction_field.p* - src/sage/rings/fraction_field_element.p* - src/sage/rings/qqbar_decorators.p* - src/sage/rings/padics/padic_generic.p* - src/sage/rings/padics/local_generic.p* - src/sage/rings/padics/local_generic_element.p* - src/sage/rings/padics/precision_error.p* - src/sage/rings/padics/misc.p* - src/sage/rings/padics/pow_computer.p* - src/sage/rings/polynomial/polynomial_ring.p* - src/sage/rings/polynomial/polynomial_ring_constructor.p* - src/sage/rings/polynomial/polynomial_ring_homomorphism.p* - src/sage/rings/polynomial/polynomial_quotient_ring.p* - src/sage/rings/polynomial/polynomial_singular_interface.p* - src/sage/rings/polynomial/multi_polynomial_ring.p* - src/sage/rings/polynomial/multi_polynomial_ring_base.p* - src/sage/rings/polynomial/multi_polynomial_sequence.p* - src/sage/rings/polynomial/multi_polynomial_ideal.p* - src/sage/rings/polynomial/commutative_polynomial.p* - src/sage/rings/polynomial/polynomial_compiled.p* - src/sage/rings/polynomial/polynomial_element.p* - src/sage/rings/polynomial/polynomial_element_generic.p* - src/sage/rings/polynomial/polynomial_fateman.p* - src/sage/rings/polynomial/polynomial_quotient_ring_element.p* - src/sage/rings/polynomial/multi_polynomial.p* - src/sage/rings/polynomial/multi_polynomial_element.p* - src/sage/rings/polynomial/polydict.p* - src/sage/rings/polynomial/term_order.p* - src/sage/rings/polynomial/flatten.p* - src/sage/rings/polynomial/cyclotomic.p* - src/sage/rings/polynomial/laurent_polynomial_ring*.p* - src/sage/rings/polynomial/laurent_polynomial_ideal.p* - src/sage/rings/polynomial/laurent_polynomial.p* - src/sage/rings/polynomial/ideal.p* - src/sage/rings/polynomial/toy*.p* - src/sage/rings/polynomial/symmetric_*.p* - src/sage/rings/continued_fraction*.p* - src/sage/rings/function_field - src/sage/rings/power_series_mpoly.p* - src/sage/rings/power_series_poly.p* - src/sage/rings/power_series_ring_element.p* - src/sage/rings/power_series_ring.p* - src/sage/rings/multi_power_series_ring.py - src/sage/rings/multi_power_series_ring_element.py - src/sage/rings/laurent_series_ring*.p* - src/sage/rings/puiseux_series_ring*.p* - src/sage/rings/lazy_series*.p* - src/sage/rings/semirings - src/sage/rings/tests.p* - src/sage/rings/big_oh.p* - src/sage/ext/fast_*.p* - src/sage/combinat/integer_vector.p* - src/sage/combinat/integer_vector_weighted.p* - src/sage/combinat/integer_lists - src/sage/combinat/backtrack.p* - src/sage/combinat/combinat.p* - src/sage/combinat/combinat_cython.p* - src/sage/combinat/combination.p* - src/sage/combinat/combinatorial_map.p* - src/sage/combinat/composition.p* - src/sage/combinat/partition.p* - src/sage/combinat/partitions.p* - src/sage/combinat/permutation.p* - src/sage/combinat/permutation_cython.p* - src/sage/combinat/q_analogues.p* - src/sage/combinat/ranker.py - src/sage/combinat/subset.p* - src/sage/combinat/tools.p* - src/sage/combinat/tuple.p* - src/sage/combinat/subsets_hereditary.p* - src/sage/combinat/subsets_pairwise.p* - src/sage/combinat/dlx.p* - src/sage/combinat/matrices/dancing_links.p* - src/sage/combinat/matrices/dancing_links_c.h - src/sage/combinat/matrices/dlxcpp.p* - src/sage/schemes/generic - src/sage/schemes/affine - src/sage/schemes/projective - src/sage/schemes/product_projective - src/sage/schemes/weighted_projective - src/sage/sets - src/sage/numerical/backends/generic*backend.p* - src/sage/tests/*.pyx - sparse-checkout-cone-mode: false - persist-credentials: false - - - name: Checkout python-wheels - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - path: python-wheels - persist-credentials: false - - - name: Patch passagemath-categories source - run: git apply python-wheels/patches/passagemath-categories/${{ env.PASSAGEMATH_CATEGORIES_VERSION }}/00*.patch - - - name: Render pyproject.toml - run: ./bootstrap - - - name: setup uv - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: build sdist - working-directory: pkgs/sagemath-categories - run: | - rm -rf dist/ *.egg-info - uv pip install build setuptools "passagemath-setup==${{ env.PASSAGEMATH_CATEGORIES_VERSION }}" "passagemath-environment==${{ env.PASSAGEMATH_CATEGORIES_VERSION }}" - python -m build --sdist --no-isolation --skip-dependency-check - - - name: upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: passagemath-categories-${{ env.PASSAGEMATH_CATEGORIES_VERSION }}-sdist - path: pkgs/sagemath-categories/dist/*.tar.gz - if-no-files-found: error - linux: - needs: [setup, python_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build passagemath-categories ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - PASSAGEMATH_CATEGORIES_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: passagemath-categories-${{ env.PASSAGEMATH_CATEGORIES_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # gmp/mpfr/mpc satisfy Sage's own spkg-configure.m4 minimum-version - # checks, same as build-passagemath-objects.yml; gmpy2 (a build-time - # requirement here, cimported by the rings layer) has no riscv64 - # musllinux wheel on the registry at all, so this package is - # manylinux-only, same reason symengine/chiavdf drop musllinux. - CIBW_BEFORE_ALL_LINUX: dnf install -y gmp-devel mpfr-devel libmpc-devel - CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - # sagemath-repl (the real test extra) is unported, so this exercises - # the module this split actually provides: basic rings (ZZ/QQ), - # univariate polynomials and the categories framework underneath. - # - # `from sage.rings.integer import Integer` must run before - # `sage.rings.integer_ring` is ever touched: sage/rings/integer.pyx - # (module scope, line ~317) reads `integer_ring.ZZ` eagerly at its - # own init time, while sage/rings/integer_ring.pyx cimports Integer - # from sage.rings.integer -- so importing integer_ring cold, before - # anything else has loaded sage.rings.integer, always re-enters - # integer_ring's own not-yet-finished init and dies with - # "AttributeError: partially initialized module 'sage.rings. - # integer_ring' ... has no attribute 'ZZ'". This is upstream's own - # pre-existing ordering, not a riscv64 or packaging issue: the - # official PyPI passagemath-categories==10.8.13 manylinux_x86_64 - # wheel reproduces the identical traceback for the identical cold - # `from sage.rings.integer_ring import ZZ` (confirmed by installing - # it locally and running this exact test), and is fixed there the - # same way, by importing Integer first. - CIBW_TEST_COMMAND: >- - python -c "from sage.rings.integer import Integer; - from sage.rings.integer_ring import ZZ; - from sage.rings.rational_field import QQ; - from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing; - assert ZZ(2) + ZZ(3) == ZZ(5); - assert QQ(1)/QQ(3) + QQ(1)/QQ(3) == QQ(2)/QQ(3); - R = PolynomialRing(ZZ, 'x'); - x = R.gen(); - assert (x + 1)**2 == x**2 + 2*x + 1; - print('categories ok')" - - - name: Check the wheel ships the extensions and the licence - run: | - python3 - wheelhouse/*.whl <<'EOF' + # gmp/mpfr/mpc satisfy Sage's own spkg-configure.m4 minimum-version + # checks, same as build-passagemath-objects.yml; gmpy2 (a build-time + # requirement here, cimported by the rings layer) has no riscv64 + # musllinux wheel on the registry at all, so this package is + # manylinux-only, same reason symengine/chiavdf drop musllinux. + # sagemath-repl (the real test extra) is unported, so this exercises + # the module this split actually provides: basic rings (ZZ/QQ), + # univariate polynomials and the categories framework underneath. + # + # `from sage.rings.integer import Integer` must run before + # `sage.rings.integer_ring` is ever touched: sage/rings/integer.pyx + # (module scope, line ~317) reads `integer_ring.ZZ` eagerly at its + # own init time, while sage/rings/integer_ring.pyx cimports Integer + # from sage.rings.integer -- so importing integer_ring cold, before + # anything else has loaded sage.rings.integer, always re-enters + # integer_ring's own not-yet-finished init and dies with + # "AttributeError: partially initialized module 'sage.rings. + # integer_ring' ... has no attribute 'ZZ'". This is upstream's own + # pre-existing ordering, not a riscv64 or packaging issue: the + # official PyPI passagemath-categories==10.8.13 manylinux_x86_64 + # wheel reproduces the identical traceback for the identical cold + # `from sage.rings.integer_ring import ZZ` (confirmed by installing + # it locally and running this exact test), and is fixed there the + # same way, by importing Integer first. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: passagemath-categories + version: ${{ matrix.version }} + source: pypi-sdist + patches: true + post-build: |- + python3 - $GITHUB_WORKSPACE/wheelhouse/*.whl <<'EOF' import sys, zipfile for whl in sys.argv[1:]: names = zipfile.ZipFile(whl).namelist() @@ -394,12 +103,20 @@ jobs: assert licences == {"LICENSE"}, (whl, licences) print(whl, "ok", len(so_files), "extensions") EOF - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: passagemath-categories-${{ env.PASSAGEMATH_CATEGORIES_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-before-all-linux: dnf install -y gmp-devel mpfr-devel libmpc-devel + cibw-test-command: > + python -c "from sage.rings.integer import Integer; + from sage.rings.integer_ring import ZZ; + from sage.rings.rational_field import QQ; + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing; + assert ZZ(2) + ZZ(3) == ZZ(5); + assert QQ(1)/QQ(3) + QQ(1)/QQ(3) == QQ(2)/QQ(3); + R = PolynomialRing(ZZ, 'x'); + x = R.gen(); + assert (x + 1)**2 == x**2 + 2*x + 1; + print('categories ok')" publish: name: Publish passagemath-categories ${{ matrix.version }} diff --git a/.github/workflows/build-passagemath-cddlib.yml b/.github/workflows/build-passagemath-cddlib.yml index 5710d540925..3d2711a85a2 100644 --- a/.github/workflows/build-passagemath-cddlib.yml +++ b/.github/workflows/build-passagemath-cddlib.yml @@ -48,136 +48,51 @@ jobs: package: passagemath-cddlib version: ${{ inputs.version }} # cysignals (a build requirement) has no cp311 riscv64 wheel on the registry - python-exclude: "cp39 cp311" - - python_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - runs-on: ubuntu-24.04-riscv - env: - PASSAGEMATH_CDDLIB_VERSION: ${{ matrix.version }} - - steps: - - name: checkout passagemath/passagemath passagemath-${{ env.PASSAGEMATH_CDDLIB_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: passagemath/passagemath - ref: passagemath-${{ env.PASSAGEMATH_CDDLIB_VERSION }} - filter: blob:none - sparse-checkout: | - /bootstrap - /pyproject.toml - /VERSION.txt - build - m4 - pkgs/sagemath-cddlib - src/sage/libs/cddlib.p* - src/sage/libs/all__sagemath_cddlib.py - src/sage/all__sagemath_cddlib.py - sparse-checkout-cone-mode: false - persist-credentials: false - - - name: Checkout python-wheels - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - path: python-wheels - persist-credentials: false - - - name: Patch passagemath-cddlib source - run: git apply python-wheels/patches/passagemath-cddlib/${{ env.PASSAGEMATH_CDDLIB_VERSION }}/00*.patch - - - name: Render pyproject.toml - run: ./bootstrap - - - name: setup uv - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: build sdist - working-directory: pkgs/sagemath-cddlib - run: | - rm -rf dist/ *.egg-info - uv pip install build setuptools "passagemath-setup==${{ env.PASSAGEMATH_CDDLIB_VERSION }}" "passagemath-environment==${{ env.PASSAGEMATH_CDDLIB_VERSION }}" - python -m build --sdist --no-isolation --skip-dependency-check - - - name: upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: passagemath-cddlib-${{ env.PASSAGEMATH_CDDLIB_VERSION }}-sdist - path: pkgs/sagemath-cddlib/dist/*.tar.gz - if-no-files-found: error + python-exclude: cp39 cp311 linux: - needs: [setup, python_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build passagemath-cddlib ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - PASSAGEMATH_CDDLIB_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: passagemath-cddlib-${{ env.PASSAGEMATH_CDDLIB_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_BEFORE_ALL_LINUX: >- - if command -v dnf; then dnf install -y gmp-devel mpfr-devel libmpc-devel; - else apk add gmp-dev mpfr-dev mpc1-dev; fi - # The cddlib programs bundled into sage_wheels/bin link non-PIE at riscv64's 0x10000; auditwheel's - # patchelf then maps a segment below mmap_min_addr and they SIGSEGV at exec (gotcha 595). - # Alpine's GCC links PIE by default, so musllinux is unaffected. - CIBW_ENVIRONMENT: >- - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - LDFLAGS="${{ matrix.platform == 'manylinux' && '-Wl,-Ttext-segment=0x200000' || '' }}" - # Upstream's own repair-wheel-command pip installs passagemath-conf unpinned; pin it - # to the same release the build step used so repair_wheel.py tars cddlib's bundled - # binaries from the sage tree cddlib-ensure actually populated, not whatever upstream - # has published by the time this leg's repair step runs (gotcha 719). - CIBW_REPAIR_WHEEL_COMMAND_LINUX: >- - python3 -m pip install "passagemath-conf~=${{ matrix.version }}.0" auditwheel && - python3 {project}/repair_wheel.py {wheel} && - auditwheel repair -w {dest_dir} {wheel} - # The importable module pulls in passagemath-polyhedra (and upstream's - # doctests need -flint/-pari/-repl), none built for riscv64; exercise - # the cddlib programs repair_wheel.py bundles into sage_wheels/bin. - CIBW_TEST_COMMAND: >- - bin=$(python -c "import sysconfig; print(sysconfig.get_path('platlib'))")/sage_wheels/bin && - cd "$(mktemp -d)" && - printf 'H-representation\nbegin\n6 4 integer\n1 1 0 0\n1 -1 0 0\n1 0 1 0\n1 0 -1 0\n1 0 0 1\n1 0 0 -1\nend\n' > cube.ine && - "$bin/scdd_gmp" cube.ine && cat cube.ext && - grep -Eq '^ *8 +4 +(rational|integer)' cube.ext && - "$bin/lcdd" cube.ine | grep -Eq '^ *8 +4 +(real|rational|integer)' - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: passagemath-cddlib-${{ env.PASSAGEMATH_CDDLIB_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # The cddlib programs bundled into sage_wheels/bin link non-PIE at riscv64's 0x10000; auditwheel's + # patchelf then maps a segment below mmap_min_addr and they SIGSEGV at exec (gotcha 595). + # Alpine's GCC links PIE by default, so musllinux is unaffected. + # Upstream's own repair-wheel-command pip installs passagemath-conf unpinned; pin it + # to the same release the build step used so repair_wheel.py tars cddlib's bundled + # binaries from the sage tree cddlib-ensure actually populated, not whatever upstream + # has published by the time this leg's repair step runs (gotcha 719). + # The importable module pulls in passagemath-polyhedra (and upstream's + # doctests need -flint/-pari/-repl), none built for riscv64; exercise + # the cddlib programs repair_wheel.py bundles into sage_wheels/bin. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: passagemath-cddlib + version: ${{ matrix.version }} + source: pypi-sdist + patches: true + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-before-all-linux: > + if command -v dnf; then dnf install -y gmp-devel mpfr-devel libmpc-devel; + else apk add gmp-dev mpfr-dev mpc1-dev; fi + cibw-environment-linux: > + LDFLAGS="${{ matrix.platform == 'manylinux' && '-Wl,-Ttext-segment=0x200000' || '' }}" + cibw-repair-wheel-command-linux: > + python3 -m pip install "passagemath-conf~=${{ matrix.version }}.0" auditwheel && + python3 {project}/repair_wheel.py {wheel} && + auditwheel repair -w {dest_dir} {wheel} + cibw-test-command: > + bin=$(python -c "import sysconfig; print(sysconfig.get_path('platlib'))")/sage_wheels/bin && + cd "$(mktemp -d)" && + printf 'H-representation\nbegin\n6 4 integer\n1 1 0 0\n1 -1 0 0\n1 0 1 0\n1 0 -1 0\n1 0 0 1\n1 0 0 -1\nend\n' > cube.ine && + "$bin/scdd_gmp" cube.ine && cat cube.ext && + grep -Eq '^ *8 +4 +(rational|integer)' cube.ext && + "$bin/lcdd" cube.ine | grep -Eq '^ *8 +4 +(real|rational|integer)' publish: name: Publish passagemath-cddlib ${{ matrix.version }} diff --git a/.github/workflows/build-passagemath-cliquer.yml b/.github/workflows/build-passagemath-cliquer.yml index d14aaa48169..6b27cc93baf 100644 --- a/.github/workflows/build-passagemath-cliquer.yml +++ b/.github/workflows/build-passagemath-cliquer.yml @@ -58,85 +58,6 @@ jobs: # gap build-passagemath-libbraiding.yml already excludes it for. python-exclude: 'cp311' - python_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - runs-on: ubuntu-24.04-riscv - env: - PASSAGEMATH_CLIQUER_VERSION: ${{ matrix.version }} - - steps: - - name: checkout passagemath/passagemath passagemath-${{ env.PASSAGEMATH_CLIQUER_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: passagemath/passagemath - ref: passagemath-${{ env.PASSAGEMATH_CLIQUER_VERSION }} - filter: blob:none - sparse-checkout: | - /bootstrap - /pyproject.toml - build - m4 - pkgs/sagemath-cliquer - src/sage/graphs/cliquer.p* - src/sage/graphs/cliquer/cl.c - src/sage/graphs/all__sagemath_cliquer.py - src/sage/all__sagemath_cliquer.py - sparse-checkout-cone-mode: false - persist-credentials: false - - - name: Checkout python-wheels - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - path: python-wheels - persist-credentials: false - - - name: Patch passagemath-cliquer source - run: git apply python-wheels/patches/passagemath-cliquer/${{ env.PASSAGEMATH_CLIQUER_VERSION }}/00*.patch - - - name: Render pyproject.toml - run: ./bootstrap - - # ./bootstrap's own per-package render (sage-package bootstrap) runs all - # ~650 spkgs in parallel batches and aborts a batch outright if any - # member fails (sage_conf's needs the full configure.ac, absent from - # this sparse checkout); render this one package ourselves so it is not - # at the mercy of that batch's luck. - - name: Render pkgs/sagemath-cliquer/pyproject.toml.m4 - working-directory: pkgs/sagemath-cliquer - run: | - export M4PATH="$GITHUB_WORKSPACE/m4" - for f in *.m4; do m4 "$f" > "${f%.m4}"; done - - - name: setup uv - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: build sdist - working-directory: pkgs/sagemath-cliquer - run: | - rm -rf dist/ *.egg-info - uv pip install build setuptools "passagemath-setup==${{ env.PASSAGEMATH_CLIQUER_VERSION }}" "passagemath-environment==${{ env.PASSAGEMATH_CLIQUER_VERSION }}" - python -m build --sdist --no-isolation --skip-dependency-check - - - name: upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: passagemath-cliquer-${{ env.PASSAGEMATH_CLIQUER_VERSION }}-sdist - path: pkgs/sagemath-cliquer/dist/*.tar.gz - if-no-files-found: error - - # cliquer (GPL-2.0-only, per its own COPYING) is compiled straight into the - # wheel from the upstream release tarball, which is not in the image's - # repos, so its source and licence text are collected here rather than - # from an RPM. gpl_sources: needs: [setup] if: needs.setup.outputs.versions != '[]' @@ -165,83 +86,36 @@ jobs: if-no-files-found: error linux: - needs: [setup, python_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build passagemath-cliquer ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - PASSAGEMATH_CLIQUER_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: passagemath-cliquer-${{ env.PASSAGEMATH_CLIQUER_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_MUSLLINUX_RISCV64_IMAGE: ${{ env.MUSLLINUX_RISCV64_IMAGE }} - # Replays build/pkgs/cliquer/spkg-install.in's ./configure && - # make && make install chain against a fixed /usr/local prefix, - # skipping the Sage-specific sdh_* wrappers. cliquer's own - # nobase_include_HEADERS already installs headers nested under - # include/cliquer/, matching cliquer.pxd's `cdef extern from - # "cliquer/graph.h"` etc. - CIBW_BEFORE_ALL_LINUX: | - set -euo pipefail - if command -v apk >/dev/null; then - apk add --no-cache gmp-dev mpfr-dev mpc1-dev curl - else - dnf install -y --setopt=install_weak_deps=False gmp-devel mpfr-devel libmpc-devel - fi - curl -fsSLo /tmp/cliquer.tar.gz https://github.com/dimpase/autocliquer/releases/download/v${{ env.CLIQUER_VERSION }}/cliquer-${{ env.CLIQUER_VERSION }}.tar.gz - echo "${{ env.CLIQUER_SHA256 }} /tmp/cliquer.tar.gz" | sha256sum -c - - tar xzf /tmp/cliquer.tar.gz -C /tmp - cd /tmp/cliquer-${{ env.CLIQUER_VERSION }} - ./configure --prefix=/usr/local --libdir=/usr/local/lib --disable-static --enable-shared - make -j"$(nproc)" - make install - ldconfig || true - CIBW_ENVIRONMENT_LINUX: >- - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH - LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH - CPATH=/usr/local/include:$CPATH - # cysignals is a real runtime need of the compiled extension (it - # raises ModuleNotFoundError at import without it), but upstream's - # own [project] dependencies is empty - it only lists cysignals under - # [build-system] requires - so cibuildwheel's fresh test venv needs - # it supplied explicitly here. - CIBW_TEST_REQUIRES: cysignals - # sagemath-repl/-graphs (the real test extras) are unported, so this - # stands in a minimal duck-typed graph rather than sage's own, - # replaying cliquer.pyx's own doctest for the Petersen graph. - CIBW_TEST_COMMAND: >- - python -c "from sage.graphs.cliquer import max_clique; - edges=[(0,1),(0,4),(0,5),(1,2),(1,6),(2,3),(2,7),(3,4),(3,8),(4,9),(5,7),(5,8),(6,8),(6,9),(7,9)]; - G=type('G',(object,),{'order':lambda s:10,'__iter__':lambda s:iter(range(10)),'edge_iterator':lambda s,labels=None:iter(edges)}); - r=max_clique(G()); - assert sorted(r)==[7,9], r; - print('cliquer ok', r)" - - - name: Check the wheel ships the extension and the vendored licences - run: | - python3 - wheelhouse/*.whl <<'EOF' + # Replays build/pkgs/cliquer/spkg-install.in's ./configure && + # make && make install chain against a fixed /usr/local prefix, + # skipping the Sage-specific sdh_* wrappers. cliquer's own + # nobase_include_HEADERS already installs headers nested under + # include/cliquer/, matching cliquer.pxd's `cdef extern from + # "cliquer/graph.h"` etc. + # cysignals is a real runtime need of the compiled extension (it + # raises ModuleNotFoundError at import without it), but upstream's + # own [project] dependencies is empty - it only lists cysignals under + # [build-system] requires - so cibuildwheel's fresh test venv needs + # it supplied explicitly here. + # sagemath-repl/-graphs (the real test extras) are unported, so this + # stands in a minimal duck-typed graph rather than sage's own, + # replaying cliquer.pyx's own doctest for the Petersen graph. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: passagemath-cliquer + version: ${{ matrix.version }} + source: pypi-sdist + patches: true + post-build: |- + python3 - $GITHUB_WORKSPACE/wheelhouse/*.whl <<'EOF' import sys, zipfile for whl in sys.argv[1:]: names = zipfile.ZipFile(whl).namelist() @@ -252,12 +126,36 @@ jobs: assert licences == {"LICENSE", "LICENSE.cliquer"}, (whl, licences) print(whl, "ok") EOF - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: passagemath-cliquer-${{ env.PASSAGEMATH_CLIQUER_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-musllinux-riscv64-image: quay.io/pypa/musllinux_1_2_riscv64 + cibw-before-all-linux: |- + set -euo pipefail + if command -v apk >/dev/null; then + apk add --no-cache gmp-dev mpfr-dev mpc1-dev curl + else + dnf install -y --setopt=install_weak_deps=False gmp-devel mpfr-devel libmpc-devel + fi + curl -fsSLo /tmp/cliquer.tar.gz https://github.com/dimpase/autocliquer/releases/download/v1.23/cliquer-1.23.tar.gz + echo "c1d7cc927b7efe76ff4f11e1f01bee473e37360fb54843b16b287e3ad161287b /tmp/cliquer.tar.gz" | sha256sum -c - + tar xzf /tmp/cliquer.tar.gz -C /tmp + cd /tmp/cliquer-1.23 + ./configure --prefix=/usr/local --libdir=/usr/local/lib --disable-static --enable-shared + make -j"$(nproc)" + make install + ldconfig || true + cibw-environment-linux: > + LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH + LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH + CPATH=/usr/local/include:$CPATH + cibw-test-requires: cysignals + cibw-test-command: > + python -c "from sage.graphs.cliquer import max_clique; + edges=[(0,1),(0,4),(0,5),(1,2),(1,6),(2,3),(2,7),(3,4),(3,8),(4,9),(5,7),(5,8),(6,8),(6,9),(7,9)]; + G=type('G',(object,),{'order':lambda s:10,'__iter__':lambda s:iter(range(10)),'edge_iterator':lambda s,labels=None:iter(edges)}); + r=max_clique(G()); + assert sorted(r)==[7,9], r; + print('cliquer ok', r)" publish: name: Publish passagemath-cliquer ${{ matrix.version }} diff --git a/.github/workflows/build-passagemath-homfly.yml b/.github/workflows/build-passagemath-homfly.yml index 1dd74886cf7..2040a7b5bf0 100644 --- a/.github/workflows/build-passagemath-homfly.yml +++ b/.github/workflows/build-passagemath-homfly.yml @@ -61,150 +61,35 @@ jobs: package: passagemath-homfly version: ${{ inputs.version }} - python_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - runs-on: ubuntu-24.04-riscv - env: - PASSAGEMATH_HOMFLY_VERSION: ${{ matrix.version }} - - steps: - - name: checkout passagemath/passagemath passagemath-${{ env.PASSAGEMATH_HOMFLY_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: passagemath/passagemath - ref: passagemath-${{ env.PASSAGEMATH_HOMFLY_VERSION }} - filter: blob:none - sparse-checkout: | - /bootstrap - /pyproject.toml - build - m4 - pkgs/sagemath-homfly - src/sage/libs/homfly.p* - src/sage/libs/all__sagemath_homfly.py - src/sage/all__sagemath_homfly.py - sparse-checkout-cone-mode: false - persist-credentials: false - - - name: Checkout python-wheels - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - path: python-wheels - persist-credentials: false - - - name: Patch passagemath-homfly source - run: git apply python-wheels/patches/passagemath-homfly/${{ env.PASSAGEMATH_HOMFLY_VERSION }}/00*.patch - - - name: Render pyproject.toml - run: ./bootstrap - - - name: setup uv - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: build sdist - working-directory: pkgs/sagemath-homfly - run: | - rm -rf dist/ *.egg-info - uv pip install build setuptools "passagemath-setup==${{ env.PASSAGEMATH_HOMFLY_VERSION }}" "passagemath-environment==${{ env.PASSAGEMATH_HOMFLY_VERSION }}" - python -m build --sdist --no-isolation --skip-dependency-check - - - name: upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: passagemath-homfly-${{ env.PASSAGEMATH_HOMFLY_VERSION }}-sdist - path: pkgs/sagemath-homfly/dist/*.tar.gz - if-no-files-found: error - # gc is a permissive licence (see LICENSE.gc); libhomfly is public domain # (the Unlicense). Neither is GPL, so no gpl_sources job is needed here # (unlike build-passagemath-bliss.yml's LGPL/GPL bliss dependency). linux: - needs: [setup, python_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build passagemath-homfly ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - PASSAGEMATH_HOMFLY_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: passagemath-homfly-${{ env.PASSAGEMATH_HOMFLY_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_MUSLLINUX_RISCV64_IMAGE: ${{ env.MUSLLINUX_RISCV64_IMAGE }} - # Replays build/pkgs/gc and build/pkgs/libhomfly/spkg-install.in's - # ./configure && make && make install chain against a fixed - # /usr/local prefix, skipping the Sage-specific sdh_* wrappers. - # gmp/mpfr/mpc: gmpy2's PyPI sdist, pulled in as a build-system-requires - # dependency of passagemath-objects, compiles against system headers - # for all three (same as build-passagemath-objects.yml and - # build-passagemath-cddlib.yml). - CIBW_BEFORE_ALL_LINUX: | - set -euo pipefail - if command -v apk >/dev/null; then - apk add --no-cache curl gmp-dev mpfr-dev mpc1-dev - else - dnf install -y --setopt=install_weak_deps=False libatomic_ops-devel gmp-devel mpfr-devel libmpc-devel - fi - curl -fsSLo /tmp/gc.tar.gz https://github.com/ivmai/bdwgc/releases/download/v${{ env.GC_VERSION }}/gc-${{ env.GC_VERSION }}.tar.gz - echo "${{ env.GC_SHA256 }} /tmp/gc.tar.gz" | sha256sum -c - - tar xzf /tmp/gc.tar.gz -C /tmp - cd /tmp/gc-${{ env.GC_VERSION }} - ./configure --prefix=/usr/local --libdir=/usr/local/lib --enable-large-config --enable-cplusplus - make -j"$(nproc)" - make install - ldconfig || true - curl -fsSLo /tmp/libhomfly.tar.gz https://github.com/miguelmarco/libhomfly/releases/download/${{ env.LIBHOMFLY_VERSION }}/libhomfly-${{ env.LIBHOMFLY_VERSION }}.tar.gz - echo "${{ env.LIBHOMFLY_SHA256 }} /tmp/libhomfly.tar.gz" | sha256sum -c - - tar xzf /tmp/libhomfly.tar.gz -C /tmp - cd /tmp/libhomfly-${{ env.LIBHOMFLY_VERSION }} - CFLAGS="-std=gnu17" ./configure --prefix=/usr/local --libdir=/usr/local/lib - make -j"$(nproc)" - make install - ldconfig || true - CIBW_ENVIRONMENT_LINUX: >- - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH - LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH - CPATH=/usr/local/include:$CPATH - # sagemath-graphs/-repl (the real test extras) are unported, so this - # replays homfly.pyx's own doctest value for the trefoil knot. - CIBW_TEST_COMMAND: >- - python -c "from sage.libs.homfly import homfly_polynomial_dict; - d=homfly_polynomial_dict('1 6 0 1 1 -1 2 1 0 -1 1 1 2 -1 0 1 1 1 2 1'); - assert d == {(-4, 0): -1, (-2, 0): -2, (-2, 2): 1}, d; - print('homfly ok', d)" - - - name: Check the wheel ships the extension and the vendored licences - run: | - python3 - wheelhouse/*.whl <<'EOF' + # Replays build/pkgs/gc and build/pkgs/libhomfly/spkg-install.in's + # ./configure && make && make install chain against a fixed + # /usr/local prefix, skipping the Sage-specific sdh_* wrappers. + # gmp/mpfr/mpc: gmpy2's PyPI sdist, pulled in as a build-system-requires + # dependency of passagemath-objects, compiles against system headers + # for all three (same as build-passagemath-objects.yml and + # build-passagemath-cddlib.yml). + # sagemath-graphs/-repl (the real test extras) are unported, so this + # replays homfly.pyx's own doctest value for the trefoil knot. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: passagemath-homfly + version: ${{ matrix.version }} + source: pypi-sdist + patches: true + post-build: |- + python3 - $GITHUB_WORKSPACE/wheelhouse/*.whl <<'EOF' import sys, zipfile for whl in sys.argv[1:]: names = zipfile.ZipFile(whl).namelist() @@ -216,12 +101,41 @@ jobs: assert licences == {"LICENSE", "LICENSE.gc", "LICENSE.libhomfly"}, (whl, licences) print(whl, "ok") EOF - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: passagemath-homfly-${{ env.PASSAGEMATH_HOMFLY_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-musllinux-riscv64-image: quay.io/pypa/musllinux_1_2_riscv64 + cibw-before-all-linux: |- + set -euo pipefail + if command -v apk >/dev/null; then + apk add --no-cache curl gmp-dev mpfr-dev mpc1-dev + else + dnf install -y --setopt=install_weak_deps=False libatomic_ops-devel gmp-devel mpfr-devel libmpc-devel + fi + curl -fsSLo /tmp/gc.tar.gz https://github.com/ivmai/bdwgc/releases/download/v8.2.12/gc-8.2.12.tar.gz + echo "42e5194ad06ab6ffb806c83eb99c03462b495d979cda782f3c72c08af833cd4e /tmp/gc.tar.gz" | sha256sum -c - + tar xzf /tmp/gc.tar.gz -C /tmp + cd /tmp/gc-8.2.12 + ./configure --prefix=/usr/local --libdir=/usr/local/lib --enable-large-config --enable-cplusplus + make -j"$(nproc)" + make install + ldconfig || true + curl -fsSLo /tmp/libhomfly.tar.gz https://github.com/miguelmarco/libhomfly/releases/download/1.04/libhomfly-1.04.tar.gz + echo "659a77b4f4b53340d24a7d6a69f4219e77ab9439a6ab8afa0156b7f6bd7af64f /tmp/libhomfly.tar.gz" | sha256sum -c - + tar xzf /tmp/libhomfly.tar.gz -C /tmp + cd /tmp/libhomfly-1.04 + CFLAGS="-std=gnu17" ./configure --prefix=/usr/local --libdir=/usr/local/lib + make -j"$(nproc)" + make install + ldconfig || true + cibw-environment-linux: > + LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH + LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH + CPATH=/usr/local/include:$CPATH + cibw-test-command: > + python -c "from sage.libs.homfly import homfly_polynomial_dict; + d=homfly_polynomial_dict('1 6 0 1 1 -1 2 1 0 -1 1 1 2 -1 0 1 1 1 2 1'); + assert d == {(-4, 0): -1, (-2, 0): -2, (-2, 2): 1}, d; + print('homfly ok', d)" publish: name: Publish passagemath-homfly ${{ matrix.version }} diff --git a/.github/workflows/build-passagemath-mcqd.yml b/.github/workflows/build-passagemath-mcqd.yml index dc7dbc58025..4a8562757e0 100644 --- a/.github/workflows/build-passagemath-mcqd.yml +++ b/.github/workflows/build-passagemath-mcqd.yml @@ -57,83 +57,6 @@ jobs: package: passagemath-mcqd version: ${{ inputs.version }} - python_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - runs-on: ubuntu-24.04-riscv - env: - PASSAGEMATH_MCQD_VERSION: ${{ matrix.version }} - - steps: - - name: checkout passagemath/passagemath passagemath-${{ env.PASSAGEMATH_MCQD_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: passagemath/passagemath - ref: passagemath-${{ env.PASSAGEMATH_MCQD_VERSION }} - filter: blob:none - sparse-checkout: | - /bootstrap - /pyproject.toml - build - m4 - pkgs/sagemath-mcqd - src/sage/graphs/mcqd.p* - src/sage/graphs/all__sagemath_mcqd.py - src/sage/all__sagemath_mcqd.py - sparse-checkout-cone-mode: false - persist-credentials: false - - - name: Checkout python-wheels - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - path: python-wheels - persist-credentials: false - - - name: Patch passagemath-mcqd source - run: git apply python-wheels/patches/passagemath-mcqd/${{ env.PASSAGEMATH_MCQD_VERSION }}/00*.patch - - - name: Render pyproject.toml - run: ./bootstrap - - # ./bootstrap's own per-package render (sage-package bootstrap) runs all - # ~650 spkgs in parallel batches and aborts a batch outright if any - # member fails (sage_conf's needs the full configure.ac, absent from - # this sparse checkout); render this one package ourselves so it is - # not at the mercy of that batch's luck. - - name: Render pkgs/sagemath-mcqd/pyproject.toml.m4 - working-directory: pkgs/sagemath-mcqd - run: | - export M4PATH="$GITHUB_WORKSPACE/m4" - for f in *.m4; do m4 "$f" > "${f%.m4}"; done - - - name: setup uv - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: build sdist - working-directory: pkgs/sagemath-mcqd - run: | - rm -rf dist/ *.egg-info - uv pip install build setuptools "passagemath-setup==${{ env.PASSAGEMATH_MCQD_VERSION }}" "passagemath-environment==${{ env.PASSAGEMATH_MCQD_VERSION }}" - python -m build --sdist --no-isolation --skip-dependency-check - - - name: upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: passagemath-mcqd-${{ env.PASSAGEMATH_MCQD_VERSION }}-sdist - path: pkgs/sagemath-mcqd/dist/*.tar.gz - if-no-files-found: error - - # mcqd (GPL-3.0-or-later) is compiled straight into the wheel from the - # pinned commit, which is not in the image's repos, so its source and - # licence text are collected here rather than from an RPM. gpl_sources: needs: [setup] if: needs.setup.outputs.versions != '[]' @@ -164,62 +87,27 @@ jobs: if-no-files-found: error linux: - needs: [setup, python_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build passagemath-mcqd ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - PASSAGEMATH_MCQD_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: passagemath-mcqd-${{ env.PASSAGEMATH_MCQD_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # Replays build/pkgs/mcqd/spkg-install.in: strip the verbose debug - # print, build libmcqd.so from mcqd.cpp alone, install it and the - # header where the compiler already looks (gotcha 140). - CIBW_BEFORE_ALL_LINUX: >- - git clone ${{ env.MCQD_REPO }} /tmp/mcqd && - cd /tmp/mcqd && - test "$(git rev-parse HEAD)" = "${{ env.MCQD_COMMIT }}" && - grep -v "std..cout.*current max" mcqd.h > mcqd2.h && mv mcqd2.h mcqd.h && - g++ -fPIC -O3 -c mcqd.cpp -o mcqd.o && - g++ -shared mcqd.o -o "$([ -d /usr/lib64 ] && echo /usr/lib64 || echo /usr/lib)/libmcqd.so" && - (ldconfig || true) && - cp mcqd.h /usr/include/ - CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - # sagemath-repl/-graphs/-cliquer (the real test extras) are unported, - # so this stands in a minimal duck-typed graph rather than sage's own. - CIBW_TEST_COMMAND: >- - python -c "from sage.graphs.mcqd import mcqd; - adj={0:{1,2},1:{0,2},2:{0,1,3},3:{2}}; - G=type('G',(object,),{'order':lambda s:4,'vertices':lambda s,sort=False:list(range(4)),'neighbors':lambda s,v:list(adj[v]),'__iter__':lambda s:iter(range(4))}); - r=mcqd(G()); - assert sorted(r)==[0,1,2], r; - print('mcqd ok', r)" - - - name: Check the wheel ships the extension and the vendored licence - run: | - python3 - wheelhouse/*.whl <<'EOF' + # Replays build/pkgs/mcqd/spkg-install.in: strip the verbose debug + # print, build libmcqd.so from mcqd.cpp alone, install it and the + # header where the compiler already looks (gotcha 140). + # sagemath-repl/-graphs/-cliquer (the real test extras) are unported, + # so this stands in a minimal duck-typed graph rather than sage's own. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: passagemath-mcqd + version: ${{ matrix.version }} + source: pypi-sdist + patches: true + post-build: |- + python3 - $GITHUB_WORKSPACE/wheelhouse/*.whl <<'EOF' import sys, zipfile for whl in sys.argv[1:]: names = zipfile.ZipFile(whl).namelist() @@ -241,12 +129,24 @@ jobs: assert licences == {"LICENSE", "LICENSE.mcqd"}, (whl, licences) print(whl, "ok") EOF - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: passagemath-mcqd-${{ env.PASSAGEMATH_MCQD_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-before-all-linux: > + git clone https://gitlab.com/janezkonc/mcqd /tmp/mcqd && + cd /tmp/mcqd && + test "$(git rev-parse HEAD)" = "9ab9717cf7d1be1a85b165a8eacb71b9e5831113" && + grep -v "std..cout.*current max" mcqd.h > mcqd2.h && mv mcqd2.h mcqd.h && + g++ -fPIC -O3 -c mcqd.cpp -o mcqd.o && + g++ -shared mcqd.o -o "$([ -d /usr/lib64 ] && echo /usr/lib64 || echo /usr/lib)/libmcqd.so" && + (ldconfig || true) && + cp mcqd.h /usr/include/ + cibw-test-command: > + python -c "from sage.graphs.mcqd import mcqd; + adj={0:{1,2},1:{0,2},2:{0,1,3},3:{2}}; + G=type('G',(object,),{'order':lambda s:4,'vertices':lambda s,sort=False:list(range(4)),'neighbors':lambda s,v:list(adj[v]),'__iter__':lambda s:iter(range(4))}); + r=mcqd(G()); + assert sorted(r)==[0,1,2], r; + print('mcqd ok', r)" publish: name: Publish passagemath-mcqd ${{ matrix.version }} diff --git a/.github/workflows/build-passagemath-objects.yml b/.github/workflows/build-passagemath-objects.yml index fdc14e2e8d6..26c9c38f0c3 100644 --- a/.github/workflows/build-passagemath-objects.yml +++ b/.github/workflows/build-passagemath-objects.yml @@ -1,12 +1,9 @@ # SPDX-FileCopyrightText: 2026 The RISE Project # SPDX-License-Identifier: MIT --- -# passagemath-objects is split out of the passagemath/passagemath monorepo -# (a SageMath fork) at pkgs/sagemath-objects, tagged passagemath-. -# This replays build/pkgs/sagemath_objects/spkg-src (./bootstrap renders the -# package's pyproject.toml, then `python -m build --sdist --no-isolation`) -# rather than the full ./configure && make python_build chain upstream's own -# release tooling uses for the complete Sage distribution. +# passagemath-objects is split from the passagemath/passagemath monorepo +# (a SageMath fork). Build from the split distribution's published sdist +# rather than the complete Sage distribution's configure and build chain. name: Build passagemath-objects wheels (riscv64) on: @@ -51,215 +48,27 @@ jobs: package: passagemath-objects version: ${{ inputs.version }} - python_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - runs-on: ubuntu-24.04-riscv - env: - PASSAGEMATH_OBJECTS_VERSION: ${{ matrix.version }} - - steps: - - name: checkout passagemath/passagemath passagemath-${{ env.PASSAGEMATH_OBJECTS_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: passagemath/passagemath - ref: passagemath-${{ env.PASSAGEMATH_OBJECTS_VERSION }} - filter: blob:none - # Each namespace-package directory below needs its own - # all__sagemath_objects.py (sage_setup's is_package_or_sage_namespace_package_dir - # marker for this distribution); without it sage_setup's os.walk prunes the - # whole directory from the wheel. src/sage/structure and src/sage/cpython are - # checked out in full, so their real markers come along already. - sparse-checkout: | - /bootstrap - /pyproject.toml - build - m4 - pkgs/sagemath-objects - src/sage/structure - src/sage/cpython - src/sage/libs/gmp - src/sage/libs/gmpxx.pxd - src/sage/libs/all__sagemath_objects.py - src/sage/categories/action.* - src/sage/categories/algebra_functor.* - src/sage/categories/basic.* - src/sage/categories/cartesian_product.* - src/sage/categories/category*.* - src/sage/categories/covariant_functorial_construction.* - src/sage/categories/facade_sets.* - src/sage/categories/functor.* - src/sage/categories/homset.* - src/sage/categories/homsets.* - src/sage/categories/map.* - src/sage/categories/morphism.* - src/sage/categories/isomorphic_objects.* - src/sage/categories/objects.* - src/sage/categories/primer.* - src/sage/categories/pushout.* - src/sage/categories/quotients.* - src/sage/categories/realizations.* - src/sage/categories/sets_cat.* - src/sage/categories/sets_with_partial_maps.* - src/sage/categories/subobjects.* - src/sage/categories/subquotients.* - src/sage/categories/with_realizations.* - src/sage/categories/all__sagemath_objects.py - src/sage/misc/classcall_metaclass.* - src/sage/misc/inherit_comparison*.* - src/sage/misc/weak_dict.* - src/sage/misc/nested_class*.* - src/sage/misc/test_nested_class*.p* - src/sage/misc/abstract_method.* - src/sage/misc/cachefunc.* - src/sage/misc/decorators.* - src/sage/misc/c3_controlled.* - src/sage/misc/lazy_attribute.* - src/sage/misc/function_mangling.* - src/sage/misc/lazy_string.* - src/sage/misc/lazy_format.* - src/sage/misc/unknown.* - src/sage/misc/fast_methods.* - src/sage/misc/constant_function.* - src/sage/misc/call.* - src/sage/misc/bindable_class.* - src/sage/misc/namespace_package.p* - src/sage/misc/verbose.* - src/sage/misc/repr.* - src/sage/misc/superseded.* - src/sage/misc/misc_c.* - src/sage/misc/flatten.* - src/sage/misc/lazy_list.p* - src/sage/misc/lazy_import*.* - src/sage/misc/sageinspect.* - src/sage/misc/instancedoc.* - src/sage/misc/persist.* - src/sage/misc/sage_unittest.* - src/sage/misc/fpickle.p* - src/sage/misc/randstate.* - src/sage/misc/prandom.* - src/sage/misc/misc.* - src/sage/misc/timing.p* - src/sage/misc/globals.p* - src/sage/misc/sage_timeit*.p* - src/sage/misc/session.p* - src/sage/misc/reset.p* - src/sage/misc/sage_ostools.p* - src/sage/misc/inherit_comparison_impl.c - src/sage/misc/all__sagemath_objects.py - src/sage/ext/stdsage.pxd - src/sage/ext/mod_int.* - src/sage/ext/cplusplus.pxd - src/sage/ext/ccobject.h - src/sage/ext/all__sagemath_objects.py - src/sage/sets/pythonclass.* - src/sage/sets/all__sagemath_objects.py - src/sage/arith/power.* - src/sage/arith/numerical_approx.* - src/sage/arith/long.* - src/sage/arith/all__sagemath_objects.py - src/sage/rings/integer_fake.* - src/sage/rings/all__sagemath_objects.py - src/sage/groups/group.* - src/sage/groups/old.* - src/sage/groups/all__sagemath_objects.py - src/sage/modules/module.p* - src/sage/modules/all__sagemath_objects.py - src/sage/cpython/debugimpl.c - src/sage/__init__.py - src/sage/all__sagemath_objects.py - sparse-checkout-cone-mode: false - persist-credentials: false - - - name: Checkout python-wheels - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - path: python-wheels - persist-credentials: false - - # setup.py imports sage_setup, and pyproject.toml.m4 needs the - # SPKG_INSTALL_REQUIRES_* macros bootstrap renders from the top-level - # pyproject.toml, falling back to every spkg's version_requirements.txt - # (hence /pyproject.toml and the full build/ checkout above); this - # is the lightweight per-package render, not the full - # ./configure && make python_build chain the whole Sage distribution needs. - - name: Patch passagemath-objects source - run: git apply python-wheels/patches/passagemath-objects/${{ env.PASSAGEMATH_OBJECTS_VERSION }}/00*.patch - - - name: Render pyproject.toml - run: ./bootstrap - - - name: setup uv - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: build sdist - working-directory: pkgs/sagemath-objects - run: | - rm -rf dist/ *.egg-info - # --no-isolation means build uses this environment as-is rather than - # creating its own from build-system.requires, so setuptools (the - # rendered pyproject.toml's build backend) must be installed here too. - uv pip install build setuptools "passagemath-setup==${{ env.PASSAGEMATH_OBJECTS_VERSION }}" "passagemath-environment==${{ env.PASSAGEMATH_OBJECTS_VERSION }}" - python -m build --sdist --no-isolation --skip-dependency-check - - - name: upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: passagemath-objects-${{ env.PASSAGEMATH_OBJECTS_VERSION }}-sdist - path: pkgs/sagemath-objects/dist/*.tar.gz - if-no-files-found: error - linux: - needs: [setup, python_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build passagemath-objects ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - PASSAGEMATH_OBJECTS_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: passagemath-objects-${{ env.PASSAGEMATH_OBJECTS_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # gmp/mpfr/mpc satisfy Sage's own spkg-configure.m4 minimum-version - # checks, so the system -devel packages are enough; no from-source - # build needed (unlike gmpy2, which vendors its own copies). - CIBW_BEFORE_ALL_LINUX: dnf install -y gmp-devel mpfr-devel libmpc-devel - CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: passagemath-objects-${{ env.PASSAGEMATH_OBJECTS_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error - + # gmp/mpfr/mpc satisfy Sage's own spkg-configure.m4 minimum-version + # checks, so the system -devel packages are enough; no from-source + # build needed (unlike gmpy2, which vendors its own copies). + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: passagemath-objects + version: ${{ matrix.version }} + source: pypi-sdist + patches: true + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-before-all-linux: dnf install -y gmp-devel mpfr-devel libmpc-devel publish: name: Publish passagemath-objects ${{ matrix.version }} needs: [setup, linux] diff --git a/.github/workflows/build-pymonocypher.yml b/.github/workflows/build-pymonocypher.yml index 845b0522d97..01e917ff01a 100644 --- a/.github/workflows/build-pymonocypher.yml +++ b/.github/workflows/build-pymonocypher.yml @@ -45,94 +45,32 @@ jobs: package: pymonocypher version: ${{ inputs.version }} - build_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - name: Build pymonocypher ${{ matrix.version }} sdist - runs-on: ubuntu-latest - env: - PYMONOCYPHER_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout pymonocypher v${{ env.PYMONOCYPHER_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: jetperch/pymonocypher - ref: v${{ env.PYMONOCYPHER_VERSION }} - persist-credentials: false - - - name: Install Python - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Build sdist - id: sdist - run: | - uv pip install build - python -m build --sdist - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: pymonocypher-${{ env.PYMONOCYPHER_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build pymonocypher ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - PYMONOCYPHER_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: pymonocypher-${{ env.PYMONOCYPHER_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # numpy is test-only here (test_monocypher.py cross-checks against hashlib - # with numpy-generated random inputs); only our registry has it for riscv64. - CIBW_TEST_ENVIRONMENT: >- - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - PIP_ONLY_BINARY=numpy - CIBW_TEST_REQUIRES: pytest numpy - CIBW_TEST_COMMAND: pytest {package}/test - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: pymonocypher-${{ matrix.version }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: pymonocypher + version: ${{ matrix.version }} + source: pypi-sdist + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + # numpy is test-only here (test_monocypher.py cross-checks against hashlib + # with numpy-generated random inputs); only our registry has it for riscv64. + cibw-test-environment: > + PIP_ONLY_BINARY=numpy + cibw-test-requires: pytest numpy + cibw-test-command: pytest {package}/test publish: name: Publish pymonocypher ${{ matrix.version }} - needs: [setup, build_sdist, build_wheels] + needs: [setup, build_wheels] if: needs.setup.outputs.versions != '[]' strategy: fail-fast: false diff --git a/.github/workflows/build-pymunk.yml b/.github/workflows/build-pymunk.yml index 33cf6b1e962..3faf0312723 100644 --- a/.github/workflows/build-pymunk.yml +++ b/.github/workflows/build-pymunk.yml @@ -45,91 +45,27 @@ jobs: package: pymunk version: ${{ inputs.version }} - build_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - name: Build pymunk ${{ matrix.version }} sdist - runs-on: ubuntu-latest - env: - PYMUNK_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout pymunk ${{ env.PYMUNK_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: viblo/pymunk - ref: ${{ env.PYMUNK_VERSION }} - # Munk2D (vendored Chipmunk2D) is a submodule; MANIFEST.in's - # recursive-include only bundles it into the sdist if present. - submodules: true - persist-credentials: false - - - name: Install Python - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Build sdist - id: sdist - run: | - uv pip install build - python -m build --sdist - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: pymunk-${{ env.PYMUNK_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build pymunk ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - PYMUNK_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: pymunk-${{ env.PYMUNK_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # cffi, needed to build and to import the extension, has no riscv64 wheel on PyPI. - CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: pymunk-${{ matrix.version }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error - + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: pymunk + version: ${{ matrix.version }} + # The PyPI sdist contains the Munk2D/Chipmunk2D submodule sources. + source: pypi-sdist + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + # cffi, needed to build and to import the extension, has no riscv64 wheel on PyPI. publish: name: Publish pymunk ${{ matrix.version }} - needs: [setup, build_sdist, build_wheels] + needs: [setup, build_wheels] if: needs.setup.outputs.versions != '[]' strategy: fail-fast: false diff --git a/.github/workflows/build-pyyaml-ft.yml b/.github/workflows/build-pyyaml-ft.yml index 869f413911c..b023ed44a87 100644 --- a/.github/workflows/build-pyyaml-ft.yml +++ b/.github/workflows/build-pyyaml-ft.yml @@ -58,145 +58,58 @@ jobs: package: pyyaml-ft version: ${{ inputs.version }} - build_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - name: Build pyyaml-ft ${{ matrix.version }} sdist - runs-on: ubuntu-latest - env: - PYYAML_FT_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout pyyaml-ft ${{ env.PYYAML_FT_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: Quansight-Labs/pyyaml-ft - ref: v${{ env.PYYAML_FT_VERSION }} - persist-credentials: false - - - name: Install Python - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Build sdist - id: sdist - env: - PYYAML_FORCE_CYTHON: 1 - PYYAML_FORCE_LIBYAML: 0 - run: | - set -euo pipefail - rm -rf dist - uv pip install build - python -m build --sdist --outdir dist - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: pyyaml-ft-${{ env.PYYAML_FT_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - # Mirrors upstream's cp313 (GIL) build. build_gil: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' strategy: fail-fast: false matrix: version: ${{ fromJSON(needs.setup.outputs.versions) }} name: Build pyyaml-ft ${{ matrix.version }} cp313-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 - env: - PYYAML_FT_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: pyyaml-ft-${{ env.PYYAML_FT_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build and test wheel - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: 'cp313-*' - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_BEFORE_ALL_LINUX: ${{ env.BEFORE_ALL_LIBYAML }} - CIBW_ENVIRONMENT: PYYAML_FORCE_CYTHON=1 PYYAML_FORCE_LIBYAML=1 - CIBW_TEST_REQUIRES: pytest pytest-run-parallel - CIBW_TEST_COMMAND: >- - pytest {package} && - pytest --parallel-threads=auto --iterations=20 {package}/tests/free_threading - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: pyyaml-ft-${{ env.PYYAML_FT_VERSION }}-cp313-manylinux_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: pyyaml-ft + version: ${{ matrix.version }} + source: pypi-sdist + artifact-tag: cp313-manylinux_riscv64 + timeout-minutes: 90 + cibw-build: cp313-* + cibw-before-all-linux: set -eux && curl -L -o libyaml.tar.gz https://github.com/yaml/libyaml/archive/refs/tags/0.2.5.tar.gz && tar xzf libyaml.tar.gz && rm libyaml.tar.gz && cd libyaml-0.2.5 && ./bootstrap && ./configure --disable-dependency-tracking --with-pic --enable-shared=no && make install && cd .. && rm -rf libyaml-0.2.5 + cibw-environment-linux: PYYAML_FORCE_CYTHON=1 PYYAML_FORCE_LIBYAML=1 + cibw-test-requires: pytest pytest-run-parallel + cibw-test-command: > + pytest {package} && + pytest --parallel-threads=auto --iterations=20 {package}/tests/free_threading # Free-threaded wheel: only cp314t - the riscv64 image has no cp313t interpreter # (gotcha 11), even though upstream's own matrix targets cp313t. build_freethreaded: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' strategy: fail-fast: false matrix: version: ${{ fromJSON(needs.setup.outputs.versions) }} name: Build pyyaml-ft ${{ matrix.version }} cp314t-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 - env: - PYYAML_FT_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: pyyaml-ft-${{ env.PYYAML_FT_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build and test wheel - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: 'cp314t-*' - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_BEFORE_ALL_LINUX: ${{ env.BEFORE_ALL_LIBYAML }} - CIBW_ENVIRONMENT: PYYAML_FORCE_CYTHON=1 PYYAML_FORCE_LIBYAML=1 - CIBW_TEST_REQUIRES: pytest pytest-run-parallel - CIBW_TEST_COMMAND: >- - pytest {package} && - pytest --parallel-threads=auto --iterations=20 {package}/tests/free_threading - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: pyyaml-ft-${{ env.PYYAML_FT_VERSION }}-cp314t-manylinux_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: pyyaml-ft + version: ${{ matrix.version }} + source: pypi-sdist + artifact-tag: cp314t-manylinux_riscv64 + timeout-minutes: 90 + cibw-build: cp314t-* + cibw-before-all-linux: set -eux && curl -L -o libyaml.tar.gz https://github.com/yaml/libyaml/archive/refs/tags/0.2.5.tar.gz && tar xzf libyaml.tar.gz && rm libyaml.tar.gz && cd libyaml-0.2.5 && ./bootstrap && ./configure --disable-dependency-tracking --with-pic --enable-shared=no && make install && cd .. && rm -rf libyaml-0.2.5 + cibw-environment-linux: PYYAML_FORCE_CYTHON=1 PYYAML_FORCE_LIBYAML=1 + cibw-test-requires: pytest pytest-run-parallel + cibw-test-command: > + pytest {package} && + pytest --parallel-threads=auto --iterations=20 {package}/tests/free_threading publish: name: Publish pyyaml-ft ${{ matrix.version }} - needs: [setup, build_sdist, build_gil, build_freethreaded] + needs: [setup, build_gil, build_freethreaded] if: needs.setup.outputs.versions != '[]' strategy: fail-fast: false diff --git a/.github/workflows/build-rcssmin.yml b/.github/workflows/build-rcssmin.yml index 7bcc2c405c7..220d036c39b 100644 --- a/.github/workflows/build-rcssmin.yml +++ b/.github/workflows/build-rcssmin.yml @@ -43,97 +43,31 @@ jobs: package: rcssmin version: ${{ inputs.version }} - build_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - # The sdist is architecture-independent, so build it once on x86 instead of - # a scarce riscv runner. It also excludes debug.unix.cflags, a - # coverage/-Werror dev-build flag file that MANIFEST.in doesn't ship in the - # sdist; checking out the git tag directly for cibuildwheel (as the first - # version of this workflow did) picks that file up and fails cp314t with - # "ISO C90 forbids mixed declarations and code" from CPython's own - # free-threaded refcount.h. - name: Build rcssmin ${{ matrix.version }} sdist - runs-on: ubuntu-latest - permissions: - contents: read - env: - RCSSMIN_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout rcssmin ${{ env.RCSSMIN_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: ndparker/rcssmin - ref: ${{ env.RCSSMIN_VERSION }} - persist-credentials: false - - - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Build sdist - id: sdist - run: | - uv pip install build - python -m build --sdist - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: rcssmin-${{ env.RCSSMIN_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build rcssmin ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - RCSSMIN_VERSION: ${{ matrix.version }} - - steps: - - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: rcssmin-${{ env.RCSSMIN_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # setup.py silently falls back to a pure-Python build if the C - # extension fails to compile (gotcha 20); this makes it hard-fail. - CIBW_ENVIRONMENT: SETUP_CEXT_REQUIRED=1 - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_SOURCES: tests - CIBW_TEST_COMMAND: >- - python -c "import _rcssmin as m; assert m.__file__.endswith('.so'), m.__file__" && - python -m pytest tests - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: rcssmin-${{ env.RCSSMIN_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: rcssmin + version: ${{ matrix.version }} + # The PyPI sdist excludes debug.unix.cflags, whose coverage/-Werror flags break cp314t. + source: pypi-sdist + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + # setup.py silently falls back to a pure-Python build if the C + # extension fails to compile (gotcha 20); this makes it hard-fail. + cibw-environment-linux: SETUP_CEXT_REQUIRED=1 + cibw-test-requires: pytest + cibw-test-sources: tests + cibw-test-command: > + python -c "import _rcssmin as m; assert m.__file__.endswith('.so'), m.__file__" && + python -m pytest tests publish: name: Publish rcssmin ${{ matrix.version }} diff --git a/.github/workflows/build-rjsmin.yml b/.github/workflows/build-rjsmin.yml index ec74ec85a7f..decffe49837 100644 --- a/.github/workflows/build-rjsmin.yml +++ b/.github/workflows/build-rjsmin.yml @@ -45,97 +45,31 @@ jobs: package: rjsmin version: ${{ inputs.version }} - build_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - # The sdist is architecture-independent, so build it once on x86 instead of - # a scarce riscv runner. It also excludes debug.unix.cflags, a - # coverage/-Werror dev-build flag file that MANIFEST.in doesn't ship in the - # sdist; checking out the git tag directly for cibuildwheel (as the first - # version of this workflow did) picks that file up and fails cp314t with - # "ISO C90 forbids mixed declarations and code" from CPython's own - # free-threaded refcount.h. - name: Build rjsmin ${{ matrix.version }} sdist - runs-on: ubuntu-latest - permissions: - contents: read - env: - RJSMIN_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout rjsmin ${{ env.RJSMIN_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: ndparker/rjsmin - ref: ${{ env.RJSMIN_VERSION }} - persist-credentials: false - - - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Build sdist - id: sdist - run: | - uv pip install build - python -m build --sdist - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: rjsmin-${{ env.RJSMIN_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build rjsmin ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - RJSMIN_VERSION: ${{ matrix.version }} - - steps: - - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: rjsmin-${{ env.RJSMIN_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # setup.py silently falls back to a pure-Python wheel if the C - # extension fails to build; this is its own knob to make that fatal. - CIBW_ENVIRONMENT: SETUP_CEXT_REQUIRED=1 - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_SOURCES: tests - CIBW_TEST_COMMAND: >- - python -c "import _rjsmin as m; assert m.__file__.endswith('.so'), m.__file__" && - python -m pytest tests - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: rjsmin-${{ env.RJSMIN_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: rjsmin + version: ${{ matrix.version }} + # The PyPI sdist excludes debug.unix.cflags, whose coverage/-Werror flags break cp314t. + source: pypi-sdist + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + # setup.py silently falls back to a pure-Python wheel if the C + # extension fails to build; this is its own knob to make that fatal. + cibw-environment-linux: SETUP_CEXT_REQUIRED=1 + cibw-test-requires: pytest + cibw-test-sources: tests + cibw-test-command: > + python -c "import _rjsmin as m; assert m.__file__.endswith('.so'), m.__file__" && + python -m pytest tests publish: name: Publish rjsmin ${{ matrix.version }} diff --git a/.github/workflows/build-rpi-gpio.yml b/.github/workflows/build-rpi-gpio.yml index 55f52610225..97c31064048 100644 --- a/.github/workflows/build-rpi-gpio.yml +++ b/.github/workflows/build-rpi-gpio.yml @@ -46,91 +46,27 @@ jobs: package: rpi-gpio version: ${{ inputs.version }} - build_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - name: Build RPi.GPIO ${{ matrix.version }} sdist - runs-on: ubuntu-latest - env: - RPI_GPIO_VERSION: ${{ matrix.version }} - - steps: - - name: Install Mercurial - run: sudo apt-get update -q && sudo apt-get install -y -q mercurial - - # SourceForge serves anonymous Mercurial clones over http only. - - name: Checkout RPi.GPIO ${{ env.RPI_GPIO_VERSION }} - run: hg clone -u "${RPI_GPIO_VERSION}" http://hg.code.sf.net/p/raspberry-gpio-python/code rpi-gpio - - - name: Install Python - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Build sdist - working-directory: rpi-gpio - run: | - set -euo pipefail - uv pip install build twine - python -m build --sdist --outdir ../dist - twine check ../dist/* - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: rpi-gpio-${{ env.RPI_GPIO_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build RPi.GPIO ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - RPI_GPIO_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: rpi-gpio-${{ env.RPI_GPIO_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build and test wheel - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # Upstream's tests drive real Raspberry Pi pins; off a Pi the extension - # loads and its module init rejects the board with exactly this error. - CIBW_TEST_COMMAND: >- - python -c "import RPi.GPIO" 2>&1 | - grep -x 'RuntimeError: This module can only be run on a Raspberry Pi!' - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: rpi-gpio-${{ env.RPI_GPIO_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: rpi-gpio + version: ${{ matrix.version }} + source: pypi-sdist + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + # Upstream's tests drive real Raspberry Pi pins; off a Pi the extension + # loads and its module init rejects the board with exactly this error. + cibw-test-command: > + python -c "import RPi.GPIO" 2>&1 | + grep -x 'RuntimeError: This module can only be run on a Raspberry Pi!' publish: name: Publish RPi.GPIO ${{ matrix.version }} diff --git a/.github/workflows/build-sqlalchemy.yml b/.github/workflows/build-sqlalchemy.yml index 2c70202a2ea..c85fa1a266a 100644 --- a/.github/workflows/build-sqlalchemy.yml +++ b/.github/workflows/build-sqlalchemy.yml @@ -49,121 +49,35 @@ jobs: package: sqlalchemy version: ${{ inputs.version }} - build_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - name: Build sqlalchemy ${{ matrix.version }} sdist - runs-on: ubuntu-latest - permissions: - contents: read - env: - SQLALCHEMY_VERSION: ${{ matrix.version }} - - steps: - - name: Compute git tag - id: tag - # SQLAlchemy's tags are rel_X_Y_Z, not the PyPI version. - run: echo "ref=rel_$(echo "$SQLALCHEMY_VERSION" | tr . _)" >> "$GITHUB_OUTPUT" - - - name: Checkout SQLAlchemy ${{ steps.tag.outputs.ref }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: sqlalchemy/sqlalchemy - ref: ${{ steps.tag.outputs.ref }} - persist-credentials: false - - - name: Checkout python-wheels - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - path: python-wheels - persist-credentials: false - - - name: Install Python - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - # ConcurrentAutomapTest.test_concurrent_automaps_w_configure is a real - # thread-stress race in the test itself, not a riscv64 build defect; see - # patches/sqlalchemy/${{ env.SQLALCHEMY_VERSION }} (CLAUDE.md gotcha 38). - - name: Patch SQLAlchemy source - run: git apply python-wheels/patches/sqlalchemy/${{ env.SQLALCHEMY_VERSION }}/*.patch - - - name: Build sdist - id: sdist - run: | - set -eux - # Release branches keep tag_build=dev in setup.cfg -> wheels get a .dev0 - # suffix; upstream strips it at release, so must we (CLAUDE.md gotcha 22). - sed -i '/tag_build = dev/d' setup.cfg - - uv pip install build twine - python -m build --sdist - twine check dist/* - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: sqlalchemy-${{ env.SQLALCHEMY_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build sqlalchemy ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - permissions: - contents: read strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - SQLALCHEMY_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: sqlalchemy-${{ env.SQLALCHEMY_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_ARCHS: riscv64 # override pyproject's x86_64+aarch64 pin - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # Extensions are optional=; force the build to fail rather than silently - # ship a mislabeled pure-Python wheel (CLAUDE.md gotcha 20). - CIBW_ENVIRONMENT: REQUIRE_SQLALCHEMY_CEXT=1 - # Upstream's test-command relies on `python -s` to import the built wheel - # over the source tree, but -s doesn't reach xdist -n workers; the env var - # does, so workers test the compiled wheel (CLAUDE.md gotcha 21). - CIBW_TEST_ENVIRONMENT: PYTHONNOUSERSITE=1 - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: sqlalchemy-${{ env.SQLALCHEMY_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: sqlalchemy + version: ${{ matrix.version }} + # The patches skip ConcurrentAutomapTest.test_concurrent_automaps_w_configure, a test-side thread race. + source: pypi-sdist + patches: true + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + # Extensions are optional=; force the build to fail rather than silently + # ship a mislabeled pure-Python wheel (CLAUDE.md gotcha 20). + cibw-environment-linux: REQUIRE_SQLALCHEMY_CEXT=1 + # Upstream's test-command relies on `python -s` to import the built wheel + # over the source tree, but -s doesn't reach xdist -n workers; the env var + # does, so workers test the compiled wheel (CLAUDE.md gotcha 21). + cibw-test-environment: PYTHONNOUSERSITE=1 publish: name: Publish sqlalchemy ${{ matrix.version }} - needs: [setup, build_sdist, build_wheels] + needs: [setup, build_wheels] if: needs.setup.outputs.versions != '[]' strategy: fail-fast: false diff --git a/.github/workflows/build-sspilib.yml b/.github/workflows/build-sspilib.yml index 2b7f95613ca..55b08247b90 100644 --- a/.github/workflows/build-sspilib.yml +++ b/.github/workflows/build-sspilib.yml @@ -49,140 +49,54 @@ jobs: package: sspilib version: ${{ inputs.version }} - build_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - name: Build sspilib ${{ matrix.version }} sdist - runs-on: ubuntu-latest - env: - SSPILIB_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout sspilib v${{ env.SSPILIB_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: jborean93/sspilib - ref: v${{ env.SSPILIB_VERSION }} - persist-credentials: false - - - name: Install Python - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Build sdist - id: sdist - env: - SSPI_SKIP_EXTENSIONS: 'true' # metadata-only: no SSPI implementation to link against here - run: | - set -euo pipefail - rm -rf dist - uv pip install build - python -m build --sdist --outdir dist - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: sspilib-${{ env.SSPILIB_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - # One cp311-abi3 wheel (setup.py hardcodes the limited-api floor to cp311): # cibuildwheel builds it once and reuses+tests it on cp313/cp314 # (find_compatible_wheel), so all three tags share one wheel. build_abi3: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' strategy: fail-fast: false matrix: version: ${{ fromJSON(needs.setup.outputs.versions) }} name: Build sspilib ${{ matrix.version }} cp311-abi3-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 180 - env: - SSPILIB_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: sspilib-${{ env.SSPILIB_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build and test wheel - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: 'cp312-* cp313-* cp314-*' - CIBW_SKIP: '*-musllinux_*' # rustup.rs has no riscv64 musl toolchain - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: python -m pytest {package}/tests -v - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: sspilib-${{ env.SSPILIB_VERSION }}-cp311-abi3-manylinux_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: sspilib + version: ${{ matrix.version }} + source: pypi-sdist + artifact-tag: cp311-abi3-manylinux_riscv64 + timeout-minutes: 180 + cibw-build: cp312-* cp313-* cp314-* + cibw-skip: "*-musllinux_*" + cibw-test-requires: pytest + cibw-test-command: python -m pytest {package}/tests -v # Free-threaded wheel: setup.py disables the limited API under Py_GIL_DISABLED, # so this is a per-interpreter build. Only cp314t - the riscv64 image has no cp313t. build_freethreaded: - needs: [setup, build_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' strategy: fail-fast: false matrix: version: ${{ fromJSON(needs.setup.outputs.versions) }} name: Build sspilib ${{ matrix.version }} cp314t-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 180 - env: - SSPILIB_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: sspilib-${{ env.SSPILIB_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build and test wheel - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: 'cp314t-*' - CIBW_SKIP: '*-musllinux_*' - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: python -m pytest {package}/tests -v - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: sspilib-${{ env.SSPILIB_VERSION }}-cp314t-manylinux_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: sspilib + version: ${{ matrix.version }} + source: pypi-sdist + artifact-tag: cp314t-manylinux_riscv64 + timeout-minutes: 180 + cibw-build: cp314t-* + cibw-skip: "*-musllinux_*" + cibw-test-requires: pytest + cibw-test-command: python -m pytest {package}/tests -v publish: name: Publish sspilib ${{ matrix.version }} - needs: [setup, build_sdist, build_abi3, build_freethreaded] + needs: [setup, build_abi3, build_freethreaded] if: needs.setup.outputs.versions != '[]' strategy: fail-fast: false diff --git a/.github/workflows/build-teptris.yml b/.github/workflows/build-teptris.yml index 833f048a9be..44cd2c95da3 100644 --- a/.github/workflows/build-teptris.yml +++ b/.github/workflows/build-teptris.yml @@ -46,153 +46,50 @@ jobs: package: teptris version: ${{ inputs.version }} - sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - runs-on: ubuntu-latest - env: - TEPTRIS_VERSION: ${{ matrix.version }} - - steps: - # upstream tags the engine (leptris/teptris) as v, one component - # short of the wheel version's trailing iteration digit (family law). - - id: tag - run: echo "libteptris_ref=v${TEPTRIS_VERSION%.*}" >> "$GITHUB_OUTPUT" - - - name: Checkout teptris-py v${{ env.TEPTRIS_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: leptris/teptris-py - ref: v${{ env.TEPTRIS_VERSION }} - persist-credentials: false - - - name: Checkout libteptris ${{ steps.tag.outputs.libteptris_ref }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: leptris/teptris - ref: ${{ steps.tag.outputs.libteptris_ref }} - path: libteptris-src - persist-credentials: false - - - name: Checkout python-wheels - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - path: python-wheels - persist-credentials: false - - # CPython 3.14 raised the C recursion ceiling - # Py_EnterRecursiveCall() checks against by ~2x, so - # tests/test_teptris.py::test_dumps_depth_named_error's fixed - # depth-5000 nesting no longer reliably trips it on cp314/cp314t - # (reproduces on x86_64 too, not riscv64-specific) - widen the - # depth so the test clears either ceiling. See - # patches/teptris/0.3.20.0/ for the full writeup. - - name: Patch teptris-py source - run: git apply python-wheels/patches/teptris/${{ env.TEPTRIS_VERSION }}/*.patch - - # Mirrors scripts/make-sdist.sh: vendor the pinned engine tag into - # vendor/ so setup.py's self-contained mode compiles it at install time - # on any platform with a C compiler - no cmake, no PGO, no prebuilt - # archive (that half of setup.py is only for upstream's own - # PGO-optimized release wheels, which this registry does not build). - - name: Vendor libteptris into the sdist - run: | - set -eux - mkdir -p vendor/libteptris - cp -R libteptris-src/src vendor/libteptris/src - cp libteptris-src/LICENSE.md vendor/libteptris/LICENSE.md - - - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: '3.12' - activate-environment: true - enable-cache: false - - - name: Build sdist - run: | - uv pip install build - python -m build --sdist - - - name: Self-test the sdist - run: | - uv venv /tmp/sdt - uv pip install --python /tmp/sdt/bin/python dist/*.tar.gz - /tmp/sdt/bin/python -c "import teptris; assert teptris.loads('a = 1') == {'a': 1}; print('sdist self-test OK')" - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: teptris-${{ env.TEPTRIS_VERSION }}-sdist - path: dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build teptris ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - TEPTRIS_VERSION: ${{ matrix.version }} - - steps: - - name: Fetch sdist artifact - id: fetch_sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: teptris-${{ env.TEPTRIS_VERSION }}-sdist - - - id: sdist_path - run: echo "path=$(echo ${{ steps.fetch_sdist.outputs.download-path }}/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_MUSLLINUX_RISCV64_IMAGE: ${{ env.MUSLLINUX_RISCV64_IMAGE }} - # The vendored engine compiles straight into the extension (no - # archive, no PGO - that half of setup.py is only for upstream's - # own release wheels); still stage it under _engine/ so the - # package-data globs in pyproject.toml carry its MIT licence and - # sources into the wheel, same as upstream's own wheels do. - CIBW_BEFORE_BUILD: >- - mkdir -p src/teptris/_engine && - cp -r vendor/libteptris/src src/teptris/_engine/src && - cp vendor/libteptris/LICENSE.md src/teptris/_engine/LICENSE.md - CIBW_TEST_SOURCES: tests - CIBW_TEST_COMMAND: python -m unittest discover -s tests -v - - - name: Check the wheel carries the compiled extension, engine sources and licences - run: | - python3 - wheelhouse/*.whl <<'EOF' - import sys, zipfile - for whl in sys.argv[1:]: - names = zipfile.ZipFile(whl).namelist() - assert any(n.startswith("teptris/_native") and n.endswith(".so") for n in names), names - assert "teptris/_engine/LICENSE.md" in names, names - sources = [n for n in names if n.startswith("teptris/_engine/src/teptris/") and n.endswith(".c")] - assert len(sources) >= 20, (whl, len(sources)) - licenses = {n.rsplit("/", 1)[1] for n in names if ".dist-info/licenses/" in n} - {""} - assert licenses == {"LICENSE.txt"}, (whl, licenses) - print(whl, "ok") - EOF - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: teptris-${{ env.TEPTRIS_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: teptris + version: ${{ matrix.version }} + # The PyPI sdist contains the vendored libteptris sources and licence. + source: pypi-sdist + patches: true + post-build: |- + python3 - $GITHUB_WORKSPACE/wheelhouse/*.whl <<'EOF' + import sys, zipfile + for whl in sys.argv[1:]: + names = zipfile.ZipFile(whl).namelist() + assert any(n.startswith("teptris/_native") and n.endswith(".so") for n in names), names + assert "teptris/_engine/LICENSE.md" in names, names + sources = [n for n in names if n.startswith("teptris/_engine/src/teptris/") and n.endswith(".c")] + assert len(sources) >= 20, (whl, len(sources)) + licenses = {n.rsplit("/", 1)[1] for n in names if ".dist-info/licenses/" in n} - {""} + assert licenses == {"LICENSE.txt"}, (whl, licenses) + print(whl, "ok") + EOF + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + timeout-minutes: 90 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-musllinux-riscv64-image: quay.io/pypa/musllinux_1_2_riscv64 + # The vendored engine compiles straight into the extension (no + # archive, no PGO - that half of setup.py is only for upstream's + # own release wheels); still stage it under _engine/ so the + # package-data globs in pyproject.toml carry its MIT licence and + # sources into the wheel, same as upstream's own wheels do. + cibw-before-build: > + mkdir -p src/teptris/_engine && + cp -r vendor/libteptris/src src/teptris/_engine/src && + cp vendor/libteptris/LICENSE.md src/teptris/_engine/LICENSE.md + cibw-test-sources: tests + cibw-test-command: python -m unittest discover -s tests -v publish: name: Publish teptris ${{ matrix.version }} diff --git a/.github/workflows/build-ufal-udpipe.yml b/.github/workflows/build-ufal-udpipe.yml index dc25437af58..aa548fea7e8 100644 --- a/.github/workflows/build-ufal-udpipe.yml +++ b/.github/workflows/build-ufal-udpipe.yml @@ -1,12 +1,9 @@ # SPDX-FileCopyrightText: 2026 The RISE Project # SPDX-License-Identifier: MIT --- -# ufal.udpipe has no upstream GitHub Actions wheel-building workflow to mirror -# (its real release infra, releases/release-udpipe.sh, shells out to a private -# institutional cross-compile farm). The one public recipe is -# releases/pypi/gen.sh, which this workflow replays step for step: amalgamate -# the C++ sources, run SWIG, stamp the version and build the sdist (see -# CLAUDE.md gotcha 668). +# ufal.udpipe has no upstream GitHub Actions wheel-building workflow to mirror. +# Its PyPI sdist, produced by releases/pypi/gen.sh, contains the amalgamated C++ +# source and generated SWIG wrapper needed for the wheel build. name: Build ufal.udpipe wheels (riscv64) on: @@ -49,122 +46,24 @@ jobs: package: ufal-udpipe version: ${{ inputs.version }} - python_sdist: - needs: [setup] - if: needs.setup.outputs.versions != '[]' - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - # The amalgamated C++ source and the SWIG wrapper are architecture- - # independent; build them once on x86 instead of burning a scarce riscv - # runner (CLAUDE.md gotcha 4). UDPipe's own build-system bootstrap - # (src/Makefile.builtem) also hard-errors on any uname -m other than - # x86_64/i386/i686, so this step could not run on the riscv64 runner. - name: Build ufal.udpipe ${{ matrix.version }} sdist - runs-on: ubuntu-latest - env: - UDPIPE_PACKAGE_VERSION: ${{ matrix.version }} - - steps: - - name: Derive the UDPipe tag - # ufal.udpipe's PyPI version is UDPipe's own X.Y.Z plus a trailing - # per-release binding-revision digit with no tag of its own (1.2.0 - # shipped as .1/.2/.3, all from tag v1.2.0; see CLAUDE.md gotcha 668). - run: echo "UDPIPE_TAG=v$(echo "$UDPIPE_PACKAGE_VERSION" | sed -E 's/\.[0-9]+$//')" >> "$GITHUB_ENV" - - - name: Checkout UDPipe ${{ env.UDPIPE_TAG }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: ufal/udpipe - ref: ${{ env.UDPIPE_TAG }} - persist-credentials: false - - - name: Install swig - # apt's swig on ubuntu-latest (4.2.0) predates CPython 3.14's - # PyHeapTypeObject layout change (the `ht_token` field, and the - # trailing cache struct's `init` field) and emits a `-builtin`-mode - # heap-type initializer two fields short for 3.14 - every bound - # class's closing `};` then mismatches onto a later `void*` member - # ("cannot convert '' to 'void*'"), - # identically on cp314 and cp314t (same public struct layout; not a - # free-threading problem - see CLAUDE.md gotcha 698). Pin a PyPI - # `swig` wheel new enough to know about 3.14 instead, the same way - # build-cgal.yml and build-lalsuite.yml already pin theirs (for the - # opposite kind of drift). - run: | - pipx install "swig==4.4.1" - echo "$HOME/.local/bin" >> "$GITHUB_PATH" - - - name: Generate sdist - # Mirrors releases/pypi/gen.sh, except the README is a short static - # blurb instead of running README.sh (which renders the manual - # through the t2t_docsys toolchain just for the long_description - # text - unrelated to whether the package builds or imports). - run: | - set -euo pipefail - dir=ufal.udpipe - rm -rf "$dir" - mkdir -p "$dir/tests/data" - cp releases/pypi/Changes LICENSE releases/pypi/MANIFEST.in "$dir" - cp -a bindings/python/examples "$dir" - cp -a releases/pypi/tests/*.py "$dir/tests" - cp releases/test_data/test.model "$dir/tests/data" - echo 'ufal.udpipe: Python bindings to the UDPipe library .' > "$dir/README" - make -C src_lib_only udpipe.cpp - make -C bindings/python clean - make -C bindings/python udpipe_python.cpp - cp -a bindings/python/ufal "$dir" - cp src_lib_only/udpipe.cpp src_lib_only/udpipe.h "$dir/ufal/udpipe" - cp bindings/python/udpipe_python.cpp "$dir/ufal/udpipe" - sed "s/^\\( *version *= *'\\)[^']*'/\\1${UDPIPE_PACKAGE_VERSION}'/" releases/pypi/setup.py > "$dir/setup.py" - sed -i "s/^# *__version__ *=.*$/__version__ = \"${UDPIPE_PACKAGE_VERSION}\"/" "$dir/ufal/udpipe/__init__.py" - pipx run build --sdist "$dir" - - - name: Upload sdist artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: ufal.udpipe-${{ env.UDPIPE_PACKAGE_VERSION }}-sdist - path: ufal.udpipe/dist/*.tar.gz - if-no-files-found: error - build_wheels: - needs: [setup, python_sdist] + needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build ufal.udpipe ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - UDPIPE_PACKAGE_VERSION: ${{ matrix.version }} - - steps: - - name: Download sdist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: ufal.udpipe-${{ env.UDPIPE_PACKAGE_VERSION }}-sdist - path: dist/ - - - id: sdist_path - run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT" - - - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: ${{ steps.sdist_path.outputs.path }} - env: - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_TEST_COMMAND: python {project}/tests/test_import.py && python {project}/tests/test_udpipe.py - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: ufal.udpipe-${{ env.UDPIPE_PACKAGE_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: ufal.udpipe + version: ${{ matrix.version }} + # The PyPI sdist contains the generated SWIG wrapper and amalgamated C++ source. + source: pypi-sdist + artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + cibw-test-command: python {project}/tests/test_import.py && python {project}/tests/test_udpipe.py publish: name: Publish ufal.udpipe ${{ matrix.version }} diff --git a/.github/workflows/build-ujson.yml b/.github/workflows/build-ujson.yml index 175b6eaa895..c2df9936f29 100644 --- a/.github/workflows/build-ujson.yml +++ b/.github/workflows/build-ujson.yml @@ -53,11 +53,8 @@ jobs: with: package: ujson version: ${{ matrix.version }} - # setup.py reads the version through setuptools_scm, which needs the tag. - repository: ultrajson/ultrajson - ref: ${{ matrix.version }} + source: pypi-sdist artifact-tag: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - checkout-fetch-depth: 0 cibw-build: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 cibw-test-requires: pytest cibw-test-command: pytest {package}/tests