Skip to content

Commit b9e9c4b

Browse files
authored
Merge branch 'develop' into simplicial_complex_map_orientation_fix
2 parents d79158c + ab24b1c commit b9e9c4b

File tree

320 files changed

+3876
-2574
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

320 files changed

+3876
-2574
lines changed

.ci/create-changes-html.sh

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#!/bin/sh
2+
if [ $# != 2 ]; then
3+
echo >&2 "usage: $0 BASE_DOC_COMMIT DOC_REPO"
4+
echo >&2 "creates CHANGES.html in the current directory"
5+
echo >&2 "for the diffs of DOC_REPO against BASE_DOC_COMMIT"
6+
exit 1
7+
fi
8+
BASE_DOC_COMMIT="$1"
9+
DOC_REPOSITORY="$2"
10+
11+
# Wipe out chronic diffs between old doc and new doc
12+
(cd $DOC_REPOSITORY && find . -name "*.html" | xargs sed -i -e '\;<script type="application/vnd\.jupyter\.widget-state+json">;,\;</script>; d')
13+
# Create CHANGES.html
14+
echo '<html>' > CHANGES.html
15+
echo '<head>' >> CHANGES.html
16+
echo '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css">' >> CHANGES.html
17+
echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>' >> CHANGES.html
18+
echo '<script>hljs.highlightAll();</script>' >> CHANGES.html
19+
cat >> CHANGES.html << EOF
20+
<script>
21+
document.addEventListener('DOMContentLoaded', () => {
22+
const diffSite = 'https://pianomister.github.io/diffsite'
23+
const baseDocURL = 'https://sagemath-tobias.netlify.app'
24+
const diffParagraphs = document.querySelectorAll('p.diff');
25+
diffParagraphs.forEach(paragraph => {
26+
const rootURL = window.location.origin;
27+
const docAnchor = paragraph.querySelector('a'); // first "a" element
28+
const url = new URL(docAnchor.href);
29+
const path = url.pathname;
30+
const anchor = document.createElement('a');
31+
anchor.href = diffSite + '/?url1=' + rootURL + path + '&url2=' + baseDocURL + path;
32+
anchor.textContent = 'compare with the base';
33+
anchor.setAttribute('target', '_blank');
34+
paragraph.appendChild(anchor);
35+
paragraph.innerHTML += '&nbsp;';
36+
const hunkAnchors = paragraph.querySelectorAll('a.hunk');
37+
hunkAnchors.forEach(hunkAnchor => {
38+
const url = new URL(hunkAnchor.href);
39+
const path = url.pathname;
40+
const pathHash = path + url.hash.replace('#', '%23');
41+
const anchor = document.createElement('a');
42+
anchor.href = diffSite + '/?url1=' + rootURL + pathHash + '&url2=' + baseDocURL + path;
43+
anchor.textContent = hunkAnchor.textContent;
44+
anchor.setAttribute('target', '_blank');
45+
paragraph.appendChild(anchor);
46+
paragraph.innerHTML += '&nbsp;';
47+
});
48+
});
49+
});
50+
</script>
51+
EOF
52+
echo '</head>' >> CHANGES.html
53+
echo '<body>' >> CHANGES.html
54+
(cd $DOC_REPOSITORY && git diff $BASE_DOC_COMMIT -- *.html) > diff.txt
55+
python3 - << EOF
56+
import os, re, html
57+
with open('diff.txt', 'r') as f:
58+
diff_text = f.read()
59+
diff_blocks = re.split(r'^(?=diff --git)', diff_text, flags=re.MULTILINE)
60+
out_blocks = []
61+
for block in diff_blocks:
62+
match = re.search(r'^diff --git a/(.*) b/\1', block, flags=re.MULTILINE)
63+
if match:
64+
doc = match.group(1)
65+
path = 'html/' + doc
66+
file_path = os.path.join('$DOC_REPOSITORY', doc)
67+
with open(file_path, 'r') as file:
68+
content = file.readlines()
69+
count = 0
70+
for line in block.splitlines():
71+
if line.startswith('@@ -'):
72+
line_number = int(re.search(r'@@ -(\d+)', line).group(1))
73+
for i in range(line_number, -1, -1):
74+
if content[i].startswith('<'):
75+
count += 1
76+
content[i] = f'<span id="hunk{count}" style="visibility: hidden;"></span>' + content[i]
77+
break
78+
with open(file_path, 'w') as file:
79+
file.writelines(content)
80+
hunks = '&nbsp;'.join(f'<a href="{path}#hunk{i+1}" class="hunk" target="_blank">#{i + 1}</a>' for i in range(count))
81+
out_blocks.append(f'<p class="diff"><a href="{path}">{doc}</a>&nbsp;' + hunks + '&emsp;</p>'
82+
+ '\n<pre><code class="language-diff">'
83+
+ html.escape(block).strip() + '</code></pre>')
84+
output_text = '\n'.join(out_blocks)
85+
with open('diff.html', 'w') as f:
86+
f.write(output_text)
87+
EOF
88+
cat diff.html >> CHANGES.html
89+
echo '</body>' >> CHANGES.html
90+
echo '</html>' >> CHANGES.html
91+
rm diff.txt diff.html

.ci/describe-system.sh

Lines changed: 0 additions & 23 deletions
This file was deleted.

.ci/merge-fixes.sh

Lines changed: 79 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,82 @@
11
#!/bin/sh
2-
# Merge open PRs from sagemath/sage labeled "blocker".
3-
REPO="sagemath/sage"
4-
GH="gh -R $REPO"
5-
PRs="$($GH pr list --label "p: blocker / 1" --json number --jq '.[].number')"
6-
if [ -z "$PRs" ]; then
7-
echo 'Nothing to do: Found no open PRs with "blocker" status.'
8-
else
9-
echo "Found PRs: " $PRs
10-
export GIT_AUTHOR_NAME="ci-sage workflow"
11-
export GIT_AUTHOR_EMAIL="[email protected]"
12-
export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
13-
export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
14-
git tag -f test_base
15-
git commit -q -m "Uncommitted changes" --no-allow-empty -a
16-
for a in $PRs; do
17-
git fetch --unshallow --all > /dev/null 2>&1 && echo "Unshallowed."
18-
echo "::group::Merging PR https://github.com/$REPO/pull/$a"
19-
git tag -f test_head
20-
$GH pr checkout -b pr-$a $a
21-
git checkout -q test_head
22-
if git merge --no-edit --squash -q pr-$a; then
23-
echo "::endgroup::"
24-
if git commit -q -m "Merge https://github.com/$REPO/pull/$a" -a --no-allow-empty; then
25-
echo "Merged #$a"
2+
# Apply open PRs labeled "blocker" from sagemath/sage as patches.
3+
# This script is invoked by various workflows in .github/workflows
4+
#
5+
# The repository variable SAGE_CI_FIXES_FROM_REPOS can be set
6+
# to customize this for CI runs in forks:
7+
#
8+
# - If set to a whitespace-separated list of repositories, use them instead of sagemath/sage.
9+
# - If set to "none", do not apply any PRs.
10+
#
11+
# https://docs.github.com/en/actions/learn-github-actions/variables#creating-configuration-variables-for-a-repository
12+
export GIT_AUTHOR_NAME="ci-sage workflow"
13+
export GIT_AUTHOR_EMAIL="[email protected]"
14+
export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
15+
export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
16+
mkdir -p upstream
17+
for REPO in ${SAGE_CI_FIXES_FROM_REPOSITORIES:-sagemath/sage}; do
18+
case $REPO in
19+
none)
20+
echo "Nothing to do for 'none' in SAGE_CI_FIXES_FROM_REPOSITORIES"
21+
;;
22+
*/*)
23+
echo "Getting open PRs with 'blocker' status from https://github.com/$REPO/pulls?q=is%3Aopen+label%3A%22p%3A+blocker+%2F+1%22"
24+
GH="gh -R $REPO"
25+
REPO_FILE="upstream/ci-fixes-${REPO%%/*}-${REPO##*/}"
26+
PRs="$($GH pr list --label "p: blocker / 1" --json number --jq '.[].number' | tee $REPO_FILE)"
27+
date -u +"%Y-%m-%dT%H:%M:%SZ" > $REPO_FILE.date # Record the date, for future reference
28+
if [ -z "$PRs" ]; then
29+
echo "Nothing to do: Found no open PRs with 'blocker' status in $REPO."
2630
else
27-
echo "Empty, skipped"
31+
echo "Found open PRs with 'blocker' status in $REPO: $(echo $PRs)"
32+
git tag -f test_base
33+
git commit -q -m "Uncommitted changes" --no-allow-empty -a
34+
for a in $PRs; do
35+
# We used to pull the branch and merge it (after unshallowing), but when run on PRs that are
36+
# based on older releases, it has the side effect of updating to this release,
37+
# which may be confusing.
38+
#
39+
# Here, we obtain the "git am"-able patch of the PR branch.
40+
# This also makes it unnecessary to unshallow the repository.
41+
#
42+
# Considered alternative: Use https://github.com/$REPO/pull/$a.diff,
43+
# which squashes everything into one diff without commit metadata.
44+
PULL_URL="https://github.com/$REPO/pull/$a"
45+
PULL_FILE="$REPO_FILE-$a"
46+
PATH=build/bin:$PATH build/bin/sage-download-file --quiet "$PULL_URL.patch" $PULL_FILE.patch
47+
date -u +"%Y-%m-%dT%H:%M:%SZ" > $PULL_FILE.date # Record the date, for future reference
48+
LAST_SHA=$(sed -n -E '/^From [0-9a-f]{40}/s/^From ([0-9a-f]{40}).*/\1/p' $PULL_FILE.patch | tail -n 1)
49+
COMMITS_URL="https://github.com/$REPO/commits/$LAST_SHA"
50+
echo "::group::Applying PR $PULL_URL @ $COMMITS_URL as a patch"
51+
export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME applying $PULL_URL @ $COMMITS_URL"
52+
if git am --signoff --empty=keep < $PULL_FILE.patch; then
53+
echo "---- Applied patch --------------------------------------------------------------------------------"
54+
cat $PULL_FILE.patch
55+
echo "--------------------------------------------------------------------8<-----------------------------"
56+
echo "::endgroup::"
57+
elif git am --abort \
58+
&& if git fetch --unshallow --all > /dev/null 2>&1; then echo "Unshallowed"; fi \
59+
&& echo "Retrying with 3-way merge" \
60+
&& git am --empty=keep --3way < $PULL_FILE.patch; then
61+
echo "---- Applied patch --------------------------------------------------------------------------------"
62+
cat $PULL_FILE.patch
63+
echo "--------------------------------------------------------------------8<-----------------------------"
64+
echo "::endgroup::"
65+
else
66+
echo "---- Failure applying patch -----------------------------------------------------------------------"
67+
git am --signoff --show-current-patch=diff
68+
echo "--------------------------------------------------------------------8<-----------------------------"
69+
echo "::endgroup::"
70+
echo "Failure applying $PULL_URL as a patch, resetting"
71+
git am --signoff --abort
72+
fi
73+
done
2874
fi
29-
else
30-
echo "::endgroup::"
31-
echo "Failure merging #$a, resetting"
32-
git reset --hard
33-
fi
34-
done
35-
git log test_base..HEAD
36-
fi
75+
;;
76+
*)
77+
echo "Repository variable SAGE_CI_FIXES_FROM_REPOSITORIES, if set, should be a whitespace-separated list of repositories or 'none'"
78+
echo "Got: $SAGE_CI_FIXES_FROM_REPOSITORIES"
79+
exit 1
80+
;;
81+
esac
82+
done

