Skip to content

Commit 805ecee

Browse files
authored
Merge branch 'develop' into real-interval-field-construct-question-style
2 parents 5ca39a3 + 8a972c4 commit 805ecee

File tree

598 files changed

+14851
-25391
lines changed

Some content is hidden

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

598 files changed

+14851
-25391
lines changed

.ci/create-changes-html.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ echo '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highli
1616
echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>' >> CHANGES.html
1717
echo '<script>hljs.highlightAll();</script>' >> CHANGES.html
1818
cat >> CHANGES.html << EOF
19+
<style>
20+
p.diff a:first-child {
21+
font-weight: bold;
22+
font-size: x-large;
23+
}
24+
</style>
1925
<script>
2026
document.addEventListener('DOMContentLoaded', () => {
2127
// This URL is hardcoded in the file .github/workflows/doc-publish.yml.

.devcontainer/onCreate-conda.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
set -e
33

44
# Create conda environment
5-
conda install mamba -n base -c conda-forge -y
6-
mamba env create --file src/environment-dev-3.11-linux.yml || mamba env update --file src/environment-dev-3.11-linux.yml
5+
conda config --env --add channels conda-forge
6+
conda config --env --set channel_priority strict
7+
conda update -y --all --override-channels -c conda-forge
8+
conda install mamba=1 -n base -y
9+
mamba env create -y --file environment-dev-3.11-linux.yml || mamba env update -y --file environment-dev-3.11-linux.yml
710
conda init bash
811

912
# Build sage

.github/workflows/ci-conda.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
with:
6060
path: ~/conda_pkgs_dir
6161
key:
62-
${{ runner.os }}-conda-${{ hashFiles('src/environment-3.11.yml') }}
62+
${{ runner.os }}-conda-${{ hashFiles('environment-3.11.yml') }}
6363

6464
- name: Setup Conda environment
6565
uses: conda-incubator/setup-miniconda@v3
@@ -70,7 +70,7 @@ jobs:
7070
channels: conda-forge
7171
channel-priority: true
7272
activate-environment: sage
73-
environment-file: src/${{ matrix.conda-env }}-${{ matrix.python }}-${{ startsWith(matrix.os, 'macos') && (startsWith(runner.arch, 'ARM') && 'macos' || 'macos-x86_64') || 'linux' }}.yml
73+
environment-file: ${{ matrix.conda-env }}-${{ matrix.python }}-${{ startsWith(matrix.os, 'macos') && (startsWith(runner.arch, 'ARM') && 'macos' || 'macos-x86_64') || 'linux' }}.yml
7474

7575
- name: Print Conda environment
7676
shell: bash -l {0}

.github/workflows/ci-linux.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
tox_packages_factors: >-
5151
["standard"]
5252
docker_push_repository: ghcr.io/${{ github.repository }}/
53+
logs_artifact: false
5354

5455
# All platforms. This duplicates the default platform, but why not,
5556
# it makes it more robust regarding random timeouts.

.github/workflows/ci-macos.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
- name: make dist
9696
run: |
9797
./configure --enable-download-from-upstream-url && make dist
98-
- uses: actions/upload-artifact@v3
98+
- uses: actions/upload-artifact@v4
9999
with:
100100
path: "dist/*.tar.gz"
101101
name: dist
@@ -119,7 +119,7 @@ jobs:
119119
steps:
120120
- uses: actions/checkout@v4
121121
if: "!contains(matrix.tox_system_factor, 'nobootstrap')"
122-
- uses: actions/download-artifact@v3
122+
- uses: actions/download-artifact@v4
123123
with:
124124
path: .
125125
name: dist
@@ -147,7 +147,7 @@ jobs:
147147
run: |
148148
mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; cp -r .tox/*/log "artifacts/$LOGS_ARTIFACT_NAME"
149149
if: always()
150-
- uses: actions/upload-artifact@v3
150+
- uses: actions/upload-artifact@v4
151151
with:
152152
path: artifacts
153153
name: ${{ env.LOGS_ARTIFACT_NAME }}

.github/workflows/ci-meson.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
with:
4040
path: ~/conda_pkgs_dir
4141
key:
42-
${{ runner.os }}-conda-${{ hashFiles('src/environment-3.11-linux.yml') }}
42+
${{ runner.os }}-conda-${{ hashFiles('environment-3.11-linux.yml') }}
4343

4444
- name: Compiler cache
4545
uses: hendrikmuhs/[email protected]
@@ -55,7 +55,7 @@ jobs:
5555
channels: conda-forge
5656
channel-priority: true
5757
activate-environment: sage
58-
environment-file: src/environment-${{ matrix.python }}-${{ startsWith(matrix.os, 'macos') && (startsWith(runner.arch, 'ARM') && 'macos' || 'macos-x86_64') || 'linux' }}.yml
58+
environment-file: environment-${{ matrix.python }}-${{ startsWith(matrix.os, 'macos') && (startsWith(runner.arch, 'ARM') && 'macos' || 'macos-x86_64') || 'linux' }}.yml
5959

6060
- name: Print Conda environment
6161
shell: bash -l {0}

.github/workflows/conda-lock-update.py

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,53 @@
44
import subprocess
55

66
script_dir = Path(__file__).resolve().parent
7-
root_dir = script_dir / '..' / '..'
7+
root_dir = script_dir / ".." / ".."
88

99
subprocess.run([str(root_dir / "bootstrap-conda")])
1010

1111
platforms = {
1212
"linux-64": "linux",
1313
"linux-aarch64": "linux-aarch64",
1414
"osx-64": "macos-x86_64",
15-
"osx-arm64": "macos"
16-
#"win-64": "win",
15+
"osx-arm64": "macos",
16+
# "win-64": "win",
1717
}
1818
pythons = ["3.9", "3.10", "3.11"]
1919
tags = ["", "-dev"]
20-
sources = ["", "src"]
2120

2221
for platform_key, platform_value in platforms.items():
2322
for python in pythons:
2423
for tag in tags:
25-
for src in sources:
26-
env_file = root_dir / src / f"environment{tag}-{python}.yml"
27-
lock_file = root_dir / src / f"environment{tag}-{python}-{platform_value}"
24+
env_file = root_dir / f"environment{tag}-{python}.yml"
25+
lock_file = root_dir / f"environment{tag}-{python}-{platform_value}"
26+
lock_file_gen = root_dir / f"environment{tag}-{python}-{platform_value}.yml"
2827

29-
if not env_file.exists():
30-
continue
28+
if not env_file.exists():
29+
continue
3130

32-
print(f"Updating lock file for {env_file} at {lock_file}", flush=True)
33-
subprocess.run(["conda-lock", "--channel", "conda-forge", "--kind", "env", "--platform", platform_key, "--file", str(env_file), "--lockfile", str(lock_file), "--filename-template", str(lock_file)])
31+
print(f"Updating lock file for {env_file} at {lock_file_gen}", flush=True)
32+
subprocess.run(
33+
[
34+
"conda-lock",
35+
"--mamba",
36+
"--channel",
37+
"conda-forge",
38+
"--kind",
39+
"env",
40+
"--platform",
41+
platform_key,
42+
"--file",
43+
str(env_file),
44+
"--lockfile",
45+
str(lock_file),
46+
"--filename-template",
47+
str(lock_file),
48+
],
49+
check=True,
50+
)
51+
52+
# Add conda env name to lock file at beginning
53+
with open(lock_file_gen, "r+") as f:
54+
content = f.read()
55+
f.seek(0, 0)
56+
f.write(f"name: sage{tag}\n{content}")

.github/workflows/doc-build.yml

Lines changed: 60 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -114,59 +114,77 @@ jobs:
114114
- name: Start container
115115
id: container
116116
# Try to continue when "exporting to GitHub Actions Cache" failed with timeout
117-
if: (success() || failure())
118117
run: |
119118
docker run --name BUILD -dit \
120119
--mount type=bind,src=$(pwd),dst=$(pwd) \
121120
--workdir $(pwd) \
122121
${{ env.BUILD_IMAGE }} /bin/sh
123122
124123
#
125-
# On PRs and pushes to develop
124+
# On pull request and push to develop events
126125
#
127126

127+
- name: Get workflow run-id
128+
id: get_run_id
129+
if: steps.container.outcome == 'success' && !startsWith(github.ref, 'refs/tags/') && github.event_name == 'pull_request'
130+
run: |
131+
RESPONSE=$(curl -s -L \
132+
-H "Accept: application/vnd.github+json" \
133+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
134+
"https://api.github.com/repos/${{ github.repository }}/actions/runs?event=push&branch=develop&status=completed")
135+
RUN_ID=$(echo "$RESPONSE" | jq -r --arg name "${{ github.workflow }}" --arg conclusion "success" \
136+
'.workflow_runs[] | select(.name == $name and .conclusion == $conclusion) | .id' | head -n 1)
137+
echo "RUN_ID=$RUN_ID" >> $GITHUB_ENV
138+
139+
- name: Download old doc
140+
id: download-doc
141+
if: steps.get_run_id.outcome == 'success'
142+
uses: actions/download-artifact@v4
143+
with:
144+
name: doc-develop
145+
github-token: ${{ secrets.GITHUB_TOKEN }}
146+
repository: ${{ github.repository }}
147+
run-id: ${{ env.RUN_ID }}
148+
128149
- name: Store old doc
129150
id: worktree
130-
if: (success() || failure()) && steps.container.outcome == 'success' && !startsWith(github.ref, 'refs/tags/')
151+
if: steps.download-doc.outcome == 'success'
131152
run: |
132153
git config --global --add safe.directory $(pwd)
133154
git config --global user.email "[email protected]"
134155
git config --global user.name "Build documentation workflow"
135-
mkdir -p doc
136-
# Check if we are on PR
156+
unzip doc.zip
137157
PR_NUMBER=""
138-
if [[ -n "$GITHUB_REF" ]]; then
139-
if [[ "$GITHUB_REF" =~ refs/pull/([0-9]+)/merge ]]; then
140-
PR_NUMBER="${BASH_REMATCH[1]}"
141-
fi
158+
if [[ "$GITHUB_REF" =~ refs/pull/([0-9]+)/merge ]]; then
159+
PR_NUMBER="${BASH_REMATCH[1]}"
142160
fi
143-
# If so, then prepare to create CHANGES.html
161+
# Create CHANGES.html
144162
if [[ -n "$PR_NUMBER" ]]; then
145163
# mathjax path in old doc (regex)
146164
mathjax_path_from="[-./A-Za-z_]*/tex-chtml[.]js?v=[0-9a-f]*"
147165
# mathjax path in new doc
148166
mathjax_path_to=$(docker exec -e SAGE_USE_CDNS=yes BUILD /sage/sage -python -c "from sage_docbuild.conf import mathjax_path; print(mathjax_path)")
149167
new_version=$(docker exec BUILD cat src/VERSION.txt)
150-
docker cp BUILD:/sage/local/share/doc/sage/html doc/
151168
# Wipe out chronic diffs between old doc and new doc
152169
(cd doc && \
153170
find . -name "*.html" | xargs sed -i -e '/class="sidebar-brand-text"/ s/Sage [0-9a-z.]* /Sage '"$new_version"' /' \
154-
-e '/<link rel="stylesheet"/ s/?v=[0-9a-f]*"/"/' \
171+
-e 's;?v=[0-9a-f]*";";' \
155172
-e 's;'"$mathjax_path_from"';'"$mathjax_path_to"';' \
156173
-e '\;<script type="application/vnd\.jupyter\.widget-state+json">;,\;</script>; d' \
157174
-e 's;#L[0-9]*";";' \
175+
-e 's;tab-set--[0-9]*-;tab-set-;' \
158176
&& true)
159177
# Create git repo from old doc
160178
(cd doc && \
161179
git init && \
162-
(echo "*.svg binary"; echo "*.pdf binary") >> .gitattributes && \
163-
(echo ".buildinfo"; echo '*.inv'; echo '.git*'; echo '*.svg'; echo '*.pdf'; echo '*.png'; echo 'searchindex.js') > .gitignore; \
180+
(echo "*.svg binary"; echo "*.pdf binary") > .gitattributes && \
181+
(echo ".buildinfo"; echo '*.inv'; echo '.git*'; echo '*.svg'; echo '*.pdf'; echo '*.png'; echo 'searchindex.js') > .gitignore && \
164182
git add -A && git commit --quiet -m 'old')
165183
fi
166184
167185
- name: Build doc
168186
id: docbuild
169-
if: (success() || failure()) && steps.worktree.outcome == 'success' && !startsWith(github.ref, 'refs/tags/')
187+
if: steps.container.outcome == 'success' && !startsWith(github.ref, 'refs/tags/')
170188
# Always non-incremental because of the concern that
171189
# incremental docbuild may introduce broken links (inter-file references) though build succeeds
172190
run: |
@@ -175,18 +193,22 @@ jobs:
175193
export MAKE="make -j5 --output-sync=recurse" SAGE_NUM_THREADS=5
176194
make doc-clean doc-uninstall
177195
export SAGE_USE_CDNS=yes
196+
export SAGE_DOCBUILD_OPTS="--include-tests-blocks"
178197
./config.status && make sagemath_doc_html-no-deps
179198
shell: sh .ci/docker-exec-script.sh BUILD /sage {0}
180199

181200
- name: Copy doc
182201
id: copy
183-
if: (success() || failure()) && steps.docbuild.outcome == 'success'
202+
if: steps.docbuild.outcome == 'success'
184203
run: |
185204
set -ex
186-
# We copy everything to a local folder
187-
docker cp --follow-link BUILD:/sage/local/share/doc/sage/html doc
188-
docker cp --follow-link BUILD:/sage/local/share/doc/sage/index.html doc
189-
# Check if we are on PR
205+
# Simpler "docker cp --follow-link ... doc" does not work
206+
mkdir -p doc
207+
mkdir -p temp
208+
docker cp --follow-link BUILD:/sage/local/share/doc/sage/html temp
209+
docker cp --follow-link BUILD:/sage/local/share/doc/sage/index.html temp
210+
cp -r -L temp/* doc/
211+
# Check if we are on pull request event
190212
PR_NUMBER=""
191213
if [[ -n "$GITHUB_REF" ]]; then
192214
if [[ "$GITHUB_REF" =~ refs/pull/([0-9]+)/merge ]]; then
@@ -199,9 +221,10 @@ jobs:
199221
# Wipe out chronic diffs of new doc against old doc before creating CHANGES.html
200222
(cd doc && \
201223
find . -name "*.html" | xargs sed -i -e '/This is documentation/ s/ built with GitHub PR .* for development/ for development/' \
202-
-e '/<link rel="stylesheet"/ s/?v=[0-9a-f]*"/"/' \
224+
-e 's;?v=[0-9a-f]*";";' \
203225
-e '\;<script type="application/vnd\.jupyter\.widget-state+json">;,\;</script>; d' \
204226
-e 's;#L[0-9]*";";' \
227+
-e 's;tab-set--[0-9]*-;tab-set-;' \
205228
&& git commit -a -m 'wipe-out')
206229
# Since HEAD is at commit 'wipe-out', HEAD~1 is commit 'new' (new doc), HEAD~2 is commit 'old' (old doc)
207230
(cd doc && git diff $(git rev-parse HEAD~2) -- "*.html") > diff.txt
@@ -221,20 +244,31 @@ jobs:
221244
222245
- name: Upload doc
223246
id: upload
224-
if: (success() || failure()) && steps.copy.outcome == 'success'
247+
if: steps.copy.outcome == 'success'
225248
uses: actions/upload-artifact@v4
226249
with:
227250
name: doc
228251
path: doc.zip
229252

253+
- name: Upload doc-develop
254+
# artifact doc-develop is used for doc build on pull request event
255+
id: upload-push
256+
if: steps.copy.outcome == 'success' && github.event_name == 'push'
257+
uses: actions/upload-artifact@v4
258+
with:
259+
name: doc-${{ github.ref_name }}
260+
path: doc.zip
261+
230262
#
231-
# On release tags: live doc and wheels
263+
# On release tag event
232264
#
233265

234266
- name: Build live doc
235267
id: buildlivedoc
236-
if: (success() || failure()) && startsWith(github.ref, 'refs/tags/')
268+
if: startsWith(github.ref, 'refs/tags/')
237269
run: |
270+
# Avoid running out of disk space
271+
rm -rf upstream
238272
export MAKE="make -j5 --output-sync=recurse" SAGE_NUM_THREADS=5
239273
export PATH="build/bin:$PATH"
240274
eval $(sage-print-system-package-command auto update)
@@ -249,7 +283,7 @@ jobs:
249283

250284
- name: Copy live doc
251285
id: copylivedoc
252-
if: (success() || failure()) && steps.buildlivedoc.outcome == 'success'
286+
if: steps.buildlivedoc.outcome == 'success'
253287
run: |
254288
mkdir -p ./livedoc
255289
# We copy everything to a local folder
@@ -259,7 +293,7 @@ jobs:
259293
zip -r livedoc.zip livedoc
260294
261295
- name: Upload live doc
262-
if: (success() || failure()) && steps.copylivedoc.outcome == 'success'
296+
if: steps.copylivedoc.outcome == 'success'
263297
uses: actions/upload-artifact@v4
264298
with:
265299
name: livedoc

.github/workflows/docker.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ on:
8585
description: 'Elapsed time (seconds) at which to kill the build'
8686
default: 20000
8787
type: number
88+
logs_artifact:
89+
default: true
90+
type: boolean
8891
#
8992
# Publishing to GitHub Packages
9093
#
@@ -170,7 +173,7 @@ jobs:
170173
ref: ${{ inputs.sage_ref }}
171174
fetch-depth: 10000
172175
- name: Download upstream artifact
173-
uses: actions/download-artifact@v3
176+
uses: actions/download-artifact@v4
174177
with:
175178
path: upstream
176179
name: ${{ inputs.upstream_artifact }}
@@ -260,11 +263,12 @@ jobs:
260263
cp -r .tox/$TOX_ENV/* "artifacts/$LOGS_ARTIFACT_NAME"
261264
rm -rf "artifacts/$LOGS_ARTIFACT_NAME"/{bin,lib,pyvenv.cfg}
262265
if: always()
263-
- uses: actions/upload-artifact@v3
266+
- name: Upload logs artifact
267+
uses: actions/upload-artifact@v4
264268
with:
265269
path: artifacts
266270
name: ${{ env.LOGS_ARTIFACT_NAME }}
267-
if: always()
271+
if: always() && inputs.logs_artifact
268272
- name: Print out logs for immediate inspection
269273
# and markup the output with GitHub Actions logging commands
270274
run: |

0 commit comments

Comments
 (0)