Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
185 changes: 185 additions & 0 deletions .github/workflows/build-passagemath-cddlib.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# passagemath-cddlib is split out of the passagemath/passagemath monorepo
# at pkgs/sagemath-cddlib, tagged passagemath-<version>; the sdist is built
# the same way as build-passagemath-objects.yml.
name: Build passagemath-cddlib wheels (riscv64)

on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/passagemath-cddlib.yaml not released yet'
required: false
default: ''
pull_request:
branches: [main]
paths:
- '.github/workflows/build-passagemath-cddlib.yml'
- 'docs/packages/passagemath-cddlib.yaml'
- 'patches/passagemath-cddlib/**'
push:
branches: [main]
paths:
- '.github/workflows/build-passagemath-cddlib.yml'
- 'docs/packages/passagemath-cddlib.yaml'
- 'patches/passagemath-cddlib/**'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read # to fetch code (actions/checkout)

env:
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64

jobs:
setup:
uses: $/.github/workflows/_setup.yml
with:
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

linux:
needs: [setup, python_sdist]
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' || '' }}"
# 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

publish:
name: Publish passagemath-cddlib ${{ matrix.version }}
needs: [setup, linux]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
permissions:
contents: write
pull-requests: write
uses: $/.github/workflows/_publish-wheel.yml
secrets:
app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }}
with:
matrix: ${{ needs.setup.outputs.matrix }}
artifact-pattern: passagemath-cddlib-${{ matrix.version }}-*_riscv64
12 changes: 12 additions & 0 deletions docs/packages/passagemath-cddlib.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package-name: passagemath-cddlib
source-code: https://github.com/passagemath/passagemath/tree/main/pkgs/sagemath-cddlib
license: GPL-2.0-or-later
versions:
- version: 10.8.13
files:
- python: 3.11:manylinux
- python: 3.11:musllinux
- python: 3.12-abi3:manylinux
- python: 3.12-abi3:musllinux
- python: 3.14t:manylinux
- python: 3.14t:musllinux
Loading
Loading