Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove outdated (pre-PEP 517/518) practices in make check, fix ci-sage #190

Merged
merged 6 commits into from
Jun 9, 2024
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
71 changes: 28 additions & 43 deletions .github/workflows/ci-sage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ env:
TARGETS_PRE: build/make/Makefile
TARGETS: SAGE_CHECK=no SAGE_CHECK_PACKAGES="cysignals,cypari" cysignals cypari
TARGETS_OPTIONAL: build/make/Makefile
# Standard setting: Test the current beta release of Sage:
# Temporarily test with https://github.com/sagemath/sage/pull/36110
# Standard setting: Test the current beta release of Sage
SAGE_REPO: sagemath/sage
SAGE_REF: refs/pull/36110/merge
SAGE_REF: develop
REMOVE_PATCHES: "*"

jobs:
Expand Down Expand Up @@ -96,7 +95,7 @@ jobs:
fail-fast: false
matrix:
python-version-start: [python-3]
python-version: [7, 8, 9]
python-version: [9]
steps:
- run: |
git config --global core.autocrlf false
Expand All @@ -106,51 +105,40 @@ jobs:
with:
submodules: recursive
fetch-depth: 0
- name: install cygwin and minimal prerequisites with choco
- name: Install cygwin and minimal prerequisites with choco
shell: bash {0}
run: |
choco --version
choco install make autoconf gcc-core gcc-g++ python3${{ matrix.python-version }}-devel --source cygwin
- name: install dependencies
run: |
C:\\tools\\cygwin\\bin\\bash -l -x -c 'export PATH=/usr/local/bin:/usr/bin && cd $(cygpath -u "$GITHUB_WORKSPACE") && python3.${{ matrix.python-version }} -m pip install -U --no-build-isolation -r requirements.txt'
- name: install
- name: Install dependencies
run: |
C:\\tools\\cygwin\\bin\\bash -l -x -c 'export PATH=/usr/local/bin:/usr/bin && cd $(cygpath -u "$GITHUB_WORKSPACE") && python3.${{ matrix.python-version }} setup.py build_ext -i'
- name: test
C:\\tools\\cygwin\\bin\\bash -l -x -c 'export PATH=/usr/local/bin:/usr/bin && cd $(cygpath -u "$GITHUB_WORKSPACE") && python3.${{ matrix.python-version }} -m pip install --upgrade pip'
- name: Build and check
run: |
C:\\tools\\cygwin\\bin\\bash -l -x -c 'export PATH=/usr/local/bin:/usr/bin && cd $(cygpath -u "$GITHUB_WORKSPACE") && make install PYTHON=python3.${{ matrix.python-version }}'
C:\\tools\\cygwin\\bin\\bash -l -x -c 'export PATH=/usr/local/bin:/usr/bin && cd $(cygpath -u "$GITHUB_WORKSPACE") && make check-all PYTHON=python3.${{ matrix.python-version }}'
C:\\tools\\cygwin\\bin\\bash -l -x -c 'export PATH=/usr/local/bin:/usr/bin && cd $(cygpath -u "$GITHUB_WORKSPACE") && make distcheck PYTHON=python3.${{ matrix.python-version }}'
C:\\tools\\cygwin\\bin\\bash -l -x -c 'export PATH=/usr/local/bin:/usr/bin && cd $(cygpath -u "$GITHUB_WORKSPACE") && make check PYTHON=python3.${{ matrix.python-version }}'

ubuntu-without-sage:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12-dev']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13-dev']
steps:
- name: Set up the repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U --no-build-isolation -r requirements.txt
- name: Freeze pip
run: |
pip freeze
- name: Local build
- name: Build and check
run: |
make -j4 install
make -j4 check-all
make -j4 distcheck
make -j4 check

linux:
uses: sagemath/sage/.github/workflows/docker.yml@develop
Expand All @@ -160,14 +148,14 @@ jobs:
targets: SAGE_CHECK=no SAGE_CHECK_PACKAGES="cysignals,cypari" cysignals cypari
targets_optional: build/make/Makefile
sage_repo: sagemath/sage
sage_ref: refs/pull/36110/merge
sage_ref: develop
upstream_artifact: upstream
# We prefix the image name with the SPKG name ("cysignals-") to avoid the error
# 'Package "sage-docker-..." is already associated with another repository.'
docker_push_repository: ghcr.io/${{ github.repository }}/cysignals-
needs: [dist, ubuntu-without-sage]

docker-sage-incremental:
linux-sage-incremental:
uses: sagemath/sage/.github/workflows/docker.yml@develop
with:
# Build incrementally from published Docker image
Expand All @@ -181,44 +169,41 @@ jobs:
targets: "cysignals-uninstall cypari-uninstall build doc-html ptest"
targets_optional: build/make/Makefile
sage_repo: sagemath/sage
sage_ref: refs/pull/36110/merge
sage_ref: develop
upstream_artifact: upstream
# We prefix the image name with the SPKG name ("cysignals-") to avoid the error
# 'Package "sage-docker-..." is already associated with another repository.'
docker_push_repository: ghcr.io/${{ github.repository }}/cysignals-
needs: [dist, ubuntu-without-sage, docker]
needs: [dist, linux]

macos-without-sage:
runs-on: macos-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12-dev']
env:
# Work around https://github.com/sagemath/cysignals/issues/179
ARCHFLAGS: "-arch x86_64"
os: ['macos-13', 'macos-latest']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13-dev']
steps:
- name: Set up the repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U --no-build-isolation -r requirements.txt
- name: Freeze pip
run: |
pip freeze
- name: Local build
brew install autoconf
python -m pip install --upgrade pip
- name: Build and check
# Work around https://github.com/sagemath/cysignals/issues/179
run: |
make -j4 install
make -j4 check-all
make -j4 distcheck
case $RUNNER_ARCH in
X*) export ARCHFLAGS="-arch x86_64";;
esac
make -j4 check

