Skip to content

Commit f833de2

Browse files
committed
Merge branch 'develop' into p/36144/p/rework-on-live-sage-documentation
2 parents 5b98e92 + 07a2afd commit f833de2

File tree

269 files changed

+1991
-1553
lines changed

Some content is hidden

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

269 files changed

+1991
-1553
lines changed

.ci/retrofit-worktree.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/sh
2+
if [ $# != 2 ]; then
3+
echo >&2 "usage: $0 WORKTREE_NAME WORKTREE_DIRECTORY"
4+
echo >&2 "Ensures that the current working directory is a git repository,"
5+
echo >&2 "then makes WORKTREE_DIRECTORY a git worktree named WORKTREE_NAME."
6+
fi
7+
WORKTREE_NAME="$1"
8+
WORKTREE_DIRECTORY="$2"
9+
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+
15+
set -ex
16+
17+
# If actions/checkout downloaded our source tree using the GitHub REST API
18+
# instead of with git (because do not have git installed in our image),
19+
# we first make the source tree a repo.
20+
if [ ! -d .git ]; then git init && git add -A && git commit --quiet -m "new"; fi
21+
22+
# Tag this state of the source tree "new". This is what we want to build and test.
23+
git tag -f new
24+
25+
# Our container image contains a source tree in $WORKTREE_DIRECTORY with a full build of Sage.
26+
# But $WORKTREE_DIRECTORY is not a git repository.
27+
# We make $WORKTREE_DIRECTORY a worktree whose index is at tag "new".
28+
# We then commit the current sources and set the tag "old". (This keeps all mtimes unchanged.)
29+
# Then we update worktree and index with "git reset --hard new".
30+
# (This keeps mtimes of unchanged files unchanged and mtimes of changed files newer than unchanged files.)
31+
# Finally we reset the index to "old". (This keeps all mtimes unchanged.)
32+
# The changed files now show up as uncommitted changes.
33+
# The final "git add -N" makes sure that files that were added in "new" do not show
34+
# as untracked files, which would be removed by "git clean -fx".
35+
git worktree add --detach $WORKTREE_NAME
36+
rm -rf $WORKTREE_DIRECTORY/.git && mv $WORKTREE_NAME/.git $WORKTREE_DIRECTORY/
37+
rm -rf $WORKTREE_NAME && ln -s $WORKTREE_DIRECTORY $WORKTREE_NAME
38+
if [ ! -f $WORKTREE_NAME/.gitignore ]; then cp .gitignore $WORKTREE_NAME/; fi
39+
(cd $WORKTREE_NAME && git add -A && git commit --quiet --allow-empty -m "old" -a && git tag -f old && git reset --hard new && git reset --quiet old && git add -N . && git status)

.github/workflows/build.yml

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -69,30 +69,8 @@ jobs:
6969
id: worktree
7070
run: |
7171
set -ex
72-
git config --global user.email "[email protected]"
73-
git config --global user.name "Build & Test workflow"
7472
git config --global --add safe.directory $(pwd)
75-
# If actions/checkout downloaded our source tree using the GitHub REST API
76-
# instead of with git (because do not have git installed in our image),
77-
# we first make the source tree a repo.
78-
if [ ! -d .git ]; then git init && git add -A && git commit --quiet -m "new"; fi
79-
# Tag this state of the source tree "new". This is what we want to build and test.
80-
git tag -f new
81-
# Our container image contains a source tree in /sage with a full build of Sage.
82-
# But /sage is not a git repository.
83-
# We make /sage a worktree whose index is at tag "new".
84-
# We then commit the current sources and set the tag "old". (This keeps all mtimes unchanged.)
85-
# Then we update worktree and index with "git reset --hard new".
86-
# (This keeps mtimes of unchanged files unchanged and mtimes of changed files newer than unchanged files.)
87-
# Finally we reset the index to "old". (This keeps all mtimes unchanged.)
88-
# The changed files now show up as uncommitted changes.
89-
# The final "git add -N" makes sure that files that were added in "new" do not show
90-
# as untracked files, which would be removed by "git clean -fx".
91-
git worktree add --detach worktree-image
92-
rm -rf /sage/.git && mv worktree-image/.git /sage/
93-
rm -rf worktree-image && ln -s /sage worktree-image
94-
if [ ! -f worktree-image/.gitignore ]; then cp .gitignore worktree-image/; fi
95-
(cd worktree-image && git add -A && git commit --quiet --allow-empty -m "old" -a && git tag -f old && git reset --hard new && git reset --quiet old && git add -N . && git status)
73+
.ci/retrofit-worktree.sh worktree-image /sage
9674
9775
- name: Download upstream artifact
9876
uses: actions/download-artifact@v3
@@ -107,20 +85,19 @@ jobs:
10785
(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
10886
fi
10987
110-
- name: Incremental build, test changed files (sage -t --new)
88+
- name: Incremental build
11189
id: incremental
11290
run: |
11391
# Now re-bootstrap and build. The build is incremental because we were careful with the timestamps.
114-
# We run tests with "sage -t --new"; this only tests the uncommitted changes.
115-
./bootstrap && make build && ./sage -t --new -p2
92+
./bootstrap && make build
11693
working-directory: ./worktree-image
11794
env:
11895
MAKE: make -j2 --output-sync=recurse
11996
SAGE_NUM_THREADS: 2
12097

121-
- name: Build and test modularized distributions
98+
- name: Build modularized distributions
12299
if: always() && steps.worktree.outcome == 'success'
123-
run: make V=0 tox && make pypi-wheels
100+
run: make V=0 tox && make SAGE_CHECK=no pypi-wheels
124101
working-directory: ./worktree-image
125102
env:
126103
MAKE: make -j2 --output-sync=recurse
@@ -165,6 +142,26 @@ jobs:
165142
MAKE: make -j2 --output-sync=recurse
166143
SAGE_NUM_THREADS: 2
167144

145+
# Testing
146+
147+
- name: Test changed files (sage -t --new)
148+
if: always() && steps.build.outcome == 'success'
149+
run: |
150+
# We run tests with "sage -t --new"; this only tests the uncommitted changes.
151+
./sage -t --new -p2
152+
working-directory: ./worktree-image
153+
env:
154+
MAKE: make -j2 --output-sync=recurse
155+
SAGE_NUM_THREADS: 2
156+
157+
- name: Test modularized distributions
158+
if: always() && steps.build.outcome == 'success'
159+
run: make V=0 tox && make pypi-wheels-check
160+
working-directory: ./worktree-image
161+
env:
162+
MAKE: make -j2 --output-sync=recurse
163+
SAGE_NUM_THREADS: 2
164+
168165
- name: Pytest
169166
if: contains(github.ref, 'pytest')
170167
run: |

.github/workflows/ci-conda.yml

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,6 @@ jobs:
3939
env:
4040
GH_TOKEN: ${{ github.token }}
4141

42-
- name: Check for Miniconda
43-
id: check_conda
44-
run: echo ::set-output name=installed::$CONDA
45-
46-
# Miniconda is installed by default in the ubuntu-latest, however not in the act-image to run it locally
47-
- name: Install Miniconda
48-
if: steps.check_conda.outputs.installed == ''
49-
run: |
50-
wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh -O ~/miniconda.sh
51-
bash ~/miniconda.sh -b -p $HOME/miniconda
52-
echo "CONDA=$HOME/miniconda" >> $GITHUB_ENV
53-
5442
- name: Create conda environment files
5543
run: ./bootstrap-conda
5644

@@ -61,12 +49,13 @@ jobs:
6149
key:
6250
${{ runner.os }}-conda-${{ hashFiles('src/environment-3.11.yml') }}
6351

64-
- name: Setup Conda
52+
- name: Setup Conda environment
6553
uses: conda-incubator/setup-miniconda@v2
6654
with:
6755
python-version: ${{ matrix.python }}
68-
mamba-version: "*"
69-
channels: conda-forge,defaults
56+
miniforge-version: latest
57+
use-mamba: true
58+
channels: conda-forge
7059
channel-priority: true
7160
activate-environment: sage
7261
environment-file: src/${{ matrix.conda-env }}-${{ matrix.python }}.yml
@@ -92,7 +81,7 @@ jobs:
9281
run: |
9382
# Use --no-deps and pip check below to verify that all necessary dependencies are installed via conda.
9483
pip install --no-build-isolation --no-deps -v -v -e ./pkgs/sage-conf ./pkgs/sage-setup
95-
pip install --no-build-isolation --no-deps -v -v -e ./src
84+
pip install --no-build-isolation --no-deps --config-settings editable_mode=compat -v -v -e ./src
9685
env:
9786
SAGE_NUM_THREADS: 2
9887

.github/workflows/ci-linux.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,46 @@ permissions:
3434

3535
jobs:
3636

37+
# standard-pre for the default platform (used by build.yml etc.)
38+
default-pre:
39+
uses: ./.github/workflows/docker.yml
40+
with:
41+
# Build from scratch
42+
docker_targets: "with-system-packages configured with-targets-pre"
43+
# FIXME: duplicated from env.TARGETS
44+
targets_pre: all-sage-local
45+
tox_system_factors: >-
46+
["ubuntu-focal"]
47+
tox_packages_factors: >-
48+
["standard"]
49+
docker_push_repository: ghcr.io/${{ github.repository }}/
50+
51+
# standard for the default platform (used by build.yml etc.)
52+
default:
53+
if: ${{ success() || failure() }}
54+
needs: [default-pre]
55+
uses: ./.github/workflows/docker.yml
56+
with:
57+
# Build incrementally from previous stage (pre)
58+
incremental: true
59+
free_disk_space: true
60+
from_docker_repository: ghcr.io/${{ github.repository }}/
61+
from_docker_target: "with-targets-pre"
62+
docker_targets: "with-targets with-targets-optional"
63+
# FIXME: duplicated from env.TARGETS
64+
targets: build doc-html
65+
targets_optional: ptest
66+
tox_system_factors: >-
67+
["ubuntu-focal"]
68+
tox_packages_factors: >-
69+
["standard"]
70+
docker_push_repository: ghcr.io/${{ github.repository }}/
71+
72+
# All platforms. This duplicates the default platform, but why not,
73+
# it makes it more robust regarding random timeouts.
74+
3775
standard-pre:
76+
if: ${{ success() || failure() }}
3877
uses: ./.github/workflows/docker.yml
3978
with:
4079
# Build from scratch

.github/workflows/dist.yml

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ jobs:
1818

1919
release_dist:
2020

21-
# This job, in contrast to "dist" in ci-macos.yml,
22-
# does not use "configure --enable-download-from-upstream-url"
23-
# (the default since #32390).
21+
# This job first checks whether "configure --enable-download-from-upstream-url"
22+
# (the default since #32390) is needed.
2423
#
2524
# In this way, we check that all necessary package tarballs
2625
# have already been uploaded to the Sage server at the time
@@ -37,13 +36,42 @@ jobs:
3736
run: |
3837
sudo DEBIAN_FRONTEND=noninteractive apt-get update
3938
sudo DEBIAN_FRONTEND=noninteractive apt-get install $(build/bin/sage-get-system-packages debian _bootstrap)
40-
- name: make dist
39+
- name: make dist (--disable-download-from-upstream-url)
4140
run: |
4241
./bootstrap -D && ./configure --disable-download-from-upstream-url && make dist
42+
env:
43+
MAKE: make -j8
44+
- name: make dist (--enable-download-from-upstream-url)
45+
if: failure()
46+
run: |
47+
./configure && make dist
48+
env:
49+
MAKE: make -j8
4350
- uses: actions/upload-artifact@v3
51+
if: success() || failure()
52+
with:
53+
path: |
54+
dist/*.tar.gz
55+
upstream
56+
name: release_dist
57+
58+
release:
59+
60+
needs: release_dist
61+
runs-on: ubuntu-latest
62+
if: (success() || failure()) && github.repository == 'sagemath/sage' && startsWith(github.ref, 'refs/tags/') && !contains(github.ref, 'beta') && !contains(github.ref, 'rc')
63+
steps:
64+
- uses: actions/download-artifact@v3
4465
with:
45-
path: "dist/*.tar.gz"
4666
name: release_dist
67+
- uses: softprops/action-gh-release@v1
68+
with:
69+
generate_release_notes: true
70+
files: |
71+
dist/*
72+
upstream/*
73+
permissions:
74+
contents: write
4775

4876
sdists_for_pypi:
4977

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

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -62,31 +62,10 @@ jobs:
6262
- name: Add prebuilt tree as a worktree
6363
id: worktree
6464
run: |
65-
set -ex
65+
git config --global --add safe.directory $(pwd)
6666
git config --global user.email "[email protected]"
6767
git config --global user.name "Build & Test workflow"
68-
git config --global --add safe.directory $(pwd)
69-
# If actions/checkout downloaded our source tree using the GitHub REST API
70-
# instead of with git (because do not have git installed in our image),
71-
# we first make the source tree a repo.
72-
if [ ! -d .git ]; then git init && git add -A && git commit --quiet -m "new"; fi
73-
# Tag this state of the source tree "new". This is what we want to build and test.
74-
git tag -f new
75-
# Our container image contains a source tree in /sage with a full build of Sage.
76-
# But /sage is not a git repository.
77-
# We make /sage a worktree whose index is at tag "new".
78-
# We then commit the current sources and set the tag "old". (This keeps all mtimes unchanged.)
79-
# Then we update worktree and index with "git reset --hard new".
80-
# (This keeps mtimes of unchanged files unchanged and mtimes of changed files newer than unchanged files.)
81-
# Finally we reset the index to "old". (This keeps all mtimes unchanged.)
82-
# The changed files now show up as uncommitted changes.
83-
# The final "git add -N" makes sure that files that were added in "new" do not show
84-
# as untracked files, which would be removed by "git clean -fx".
85-
git worktree add --detach worktree-image
86-
rm -rf /sage/.git && mv worktree-image/.git /sage/
87-
rm -rf worktree-image && ln -s /sage worktree-image
88-
if [ ! -f worktree-image/.gitignore ]; then cp .gitignore worktree-image/; fi
89-
(cd worktree-image && git add -A && git commit --quiet --allow-empty -m "old" -a && git tag -f old && git reset --hard new && git reset --quiet old && git add -N . && git status)
68+
.ci/retrofit-worktree.sh worktree-image /sage
9069
# Keep track of changes to built HTML
9170
new_version=$(cat src/VERSION.txt); (cd /sage/local/share/doc/sage/html/en && find . -name "*.html" | xargs sed -i '/class="sidebar-brand-text"/s/Sage [0-9a-z.]* /Sage '$new_version' /'; git init && (echo "*.svg binary"; echo "*.pdf binary") >> .gitattributes && (echo ".buildinfo"; echo '*.inv'; echo '.git*'; echo '*.svg'; echo '*.pdf'; echo '*.png'; echo 'searchindex.js') > .gitignore; git add -A && git commit --quiet -m "old")
9271
@@ -110,27 +89,28 @@ jobs:
11089
./bootstrap && make build
11190
working-directory: ./worktree-image
11291
env:
113-
MAKE: make -j2
92+
MAKE: make -j2 --output-sync=recurse
11493
SAGE_NUM_THREADS: 2
11594

11695
- name: Build (fallback to non-incremental)
11796
id: build
11897
if: always() && steps.worktree.outcome == 'success' && steps.incremental.outcome != 'success'
11998
run: |
12099
set -ex
121-
make doc-clean doc-uninstall sagelib-clean && git clean -fx src/sage && ./config.status && make build
100+
make sagelib-clean && git clean -fx src/sage && ./config.status && make build
122101
working-directory: ./worktree-image
123102
env:
124-
MAKE: make -j2
103+
MAKE: make -j2 --output-sync=recurse
125104
SAGE_NUM_THREADS: 2
126105

127106
- name: Build docs (PDF)
128107
id: docbuild
129108
if: always() && (steps.incremental.outcome == 'success' || steps.build.outcome == 'success')
130-
run: make build V=0 && make doc-pdf
109+
run: |
110+
make doc-clean doc-uninstall; make doc-pdf
131111
working-directory: ./worktree-image
132112
env:
133-
MAKE: make -j2
113+
MAKE: make -j2 --output-sync=recurse
134114
SAGE_NUM_THREADS: 2
135115

136116
- name: Copy docs

.github/workflows/doc-build.yml

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -53,31 +53,10 @@ jobs:
5353
- name: Add prebuilt tree as a worktree
5454
id: worktree
5555
run: |
56-
set -ex
56+
git config --global --add safe.directory $(pwd)
5757
git config --global user.email "[email protected]"
5858
git config --global user.name "Build & Test workflow"
59-
git config --global --add safe.directory $(pwd)
60-
# If actions/checkout downloaded our source tree using the GitHub REST API
61-
# instead of with git (because do not have git installed in our image),
62-
# we first make the source tree a repo.
63-
if [ ! -d .git ]; then git init && git add -A && git commit --quiet -m "new"; fi
64-
# Tag this state of the source tree "new". This is what we want to build and test.
65-
git tag -f new
66-
# Our container image contains a source tree in /sage with a full build of Sage.
67-
# But /sage is not a git repository.
68-
# We make /sage a worktree whose index is at tag "new".
69-
# We then commit the current sources and set the tag "old". (This keeps all mtimes unchanged.)
70-
# Then we update worktree and index with "git reset --hard new".
71-
# (This keeps mtimes of unchanged files unchanged and mtimes of changed files newer than unchanged files.)
72-
# Finally we reset the index to "old". (This keeps all mtimes unchanged.)
73-
# The changed files now show up as uncommitted changes.
74-
# The final "git add -N" makes sure that files that were added in "new" do not show
75-
# as untracked files, which would be removed by "git clean -fx".
76-
git worktree add --detach worktree-image
77-
rm -rf /sage/.git && mv worktree-image/.git /sage/
78-
rm -rf worktree-image && ln -s /sage worktree-image
79-
if [ ! -f worktree-image/.gitignore ]; then cp .gitignore worktree-image/; fi
80-
(cd worktree-image && git add -A && git commit --quiet --allow-empty -m "old" -a && git tag -f old && git reset --hard new && git reset --quiet old && git add -N . && git status)
59+
.ci/retrofit-worktree.sh worktree-image /sage
8160
# Keep track of changes to built HTML
8261
new_version=$(cat src/VERSION.txt); (cd /sage/local/share/doc/sage/html/en && find . -name "*.html" | xargs sed -i '/class="sidebar-brand-text"/s/Sage [0-9a-z.]* /Sage '$new_version' /'; git init && (echo "*.svg binary"; echo "*.pdf binary") >> .gitattributes && (echo ".buildinfo"; echo '*.inv'; echo '.git*'; echo '*.svg'; echo '*.pdf'; echo '*.png'; echo 'searchindex.js') > .gitignore; git add -A && git commit --quiet -m "old")
8362
@@ -109,7 +88,7 @@ jobs:
10988
if: always() && steps.worktree.outcome == 'success' && steps.incremental.outcome != 'success'
11089
run: |
11190
set -ex
112-
make doc-clean doc-uninstall sagelib-clean && git clean -fx src/sage && ./config.status && make build
91+
make sagelib-clean && git clean -fx src/sage && ./config.status && make build
11392
working-directory: ./worktree-image
11493
env:
11594
MAKE: make -j2 --output-sync=recurse
@@ -126,7 +105,7 @@ jobs:
126105
export SAGE_LIVE_DOC=yes
127106
export SAGE_JUPYTER_SERVER=binder:sagemath/sage-binder-env/dev
128107
mv /sage/local/share/doc/sage/html/en/.git /sage/.git-doc
129-
make doc-clean doc-uninstall sagelib-clean && git clean -fx src/sage
108+
make doc-clean doc-uninstall
130109
mkdir -p /sage/local/share/doc/sage/html/en/ && mv /sage/.git-doc /sage/local/share/doc/sage/html/en/.git
131110
./config.status && make doc-html
132111
working-directory: ./worktree-image

0 commit comments

Comments
 (0)