.ci/protect-secrets.sh

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
.ci/merge-fixes.sh
3939
env:
4040
GH_TOKEN: ${{ github.token }}
41+
SAGE_CI_FIXES_FROM_REPOSITORIES: ${{ vars.SAGE_CI_FIXES_FROM_REPOSITORIES }}
4142
- name: Store CI fixes in upstream artifact
4243
run: |
4344
mkdir -p upstream

.github/workflows/ci-conda.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
.ci/merge-fixes.sh
3939
env:
4040
GH_TOKEN: ${{ github.token }}
41+
SAGE_CI_FIXES_FROM_REPOSITORIES: ${{ vars.SAGE_CI_FIXES_FROM_REPOSITORIES }}
4142

4243
- name: Create conda environment files
4344
run: ./bootstrap-conda

.github/workflows/ci-linux-incremental.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ jobs:
9898
["standard",
9999
"minimal"]
100100
docker_push_repository: ghcr.io/${{ github.repository }}/
101+
max_parallel: 8
101102

102103
site:
103104
needs: [changed_files]
@@ -120,16 +121,10 @@ jobs:
120121
docker_targets: "with-targets"
121122
targets: "${{needs.changed_files.outputs.uninstall_targets}} ${{needs.changed_files.outputs.build_targets}} build doc-html ptest"
122123
# Only test systems with a usable system python (>= 3.9)
124+
# with only a small number of test failures as of 10.2.rc0
123125
tox_system_factors: >-
124-
["ubuntu-jammy",
125-
"ubuntu-mantic",
126-
"debian-bullseye",
127-
"debian-bookworm",
128-
"fedora-33",
129-
"fedora-38",
130-
"gentoo-python3.11",
131-
"archlinux",
132-
"debian-bullseye-i386"]
126+
["gentoo-python3.11",
127+
"archlinux"]
133128
tox_packages_factors: >-
134129
["standard-sitepackages"]
135130
docker_push_repository: ghcr.io/${{ github.repository }}/

.github/workflows/doc-build-pdf.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
.ci/merge-fixes.sh
3333
env:
3434
GH_TOKEN: ${{ github.token }}
35+
SAGE_CI_FIXES_FROM_REPOSITORIES: ${{ vars.SAGE_CI_FIXES_FROM_REPOSITORIES }}
3536
- name: Store CI fixes in upstream artifact
3637
run: |
3738
mkdir -p upstream
@@ -58,7 +59,6 @@ jobs:
5859
eval $(sage-print-system-package-command auto --yes --no-install-recommends install zip)
5960
eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git texlive)
6061
61-
6262
- name: Add prebuilt tree as a worktree
6363
id: worktree
6464
run: |

0 commit comments

Comments
 (0)