Skip to content

Commit 39a53cc

Browse files
authored
Merge branch 'develop' into p/use-external-urls-in-jupyterlab
2 parents 6370b09 + 07a2afd commit 39a53cc

File tree

1,314 files changed

+13888
-12637
lines changed

Some content is hidden

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

1,314 files changed

+13888
-12637
lines changed

.ci/merge-fixes.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/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="ci-sage@example.com"
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+
echo "::group::Merging PR https://github.com/$REPO/pull/$a"
18+
git tag -f test_head
19+
$GH pr checkout -b pr-$a $a
20+
git fetch --unshallow --all
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"
26+
else
27+
echo "Empty, skipped"
28+
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

.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="ci-sage@example.com"
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)

.devcontainer/onCreate-conda.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e
44
# Create conda environment
55
./bootstrap-conda
66
conda install mamba -n base -c conda-forge -y
7-
mamba env create --file src/environment-dev.yml || mamba env update --file src/environment-dev.yml
7+
mamba env create --file src/environment-dev-3.11.yml || mamba env update --file src/environment-dev-3.11.yml
88
conda init bash
99

1010
# Build sage

.github/workflows/build.yml

Lines changed: 69 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ name: Build & Test
22

33
on:
44
pull_request:
5+
merge_group:
56
push:
6-
branches: ['**']
7+
branches:
8+
- master
9+
- develop
710
# Ignore pushes on tags to prevent two uploads of codecov reports
811
tags-ignore: ['**']
912
workflow_dispatch:
@@ -24,9 +27,32 @@ concurrency:
2427
cancel-in-progress: true
2528

