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

make sagemath_categories-check, make pypi-wheels-check #36452

Merged
merged 13 commits into from
Oct 21, 2023
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
29 changes: 24 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,19 @@ jobs:
(cd worktree-image && git commit -q -m "current changes" --allow-empty -a && git am; git reset --quiet old; git add -N .) < upstream/ci_fixes.patch
fi

- name: Incremental build, test changed files (sage -t --new)
- name: Incremental build
id: incremental
run: |
# Now re-bootstrap and build. The build is incremental because we were careful with the timestamps.
# We run tests with "sage -t --new"; this only tests the uncommitted changes.
./bootstrap && make build && ./sage -t --new -p2
./bootstrap && make build
working-directory: ./worktree-image
env:
MAKE: make -j2 --output-sync=recurse
SAGE_NUM_THREADS: 2

- name: Build and test modularized distributions
- name: Build modularized distributions
if: always() && steps.worktree.outcome == 'success'
run: make V=0 tox && make pypi-wheels
run: make V=0 tox && make SAGE_CHECK=no pypi-wheels
working-directory: ./worktree-image
env:
MAKE: make -j2 --output-sync=recurse
Expand Down Expand Up @@ -165,6 +164,26 @@ jobs:
MAKE: make -j2 --output-sync=recurse
SAGE_NUM_THREADS: 2

# Testing

- name: Test changed files (sage -t --new)
if: always() && steps.build.outcome == 'success'
run: |
# We run tests with "sage -t --new"; this only tests the uncommitted changes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if: always() && steps.worktree.outcome == 'success'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, i've made a similar change in 8224cb0

./sage -t --new -p2
working-directory: ./worktree-image
env:
MAKE: make -j2 --output-sync=recurse
SAGE_NUM_THREADS: 2

- name: Test modularized distributions
if: always() && steps.build.outcome == 'success'
run: make V=0 tox && make pypi-wheels-check
working-directory: ./worktree-image
env:
MAKE: make -j2 --output-sync=recurse
SAGE_NUM_THREADS: 2

- name: Pytest
if: contains(github.ref, 'pytest')
run: |
Expand Down
15 changes: 9 additions & 6 deletions build/bin/sage-dist-helpers
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,15 @@ sdh_store_wheel() {
mkdir -p "${SAGE_DESTDIR}${SAGE_SPKG_WHEELS}" && \
$sudo mv "$wheel" "${SAGE_DESTDIR}${SAGE_SPKG_WHEELS}/" || \
sdh_die "Error storing $wheel"
wheel="${SAGE_DESTDIR}${SAGE_SPKG_WHEELS}/${wheel##*/}"
wheel="${SAGE_SPKG_WHEELS}/${wheel##*/}"
if [ -n "${SAGE_SPKG_SCRIPTS}" -a -n "${PKG_BASE}" ]; then
wheel_basename="${wheel##*/}"
distname="${wheel_basename%%-*}"
# Record name and wheel file location
mkdir -p ${SAGE_DESTDIR}${SAGE_SPKG_SCRIPTS}/${PKG_BASE}
echo "${distname} @ file://${wheel}" >> ${SAGE_DESTDIR}${SAGE_SPKG_SCRIPTS}/${PKG_BASE}/spkg-requirements.txt
fi
wheel="${SAGE_DESTDIR}${wheel}"
}