macos:
uses: sagemath/sage/.github/workflows/macos.yml@develop
Expand Down
79 changes: 9 additions & 70 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ DOCTEST = $(PYTHON) -B rundoctests.py
all: build doc

build: configure
$(PYTHON) setup.py build
$(PIP) install build
$(PYTHON) -m build

install: configure
$(PIP) install --no-build-isolation --no-index --ignore-installed --no-deps .
$(PIP) install .

dist: configure
$(PIP) install build
Expand Down Expand Up @@ -56,9 +57,9 @@ distclean: clean

test: check

check: check-tmp
check: check-all

check-all: check-tmp
check-all:
$(MAKE) check-install

# Install and check
Expand All @@ -68,73 +69,13 @@ check-doctest: install
$(DOCTEST) src/cysignals/*.pyx

check-example: install
cd example && $(PYTHON) setup.py clean build
$(PYTHON) -m pip install -U build setuptools wheel Cython
cd example && $(PYTHON) -m build --no-isolation .

check-gdb: install
$(PYTHON) testgdb.py


#####################
# Check installation
#####################
#
# Test 2 installation scenarios without a real installation
# - prefix (with --prefix and --root)
# - user (with --user)

check-tmp:
$(MAKE) check-prefix
$(MAKE) check-user

prefix-install: configure
rm -rf tmp/local tmp/build tmp/site-packages
$(PYTHON) setup.py install --prefix="`pwd`/tmp/local" --root=tmp/build
cd tmp && mv "build/`pwd`/local" local
cd tmp && cp -R local/lib*/python*/site-packages site-packages

check-prefix: check-prefix-doctest check-prefix-example

check-prefix-doctest: prefix-install
export PYTHONPATH="`pwd`/tmp/site-packages" && $(DOCTEST) src/cysignals/*.pyx

check-prefix-example: prefix-install
rm -rf example/build
export PYTHONPATH="`pwd`/tmp/site-packages" && cd example && $(PYTHON) setup.py clean build

check-user: check-user-doctest check-user-example

user-install: configure
rm -rf tmp/user
export PYTHONUSERBASE="`pwd`/tmp/user" && $(PYTHON) setup.py install --user --old-and-unmanageable

check-user-doctest: user-install
export PYTHONUSERBASE="`pwd`/tmp/user" && $(DOCTEST) src/cysignals/*.pyx

check-user-example: user-install
export PYTHONUSERBASE="`pwd`/tmp/user" && cd example && $(PYTHON) setup.py clean build

distcheck: dist
rm -rf dist/check
mkdir -p dist/check
cd dist/check && tar xzf ../cysignals-$(VERSION).tar.gz
cd dist/check/cysignals-$(VERSION) && $(LS_R) >../dist0.ls
cd dist/check/cysignals-$(VERSION) && $(MAKE) all
cd dist/check/cysignals-$(VERSION) && $(MAKE) distclean
cd dist/check/cysignals-$(VERSION) && $(LS_R) >../dist1.ls
cd dist/check; diff -u dist0.ls dist1.ls || { echo >&2 "Error: distclean after all leaves garbage"; exit 1; }
cd dist/check/cysignals-$(VERSION) && $(MAKE) check-user
cd dist/check/cysignals-$(VERSION) && ./configure --enable-debug
cd dist/check/cysignals-$(VERSION) && $(MAKE) check-prefix
cd dist/check/cysignals-$(VERSION) && $(MAKE) distclean
cd dist/check/cysignals-$(VERSION) && $(LS_R) >../dist2.ls
cd dist/check; diff -u dist0.ls dist2.ls || { echo >&2 "Error: distclean after check-tmp leaves garbage"; exit 1; }
cd dist/check/cysignals-$(VERSION) && $(MAKE) dist
cd dist/check/cysignals-$(VERSION) && tar xzf dist/cysignals-$(VERSION).tar.gz
cd dist/check/cysignals-$(VERSION)/cysignals-$(VERSION) && $(LS_R) >../../dist3.ls
cd dist/check; diff -u dist0.ls dist3.ls || { echo >&2 "Error: sdist is not reproducible"; exit 1; }
rm -rf dist/check


#####################
# Maintain
#####################
Expand All @@ -145,7 +86,5 @@ configure: configure.ac
@rm -f src/config.h.in~

.PHONY: all build doc install dist doc clean clean-build clean-doc \
distclean test check check-all check-tmp check-install \
check-doctest check-example \
check-prefix prefix-install check-prefix-doctest check-prefix-example \
check-user user-install check-user-doctest check-user-example
distclean test check check-all check-install \
check-doctest check-example
3 changes: 3 additions & 0 deletions example/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ['setuptools', 'Cython>=0.28', 'cysignals']
build-backend = "setuptools.build_meta"
4 changes: 2 additions & 2 deletions example/setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3

from setuptools import setup
from setuptools.extension import Extension
from distutils.command.build import build as _build


Expand All @@ -21,7 +22,6 @@ def cythonize(self, extensions):
name="cysignals_example",
version='1.0',
license='Public Domain',
setup_requires=["cysignals"],
ext_modules=["cysignals_example.pyx"],
ext_modules=[Extension("*", ["cysignals_example.pyx"])],
cmdclass=dict(build=build),
)
Loading