2629
jobs:
30+
get_ci_fixes:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout
34+
id: checkout
35+
uses: actions/checkout@v4
36+
- name: Merge CI fixes from sagemath/sage
37+
run: |
38+
.ci/merge-fixes.sh
39+
env:
40+
GH_TOKEN: ${{ github.token }}
41+
- name: Store CI fixes in upstream artifact
42+
run: |
43+
mkdir -p upstream
44+
if git format-patch --stdout test_base > ci_fixes.patch; then
45+
cp ci_fixes.patch upstream/
46+
fi
47+
- uses: actions/upload-artifact@v3
48+
with:
49+
path: upstream
50+
name: upstream
51+
2752
build:
2853
runs-on: ubuntu-latest
2954
container: ghcr.io/sagemath/sage/sage-${{ github.event.inputs.platform || 'ubuntu-focal-standard' }}-with-targets:${{ github.event.inputs.docker_tag || 'dev'}}
55+
needs: [get_ci_fixes]
3056
steps:
3157
- name: Checkout
3258
id: checkout
@@ -43,48 +69,38 @@ jobs:
4369
id: worktree
4470
run: |
4571
set -ex
46-
git config --global user.email "ci-sage@example.com"
47-
git config --global user.name "Build & Test workflow"
4872
git config --global --add safe.directory $(pwd)
49-
# If actions/checkout downloaded our source tree using the GitHub REST API
50-
# instead of with git (because do not have git installed in our image),
51-
# we first make the source tree a repo.
52-
if [ ! -d .git ]; then git init && git add -A && git commit --quiet -m "new"; fi
53-
# Tag this state of the source tree "new". This is what we want to build and test.
54-
git tag -f new
55-
# Our container image contains a source tree in /sage with a full build of Sage.
56-
# But /sage is not a git repository.
57-
# We make /sage a worktree whose index is at tag "new".
58-
# We then commit the current sources and set the tag "old". (This keeps all mtimes unchanged.)
59-
# Then we update worktree and index with "git reset --hard new".
60-
# (This keeps mtimes of unchanged files unchanged and mtimes of changed files newer than unchanged files.)
61-
# Finally we reset the index to "old". (This keeps all mtimes unchanged.)
62-
# The changed files now show up as uncommitted changes.
63-
# The final "git add -N" makes sure that files that were added in "new" do not show
64-
# as untracked files, which would be removed by "git clean -fx".
65-
git worktree add --detach worktree-image
66-
rm -rf /sage/.git && mv worktree-image/.git /sage/
67-
rm -rf worktree-image && ln -s /sage worktree-image
68-
if [ ! -f worktree-image/.gitignore ]; then cp .gitignore worktree-image/; fi
69-
(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)
70-
71-
- name: Incremental build, test changed files (sage -t --new)
73+
.ci/retrofit-worktree.sh worktree-image /sage
74+
75+
- name: Download upstream artifact
76+
uses: actions/download-artifact@v3
77+
with:
78+
path: upstream
79+
name: upstream
80+
81+
- name: Apply CI fixes from sagemath/sage
82+
# After applying the fixes, make sure all changes are marked as uncommitted changes.
83+
run: |
84+
if [ -r upstream/ci_fixes.patch ]; then
85+
(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
86+
fi
87+
88+
- name: Incremental build
7289
id: incremental
7390
run: |
7491
# Now re-bootstrap and build. The build is incremental because we were careful with the timestamps.
75-
# We run tests with "sage -t --new"; this only tests the uncommitted changes.
76-
./bootstrap && make build && ./sage -t --new -p2
92+
./bootstrap && make build
7793
working-directory: ./worktree-image
7894
env:
79-
MAKE: make -j2
95+
MAKE: make -j2 --output-sync=recurse
8096
SAGE_NUM_THREADS: 2
8197

82-
- name: Build and test modularized distributions
98+
- name: Build modularized distributions
8399
if: always() && steps.worktree.outcome == 'success'
84-
run: make V=0 tox && make pypi-wheels
100+
run: make V=0 tox && make SAGE_CHECK=no pypi-wheels
85101
working-directory: ./worktree-image
86102
env:
87-
MAKE: make -j2
103+
MAKE: make -j2 --output-sync=recurse
88104
SAGE_NUM_THREADS: 2
89105

90106
- name: Set up node to install pyright
@@ -123,7 +139,27 @@ jobs:
123139
make build
124140
working-directory: ./worktree-image
125141
env:
126-
MAKE: make -j2
142+
MAKE: make -j2 --output-sync=recurse
143+
SAGE_NUM_THREADS: 2
144+
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
127163
SAGE_NUM_THREADS: 2
128164

129165
- name: Pytest

.github/workflows/ci-conda.yml

Lines changed: 15 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@ on:
77
branches:
88
- 'public/build/**-runci'
99
pull_request:
10-
types:
11-
# Defaults
12-
- opened
13-
- synchronize
14-
- reopened
15-
# When a CI label is added
16-
- labeled
1710
workflow_dispatch:
1811
# Allow to run manually
1912

@@ -27,20 +20,9 @@ jobs:
2720
name: Conda
2821
runs-on: ${{ matrix.os }}
2922

30-
# Run on push, workflow dispatch and when certain labels are added or are present
31-
if: |
32-
github.event_name != 'pull_request' ||
33-
((github.event.action != 'labeled' &&
34-
(contains(github.event.pull_request.labels.*.name, 'c: packages: standard') ||
35-
contains(github.event.pull_request.labels.*.name, 'c: packages: optional') ||
36-
contains(github.event.pull_request.labels.*.name, 's: run conda ci'))) ||
37-
(github.event.action == 'labeled' &&
38-
(github.event.label.name == 'c: packages: optional' ||
39-
github.event.label.name == 'c: packages: standard' ||
40-
github.event.label.name == 's: run conda ci')))
41-
4223
strategy:
43-
fail-fast: false
24+
fail-fast: ${{ github.event_name == 'pull_request' }}
25+
max-parallel: ${{ github.event_name == 'pull_request' && 2 || 6 }}
4426
matrix:
4527
os: [ubuntu-latest, macos-latest]
4628
python: ['3.9', '3.10', '3.11']
@@ -51,17 +33,11 @@ jobs:
5133
steps:
5234
- uses: actions/checkout@v4
5335

54-
- name: Check for Miniconda
55-
id: check_conda
56-
run: echo ::set-output name=installed::$CONDA
57-
58-
# Miniconda is installed by default in the ubuntu-latest, however not in the act-image to run it locally
59-
- name: Install Miniconda
60-
if: steps.check_conda.outputs.installed == ''
36+
- name: Merge CI fixes from sagemath/sage
6137
run: |
62-
wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh -O ~/miniconda.sh
63-
bash ~/miniconda.sh -b -p $HOME/miniconda
64-
echo "CONDA=$HOME/miniconda" >> $GITHUB_ENV
38+
.ci/merge-fixes.sh
39+
env:
40+
GH_TOKEN: ${{ github.token }}
6541

6642
- name: Create conda environment files
6743
run: ./bootstrap-conda
@@ -71,17 +47,18 @@ jobs:
7147
with:
7248
path: ~/conda_pkgs_dir
7349
key:
74-
${{ runner.os }}-conda-${{ hashFiles('src/environment.yml') }}
50+
${{ runner.os }}-conda-${{ hashFiles('src/environment-3.11.yml') }}
7551

76-
- name: Setup Conda
52+
- name: Setup Conda environment
7753
uses: conda-incubator/setup-miniconda@v2
7854
with:
7955
python-version: ${{ matrix.python }}
80-
mamba-version: "*"
81-
channels: conda-forge,defaults
56+
miniforge-version: latest
57+
use-mamba: true
58+
channels: conda-forge
8259
channel-priority: true
83-
activate-environment: sage-build
84-
environment-file: src/${{ matrix.conda-env }}.yml
60+
activate-environment: sage
61+
environment-file: src/${{ matrix.conda-env }}-${{ matrix.python }}.yml
8562

8663
- name: Print Conda environment
8764
shell: bash -l {0}
@@ -95,19 +72,16 @@ jobs:
9572
run: |
9673
./bootstrap
9774
echo "::add-matcher::.github/workflows/configure-systempackage-problem-matcher.json"
98-
./configure --enable-build-as-root --with-python=$CONDA_PREFIX/bin/python --prefix=$CONDA_PREFIX $(for pkg in $(./sage -package list :standard: --has-file spkg-configure.m4 --has-file distros/conda.txt --exclude rpy2); do echo --with-system-$pkg=force; done)
75+
./configure --enable-build-as-root --with-python=$CONDA_PREFIX/bin/python --prefix=$CONDA_PREFIX --enable-system-site-packages $(for pkg in $(./sage -package list :standard: --has-file spkg-configure.m4 --has-file distros/conda.txt --exclude rpy2); do echo --with-system-$pkg=force; done)
9976
echo "::remove-matcher owner=configure-system-package-warning::"
10077
echo "::remove-matcher owner=configure-system-package-error::"
10178
102-
# Manually install ptyprocess for now, until https://github.com/sagemath/sage/issues/32147 is fixed
103-
pip install --no-build-isolation -v -v ptyprocess==0.5.1
104-
10579
- name: Build
10680
shell: bash -l {0}
10781
run: |
10882
# Use --no-deps and pip check below to verify that all necessary dependencies are installed via conda.
10983
pip install --no-build-isolation --no-deps -v -v -e ./pkgs/sage-conf ./pkgs/sage-setup
110-
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
11185
env:
11286
SAGE_NUM_THREADS: 2
11387

0 commit comments

Comments
 (0)