Skip to content

Implement GraverBasis class for integer matrices #970

Implement GraverBasis class for integer matrices

Implement GraverBasis class for integer matrices #970

name: Prepare Windows wheels
on:
pull_request:
paths:
- '**'
- '!.github/workflows/**'
- '!*.md'
- '!*.txt'
- '!condarc.yml'
- '!environment*.yml'
- '!pyrightconfig.json'
- '!src/doc/**'
- '!tools/**'
- '.github/workflows/dist.yml'
merge_group:
push:
branches:
- '*windows*'
- '*delvewheel*'
tags:
# Match all release tags including beta, rc
- 'passagemath-[0-9]+.[0-9]+'
- 'passagemath-[0-9]+.[0-9]+.[0-9]+'
- 'passagemath-[0-9]+.[0-9]+.beta[0-9]+'
- 'passagemath-[0-9]+.[0-9]+.[0-9]+.beta[0-9]+'
- 'passagemath-[0-9]+.[0-9]+.rc[0-9]+'
- 'passagemath-[0-9]+.[0-9]+.[0-9]+.rc[0-9]+'
workflow_dispatch:
# Allow to run manually
concurrency:
# Cancel previous runs of this workflow for the same branch
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
sdists_for_pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache sdists
id: cache-sdists
uses: actions/cache@v4
with:
path: dist
# Exclude dangling symlinks from hashFiles
key: >-
sdists-build=${{
hashFiles('build',
'configure.ac',
'm4')
}}-pkgs=${{
hashFiles('pkgs',
'!pkgs/sage-conf/bin/**',
'!pkgs/sage-conf*/pyproject.toml',
'!pkgs/sage-conf_conda/**',
'!pkgs/sage-conf_pypi/sage_root/**',
'!pkgs/sage-project-cookiecutter/**',
'!pkgs/sagemath-standard/requirements.txt')
}}-src=${{ hashFiles('src') }}
- name: Install bootstrap prerequisites
if: steps.cache-sdists.outputs.cache-hit != 'true'
run: |
sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install $(build/bin/sage-get-system-packages debian _bootstrap)
- name: Cache SAGE_LOCAL
if: steps.cache-sdists.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: |
config.status
local
key: >-
sdists-SAGE_LOCAL-build=${{
hashFiles('build',
'configure.ac',
'm4')
}}
restore-keys: |
sdists-SAGE_LOCAL
- name: make pypi-sdists
if: steps.cache-sdists.outputs.cache-hit != 'true'
run: |
./bootstrap
./configure
make sagemath_environment V=0
make pypi-sdists V=0
(mkdir dist && mv upstream/*sage*.tar.gz dist/)
ls -l dist
- uses: actions/upload-artifact@v4
with:
path: "dist/*.tar.gz"
name: dist-windows
- name: twine check
if: steps.cache-sdists.outputs.cache-hit != 'true'
run: |
./sage -pip install twine
./sage -sh -c 'twine check dist/*.tar.gz'
noarch_wheels_for_pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache noarch-wheels
id: cache-noarch-wheels
uses: actions/cache@v4
with:
path: dist
key: >-
noarch-wheels-build=${{
hashFiles('build',
'configure.ac',
'm4')
}}-pkgs=${{
hashFiles('pkgs',
'!pkgs/sage-conf/bin/**',
'!pkgs/sage-conf*/pyproject.toml',
'!pkgs/sage-conf_conda/**',
'!pkgs/sage-conf_pypi/sage_root/**',
'!pkgs/sage-project-cookiecutter/**',
'!pkgs/sagemath-standard/requirements.txt')
}}-src=${{ hashFiles('src') }}
- name: Install bootstrap prerequisites
if: steps.cache-noarch-wheels.outputs.cache-hit != 'true'
run: |
sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install $(build/bin/sage-get-system-packages debian _bootstrap)
- name: Cache SAGE_LOCAL
if: steps.cache-noarch-wheels.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: |
config.status
local
key: >-
noarch-wheels-SAGE_LOCAL-build=${{
hashFiles('build',
'configure.ac',
'm4')
}}
restore-keys: |
noarch-wheels-SAGE_LOCAL
- name: make pypi-noarch-wheels
if: steps.cache-noarch-wheels.outputs.cache-hit != 'true'
run: |
./bootstrap
./configure
make pypi-noarch-wheels PYPI_NOARCH_WHEEL_PACKAGES="sage_sws2rst sage_setup sagemath_environment sagemath_repl sagelib" V=0
(mkdir dist && mv venv/var/lib/sage/wheels/*sage*-none-any.whl dist/ && rm -f dist/*sage*conf-*-none-any.whl)
ls -l dist
- uses: actions/upload-artifact@v4
with:
path: "dist/*.whl"
name: noarch-wheels-windows
build_wheels:
name: wheels ${{ matrix.env }}
runs-on: ${{ matrix.os }}
needs: [sdists_for_pypi, noarch_wheels_for_pypi]
strategy:
fail-fast: false
matrix:
include:
- os: windows-2022
msystem: ucrt64
env: ucrt-x86_64
arch: auto
build: "win_*64"
- os: windows-11-arm
msystem: clangarm64
env: clang-aarch64
arch: auto
build: "win_*64"
env:
# SPKGs to install as system packages
SPKGS: _bootstrap _prereq openssl curl readline liblzma libffi bzip2 zlib info libxml2 gdbm
# Non-Python packages to install as spkgs
#TARGETS_PRE: ccache libpng mpfi givaro pari ntl flint iml lcalc libbraiding m4ri m4rie gap nauty gfan ecm tachyon pip
TARGETS_PRE: >-
boost_cropped
gmp
glpk
gsl
mpc
mpfr
cmr
rw
cddlib
graphs
planarity
cliquer
libhomfly
symmetrica
CIBW_BUILD: "*${{ matrix.build }}*"
#
CIBW_ARCHS: ${{ matrix.arch }}
# https://cibuildwheel.readthedocs.io/en/stable/options/#requires-python
CIBW_PROJECT_REQUIRES_PYTHON: ${{ github.event_name == 'pull_request' && '>=3.10, <3.11' || '>=3.10, <3.14' }}
# Run before wheel build
CIBW_BEFORE_BUILD_WINDOWS: |
pip install delvewheel && msys2 -c "set -x; cat constraints.txt && (echo passagemath-conf @ file:///${GITHUB_WORKSPACE}/pkgs/sage-conf && echo passagemath-setup @ file:///${GITHUB_WORKSPACE}/pkgs/sage-setup && echo passagemath-environment @ file:///${GITHUB_WORKSPACE}/pkgs/sagemath-environment) > constraints.txt && cat constraints.txt"
# Environment during wheel build
# PYTHONUTF8=1 is for delvewheel
CIBW_ENVIRONMENT: >-
PATH="${GITHUB_WORKSPACE}\\sage-local\\bin;${GITHUB_WORKSPACE}\\build\\bin;$PATH"
INCLUDE="${GITHUB_WORKSPACE}\\sage-local\\include;%INCLUDE%"
LIB="${GITHUB_WORKSPACE}\\sage-local\\bin;${GITHUB_WORKSPACE}\\sage-local\\lib;%LIB%"
PKG_CONFIG_PATH=$(pwd)/prefix/lib/pkgconfig:$PKG_CONFIG_PATH
ACLOCAL_PATH=/usr/share/aclocal
LINBOX_CONFIGURE=--without-ntl
GIAC_CONFIGURE=--disable-ntl
SAGE_MACAULAY2_BUILD_OPTIONS=-DWITH_PYTHON=off
PIP_CONSTRAINT=${GITHUB_WORKSPACE}\\constraints.txt
PIP_FIND_LINKS=${GITHUB_WORKSPACE}\\wheelhouse' '${GITHUB_WORKSPACE}\\dist
SAGE_NUM_THREADS=6
PYTHONUTF8=1
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -vv --custom-patch -w {dest_dir} {wheel}"
#
CIBW_PLATFORM: windows
steps:
- uses: actions/checkout@v4
- uses: msys2/[email protected]
# Pin as done in https://github.com/aleaxit/gmpy/pull/583
name: Setup msys2
with:
install: >-
mingw-w64-${{ matrix.env }}-gcc
autotools
python
python-pip
python-setuptools
patch
bison
mingw-w64-${{ matrix.env }}-cmake
mingw-w64-${{ matrix.env }}-ninja
mingw-w64-${{ matrix.env }}-gtest
mingw-w64-${{ matrix.env }}-ncurses
mingw-w64-${{ matrix.env }}-readline
mingw-w64-${{ matrix.env }}-texinfo
msystem: ${{ matrix.msystem }}
path-type: inherit
- name: Download sdists
uses: actions/download-artifact@v4
with:
name: dist-windows
path: dist
- name: Download noarch-wheels
uses: actions/download-artifact@v4
with:
name: noarch-wheels-windows
path: dist
- name: Retrieve SAGE_LOCAL cache
id: cache-sage-local
uses: actions/cache/restore@v4
with:
path: |
config.status
sage-local
key: >-
${{ matrix.os }}-cibuildwheel-${{ matrix.arch }}-build=${{
hashFiles('build',
'configure.ac',
'm4',
'!build/pkgs/*/src')
}}
restore-keys: |
${{ matrix.os }}-cibuildwheel-${{ matrix.arch }}
- name: Retrieve configure tarball cache
id: cache-configure
uses: actions/cache/restore@v4
with:
path: |
build/pkgs/configure
upstream/configure*
# Keyed to matrix.os because msys2 has important patches for libtool
key: >-
${{ matrix.os }}-configure-build=${{
hashFiles('build',
'configure.ac',
'm4')
}}
- name: Bootstrap
if: steps.cache-configure.outputs.cache-hit != 'true'
# Patch python3 spkg-configure to allow Python 3.9.0 during the CIBW_BEFORE_ALL phase
run: |
export PATH=$(pwd)/build/bin:$PATH
# eval $(sage-print-system-package-command auto --yes update)
# eval $(sage-print-system-package-command auto --yes --no-install-recommends --spkg install _bootstrap bzip2 xz liblzma)
sed -i.bak '/m4_pushdef.*MIN_VERSION/s/3[0-9.]*/3.9.0/' build/pkgs/python3/spkg-configure.m4
./bootstrap -s
shell: msys2 {0}
- name: Save configure tarball cache
if: steps.cache-configure.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
build/pkgs/configure
upstream/configure*
key: ${{ steps.cache-configure.outputs.cache-primary-key }}
- name: Unpack and prepare
id: unpack
# We build the wheels from the sdists so that MANIFEST filtering becomes effective.
# But we must run cibuildwheel with the unpacked source directory, not a tarball,
# so that SAGE_ROOT is copied into the build containers.
#
# In the CIBW_BEFORE_ALL phase, we install libraries using the Sage distribution.
# https://cibuildwheel.readthedocs.io/en/stable/options/#before-all
# For Linux, this is repeated for each of the packages that we build wheels for
# because CIBW starts with a fresh container on each invocation.
# Therefore we cache it in a directory mounted from the host: /host
# https://cibuildwheel.pypa.io/en/stable/faq/#linux-builds-in-containers
#
# - configure --with-sage-venv makes the SAGE_VENV separate from SAGE_LOCAL.
# SAGE_LOCAL is put in PATH for the wheel building.
# SAGE_VENV must not be in PATH so it does not shadow cibuildwheel's build tools.
#
run: |
if [ ! -x ./configure ]; then ./bootstrap -D; fi
touch configure
SAGE_LOCAL=$(pwd)/sage-local
# We set the installation records to the same mtime so that no rebuilds due to dependencies
# among these packages are triggered.
dummy="$SAGE_LOCAL"/var/lib/sage/installed/.dummy
if [ -f "$dummy" ]; then
touch "$dummy"
for tree in "$SAGE_LOCAL" "$SAGE_LOCAL"/var/lib/sage/venv*; do
inst="$tree"/var/lib/sage/installed
if [ -d "$inst" ]; then
# -r is --reference; the macOS version of touch does not accept the long option.
(cd "$inst" && touch -r "$dummy" .dummy *)
# Show what has been built already.
ls -l "$tree" "$inst"
fi
done
fi
export PATH=build/bin:$PATH
echo CIBW_BEFORE_ALL="msys2 tools/cibw_before_all_windows.sh" >> "$GITHUB_ENV"
mkdir -p unpacked
set -x
for sdist in dist/$pkg*.tar.gz; do
(cd unpacked && tar xfz - && base=${sdist#dist/} && mv ${base%.tar.gz} ${base%-*}) < $sdist
done
shell: msys2 {0}
- name: sagemath-objects
id: sagemath-objects
uses: pypa/[email protected]
with:
package-dir: unpacked/passagemath_objects
- name: Save SAGE_LOCAL cache
if: (success() || failure()) && steps.unpack.outcome == 'success'
uses: actions/cache/save@v4
with:
path: |
config.status
sage-local
!sage-local/lib64
key: ${{ steps.cache-sage-local.outputs.cache-primary-key }}
####### sagemath-categories and what depends on it
- name: sagemath-categories
id: sagemath-categories
uses: pypa/[email protected]
with:
package-dir: unpacked/passagemath_categories
- name: sagemath-graphs
id: sagemath-graphs
uses: pypa/[email protected]
with:
package-dir: unpacked/passagemath_graphs
- name: sagemath-rankwidth
id: sagemath-rankwidth
uses: pypa/[email protected]
with:
package-dir: unpacked/passagemath_rankwidth
- name: sagemath-cddlib
id: sagemath-cddlib
uses: pypa/[email protected]
with:
package-dir: unpacked/passagemath_cddlib
- name: sagemath-glpk
id: sagemath-glpk
uses: pypa/[email protected]
with:
package-dir: unpacked/passagemath_glpk
- name: sagemath-planarity
id: sagemath-planarity
uses: pypa/[email protected]
with:
package-dir: unpacked/passagemath_planarity
- name: sagemath-homfly
id: sagemath-homfly
uses: pypa/[email protected]
with:
package-dir: unpacked/passagemath_homfly
- name: sagemath-cliquer
id: sagemath-cliquer
uses: pypa/[email protected]
with:
package-dir: unpacked/passagemath_cliquer
- name: sagemath-combinat
id: sagemath-combinat
uses: pypa/[email protected]
with:
package-dir: unpacked/passagemath_combinat
####### sagemath-modules and what depends on it
- name: sagemath-modules
id: sagemath-modules
uses: pypa/[email protected]
with:
package-dir: unpacked/passagemath_modules
- name: sagemath-plot
id: sagemath-plot
uses: pypa/[email protected]
with:
package-dir: unpacked/passagemath_plot
- name: sagemath-cmr
id: sagemath-cmr
uses: pypa/[email protected]
with:
package-dir: unpacked/passagemath_cmr
- uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ matrix.os }}-${{ matrix.arch }}-wheels
path: ./wheelhouse/*.whl
- uses: actions/upload-artifact@v4
if: always()
with:
name: unpacked-${{ matrix.os }}
path: ./unpacked
- uses: actions/upload-artifact@v4
if: always()
with:
name: sage-local-${{ matrix.os }}
path: ./sage-local
- uses: actions/upload-artifact@v4
if: always()
with:
name: logs-${{ matrix.os }}
path: ./logs
upload_wheels:
# This needs to be a separate job because pypa/gh-action-pypi-publish cannot run on macOS
needs: [sdists_for_pypi, noarch_wheels_for_pypi, build_wheels]
if: (success() || failure()) && startsWith(github.ref, 'refs/tags')
uses: ./.github/workflows/pypi-publish.yml
with:
patterns: '["windows-*-wheels"]'
secrets: inherit
tox:
needs: [sdists_for_pypi, noarch_wheels_for_pypi, build_wheels]
if: (success() || failure())
uses: ./.github/workflows/ci-wheels.yml
with:
run-id: ${{ github.run_id }}
oss: >-
[
'windows-2022',
'windows-11-arm',
]
python-versions: >-
[
'3.13',
]
distributions: >-
[
'sagemath-categories',
'sagemath-cddlib',
'sagemath-cliquer',
'sagemath-cmr',
'sagemath-combinat',
'sagemath-glpk',
'sagemath-graphs',
'sagemath-homfly',
'sagemath-modules',
'sagemath-planarity',
'sagemath-plot',
'sagemath-rankwidth',
]