sdh_store_and_pip_install_wheel() {
Expand Down Expand Up @@ -373,11 +381,6 @@ sdh_store_and_pip_install_wheel() {
fi
$sudo sage-pip-install $root $pip_options "$wheel" || \
sdh_die "Error installing ${wheel##*/}"
if [ -n "${SAGE_PKG_DIR}" ]; then
# Record name of installed distribution name for uninstallation.
wheel=${wheel##*/}
echo "${wheel%%-*}" >> ${SAGE_PKG_DIR}/spkg-piprm-requirements.txt
fi
}

sdh_pip_uninstall() {
Expand Down
24 changes: 2 additions & 22 deletions build/bin/sage-spkg
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ WRAPPED_SCRIPTS="build install check preinst postinst $INSTALLED_SCRIPTS"

# Prepare script for uninstallation of packages that use sdh_pip_install
# or sdh_store_and_pip_install_wheel.
echo 'sdh_pip_uninstall -r $SAGE_SPKG_SCRIPTS/$PKG_BASE/spkg-piprm-requirements.txt' > spkg-piprm.in
echo 'sdh_pip_uninstall -r $SAGE_SPKG_SCRIPTS/$PKG_BASE/spkg-requirements.txt' > spkg-piprm.in

for script in $WRAPPED_SCRIPTS; do
# 'Installed' scripts are not run immediately out of the package build
Expand All @@ -567,24 +567,6 @@ for script in $WRAPPED_SCRIPTS; do
fi
done


# When there is no spkg-install, assume the "spkg" is a tarball not
# specifically made for Sage. Since we want it to be as easy as
# possible to install such a package, we "guess" spkg-install.
if [ ! -f spkg-install ]; then
echo '#!/usr/bin/env bash' > spkg-install
if [ -x configure ]; then
echo './configure --prefix="$SAGE_INST_LOCAL" && make && $SAGE_SUDO make install' >> spkg-install
elif [ -f setup.py ]; then
echo 'python setup.py install' >> spkg-install
else
echo >&2 "Error: There is no spkg-install script, no setup.py, and no configure"
echo >&2 "script, so I do not know how to install $PKG_SRC."
exit 1
fi
chmod +x spkg-install
fi

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this never used, and so removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's right. It was a leftover from the abandoned support for "old-style packages"

echo "****************************************************"
echo "Host system:"
uname -a
Expand Down Expand Up @@ -722,9 +704,7 @@ unset SAGE_DESTDIR_LOCAL
# removed by sage-spkg-uninstall
INSTALLED_SCRIPTS_DEST="$SAGE_SPKG_SCRIPTS/$PKG_BASE"

if [ -f spkg-piprm-requirements.txt ]; then
INSTALLED_SCRIPTS="$INSTALLED_SCRIPTS piprm-requirements.txt"
else
if [ ! -f $INSTALLED_SCRIPTS_DEST/spkg-requirements.txt ]; then
# No packages to uninstall with pip, so remove the prepared uninstall script
rm -f spkg-piprm spkg-piprm.in
fi
Expand Down
30 changes: 29 additions & 1 deletion build/make/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,8 @@ wheels:
$(MAKE_REC) SAGE_EDITABLE=no SAGE_WHEELS=yes $(WHEEL_PACKAGES)
@echo "Built wheels are in venv/var/lib/sage/wheels/"

pypi-wheels-check: $(PYPI_WHEEL_PACKAGES:%=%-check)

#==============================================================================
# Setting SAGE_CHECK... variables
#==============================================================================
Expand Down Expand Up @@ -724,15 +726,21 @@ $(1)-$(4)-no-deps:
echo "$$($(4)_DISABLED_MESSAGE)" 2>&1; \
exit 1; \
elif [ -x '$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-install' ]; then \
rm -rf '$$($(4))/var/lib/sage/scripts/$(1)'; \
cd '$$(SAGE_ROOT)/build/pkgs/$(1)' && \
. '$$(SAGE_ROOT)/src/bin/sage-src-env-config' && \
. '$$(SAGE_ROOT)/src/bin/sage-env-config' && \
. '$$(SAGE_ROOT)/src/bin/sage-env' && \
. '$$(SAGE_ROOT)/build/bin/sage-build-env-config' && \
. '$$(SAGE_ROOT)/build/bin/sage-build-env' && \
PKG_BASE="$(1)" \
PKG_VER="$(2)" \
PKG_NAME="$(1)-$(2)" \
SAGE_SPKG_WHEELS=$$($(4))/var/lib/sage/wheels \
SAGE_SPKG_SCRIPTS=$$($(4))/var/lib/sage/scripts \
SAGE_INST_LOCAL=$$($(4)) \
sage-logger -p 'SAGE_CHECK=$$(SAGE_CHECK_$(1)) $$(SAGE_ROOT)/build/pkgs/$(1)/spkg-install' '$$(SAGE_LOGS)/$(1)-$(2).log' && \
SAGE_CHECK=$$(SAGE_CHECK_$(1)) \
sage-logger -p '$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-install && if [ $$$$SAGE_CHECK != no -a -x $$(SAGE_ROOT)/build/pkgs/$(1)/spkg-check ]; then $$(SAGE_ROOT)/build/pkgs/$(1)/spkg-check; fi' '$$(SAGE_LOGS)/$(1)-$(2).log' && \
rm -f "$$($(4))/$(SPKG_INST_RELDIR)/$(1)"-* && \
touch "$$($(4))/$(SPKG_INST_RELDIR)/$(1)-$(2)"; \
else ( \
Expand All @@ -752,6 +760,26 @@ $(1)-$(4)-no-deps:

$(1)-no-deps: $(1)-$(4)-no-deps

$(1)-$(4)-check:
$(PLUS)@if [ -x $$(SAGE_ROOT)/build/pkgs/$(1)/spkg-check ]; then \
cd '$$(SAGE_ROOT)/build/pkgs/$(1)' && \
. '$$(SAGE_ROOT)/src/bin/sage-src-env-config' && \
. '$$(SAGE_ROOT)/src/bin/sage-env-config' && \
. '$$(SAGE_ROOT)/src/bin/sage-env' && \
. '$$(SAGE_ROOT)/build/bin/sage-build-env-config' && \
. '$$(SAGE_ROOT)/build/bin/sage-build-env' && \
PKG_BASE="$(1)" \
PKG_VER="$(2)" \
PKG_NAME="$(1)-$(2)" \
SAGE_SPKG_WHEELS=$$($(4))/var/lib/sage/wheels \
SAGE_SPKG_SCRIPTS=$$($(4))/var/lib/sage/scripts \
SAGE_INST_LOCAL=$$($(4)) \
SAGE_CHECK=$$(SAGE_CHECK_$(1)) \
sage-logger -p '$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-check' '$$(SAGE_LOGS)/$(1)-$(2).log'; \
fi

$(1)-check: $(1)-$(4)-check

$(1)-$(4)-uninstall:
-$(AM_V_at)cd '$$(SAGE_ROOT)/build/pkgs/$(1)' && \
. '$$(SAGE_ROOT)/src/bin/sage-src-env-config' && \
Expand Down
11 changes: 10 additions & 1 deletion build/pkgs/sage_sws2rst/spkg-check
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
#! /bin/sh
cd src && ./check.sh
cd src
./check.sh
if [ $? -ne 0 ]; then
if [ "$SAGE_CHECK" = "warn" ]; then
echo >&2 "Warning: Failures testing package $PKG_NAME (ignored)"
else
echo >&2 "Error testing package $PKG_NAME"
exit 1
fi
fi
10 changes: 0 additions & 10 deletions build/pkgs/sage_sws2rst/spkg-install
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,3 @@ if [ "$SAGE_EDITABLE" = yes ]; then
else
sdh_pip_install .
fi
cd ..
# For type=script packages, spkg-check is not run
case "$SAGE_CHECK" in
yes)
./spkg-check
;;
warn)
./spkg-check || echo >&2 "Warning: Failures testing package sage_sws2rst (ignored)"
;;
esac
1 change: 1 addition & 0 deletions build/pkgs/sagemath_categories/spkg-check
1 change: 1 addition & 0 deletions build/pkgs/sagemath_environment/spkg-check
27 changes: 27 additions & 0 deletions build/pkgs/sagemath_objects/spkg-check
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
cd src

export PIP_NO_INDEX=true
export PIP_FIND_LINKS="file://$SAGE_SPKG_WHEELS"

export TOX_PARALLEL_NO_SPINNER=1
wheel="$(sed -n '1s,.*@ file://,,p' $SAGE_SPKG_SCRIPTS/$PKG_BASE/spkg-requirements.txt)"
echo Running "tox -r -p auto -v --installpkg $wheel"
tox -r -p auto -v --installpkg "$wheel"
status=$?
case $status:$SAGE_CHECK:$([ -r known-test-failures.json ]; echo $?) in
0:*:0) echo "Passed the test suite (modulo baseline known-test-failures*.json)";;
0:*:*) echo "Passed the test suite";;
*:warn:0) echo "Warning: New failures (not in baseline known-test-failures*.json (ignored)"; status=0;;
*:warn:*) echo "Warning: Failures testing the package (ignored)"; status=0;;
*:yes:0) echo "New failures, not in baseline known-test-failures*.json";;
*:yes:*) echo "Failures testing the package";;
esac
# Show summaries of failures (suppress lines ending with '[failed in baseline]')
for f in $(pwd)/.tox/sagepython-sagewheels-nopypi-norequirements*/log/*-command*.log; do
if [ -r "$f" ]; then
echo "$f"
grep '^sage -t.*#[^]]*$' "$f"
fi
done
exit $status
23 changes: 0 additions & 23 deletions build/pkgs/sagemath_objects/spkg-install
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,3 @@ python3 -m build --outdir "$DIST_DIR"/dist . || sdh_die "Failure building sdist

wheel=$(cd "$DIST_DIR" && sdh_store_wheel . >&2 && echo $wheel)
ls -l "$wheel"

if [ "$SAGE_CHECK" != no ]; then
export TOX_PARALLEL_NO_SPINNER=1
echo Running "tox -r -p auto -v --installpkg $wheel"
tox -r -p auto -v --installpkg $wheel
status=$?
case $status:$SAGE_CHECK:$([ -r known-test-failures.json ]; echo $?) in
0:*:0) echo "Passed the test suite (modulo baseline known-test-failures*.json)";;
0:*:*) echo "Passed the test suite";;
*:warn:0) echo "Warning: New failures (not in baseline known-test-failures*.json (ignored)"; status=0;;
*:warn:*) echo "Warning: Failures testing the package (ignored)"; status=0;;
*:yes:0) echo "New failures, not in baseline known-test-failures*.json";;
*:yes:*) echo "Failures testing the package";;
esac
# Show summaries of failures (suppress lines ending with '[failed in baseline]')
for f in $(pwd)/.tox/sagepython-sagewheels-nopypi-norequirements*/log/*-command*.log; do
if [ -r "$f" ]; then
echo "$f"
grep '^sage -t.*#[^]]*$' "$f"
fi
done
exit $status
fi
1 change: 1 addition & 0 deletions build/pkgs/sagemath_repl/spkg-check
Loading