Skip to content

Commit 60f7eab

Browse files
committed
Restore ci linux
1 parent 871ba9d commit 60f7eab

File tree

18 files changed

+843
-1609
lines changed

18 files changed

+843
-1609
lines changed

.ci/retrofit-worktree.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,30 @@ git config --global user.email "$GIT_AUTHOR_EMAIL"
2020

2121
set -x
2222

23-
# If actions/checkout downloaded our source tree using the GitHub REST API
24-
# instead of with git (because do not have git installed in our image),
25-
# we first make the source tree a repo.
23+
# If actions/checkout downloaded our source tree (in current directory) using the
24+
# GitHub REST API instead of with git, we first make the source tree a repo.
2625
if [ ! -d .git ]; then git init; fi
2726

28-
# Commit and tag this state of the source tree "new". This is what we want to build and test.
27+
# Commit and tag this state of the source tree "new". The current directory
28+
# contains "new" source files with which we want to build and test.
2929
git add -A && git commit --quiet --allow-empty -m "new"
3030
git tag -f new
3131

3232
# Our container image contains a source tree in $WORKTREE_DIRECTORY with a full build of Sage.
3333
# But $WORKTREE_DIRECTORY is not a git repository.
3434
# We make $WORKTREE_DIRECTORY a worktree whose index is at tag "new".
35-
# We then commit the current sources and set the tag "old". (This keeps all mtimes unchanged.)
36-
# Then we update worktree and index with "git checkout new".
37-
# (This keeps mtimes of unchanged files unchanged and mtimes of changed files newer than unchanged files.)
3835
if [ -L $WORKTREE_NAME ]; then
3936
rm -f $WORKTREE_NAME
4037
fi
4138
git worktree prune --verbose
4239
git worktree add --detach $WORKTREE_NAME
4340
rm -rf $WORKTREE_DIRECTORY/.git && mv $WORKTREE_NAME/.git $WORKTREE_DIRECTORY/
4441
rm -rf $WORKTREE_NAME && ln -s $WORKTREE_DIRECTORY $WORKTREE_NAME
42+
43+
# Copy "new" .gitignore (in current directory) to the worktree if there is not one already.
4544
if [ ! -f $WORKTREE_NAME/.gitignore ]; then cp .gitignore $WORKTREE_NAME/; fi
46-
(cd $WORKTREE_NAME && git add -A && git commit --quiet --allow-empty -m "old" -a && git tag -f old && git checkout -f new && git clean -fd && git status)
45+
# We then commit the worktree and set the tag "old". (This keeps all modification times unchanged.)
46+
(cd $WORKTREE_NAME && git add -A && git commit --quiet --allow-empty -m "old" && git tag -f old)
47+
# Then we update the worktree and index with "git checkout new". (This keeps modification times of "old" files
48+
# and makes modification times of "new" files newer, which triggers incremental build.)
49+
(cd $WORKTREE_NAME && git checkout -f new)

.ci/write-dockerfile.sh

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
#! /usr/bin/env bash
2-
set -e
3-
shopt -s extglob
42
##
53
## Write a Dockerfile for portability testing to stdout.
64
##
75
## This script needs to be run from SAGE_ROOT (root of the Sage repository).
86
## It is called by $SAGE_ROOT/tox.ini for all environments 'tox -e docker-...'
97
##
8+
## The generated Dockerfile needs Sage source tree directory as context,
9+
## and builds Sage docker images based on the source tree.
10+
##
11+
## Hence this is how to use it:
12+
##
13+
## git worktree add source-tree
14+
## docker build source-tree -f Dockerfile ...
15+
## git worktree remove source-tree
16+
##
17+
## where we assume the current directory is SAGE_ROOT.
18+
##
19+
set -e
20+
shopt -s extglob
1021
## Positional arguments:
1122
##
1223
SYSTEM="${1:-debian}"
@@ -15,7 +26,7 @@ WITH_SYSTEM_SPKG="${3:-yes}"
1526
IGNORE_MISSING_SYSTEM_PACKAGES="${4:-no}"
1627
EXTRA_SAGE_PACKAGES="${5:-_bootstrap}"
1728
##
18-
## Environment variables that take influence:
29+
## Environment variables that influence:
1930
##
2031
## - BOOTSTRAP
2132
## - CONFIGURE_ARGS
@@ -274,32 +285,28 @@ cat <<EOF
274285
275286
FROM with-system-packages AS bootstrapped
276287
#:bootstrapping:
277-
RUN rm -rf /new /sage/.git
278-
$ADD Makefile VERSION.txt COPYING.txt condarc.yml README.md bootstrap conftest.py configure_wrapper configure.ac sage .homebrew-build-env tox.ini .gitignore /new/
279-
$ADD config/config.rpath /new/config/config.rpath
280-
$ADD src/doc/bootstrap /new/src/doc/bootstrap
281-
$ADD src/bin /new/src/bin
282-
$ADD src/pyproject.toml src/requirements.txt.m4 src/setup.cfg.m4 src/VERSION.txt /new/src/
283-
$ADD m4 /new/m4
284-
$ADD pkgs /new/pkgs
285-
$ADD build /new/build
286-
$ADD .upstream.d /new/.upstream.d
287-
ADD .ci /.ci
288-
RUN if [ -d /sage ]; then \\
289-
echo "### Incremental build from \$(cat /sage/VERSION.txt)" && \\
290-
printf '/src/*\n!/src/doc/bootstrap\n!/src/bin\n!/src/*.m4\n!/src/*.toml\n!/src/VERSION.txt\n' >> /sage/.gitignore && \\
291-
printf '/src/*\n!/src/doc/bootstrap\n!/src/bin\n!/src/*.m4\n!/src/*.toml\n!/src/VERSION.txt\n' >> /new/.gitignore && \\
292-
if ! (cd /new && /.ci/retrofit-worktree.sh worktree-image /sage); then \\
293-
echo "retrofit-worktree.sh failed, falling back to replacing /sage"; \\
294-
for a in local logs; do \\
295-
if [ -d /sage/\$a ]; then mv /sage/\$a /new/; fi; \\
296-
done; \\
297-
rm -rf /sage; \\
298-
mv /new /sage; \\
299-
fi; \\
300-
else \\
301-
mv /new /sage; \\
302-
fi
288+
RUN rm -rf /source-tree
289+
$ADD . /source-tree
290+
RUN <<EOT
291+
rm -rf /source-tree/.git
292+
if [ -d /sage ]; then
293+
BASE_VERSION=\$(cat /sage/VERSION.txt)
294+
if (cd /source-tree && .ci/retrofit-worktree.sh worktree-image /sage); then
295+
echo "### Starting incremental build from \$BASE_VERSION"
296+
else
297+
echo "retrofit-worktree.sh failed..."
298+
rm -rf /sage
299+
mv /source-tree /sage
300+
echo "### Starting build from scratch"
301+
fi
302+
else
303+
git config --global user.name "ci-sage workflow"
304+
git config --global user.email "ci-sage@example.com"
305+
(cd /source-tree && git init && git add -A && git commit --quiet --allow-empty -m "new")
306+
mv /source-tree /sage
307+
echo "### Starting build from scratch"
308+
fi
309+
EOT
303310
WORKDIR /sage
304311
ARG BOOTSTRAP="${BOOTSTRAP-./bootstrap}"
305312
$RUN sh -x -c "\${BOOTSTRAP}"$ENDRUN$THEN_SAVE_STATUS
@@ -346,18 +353,7 @@ ENV MAKE="make -j\${NUMPROC}"
346353
ARG USE_MAKEFLAGS="-k V=0"
347354
ENV SAGE_CHECK=warn
348355
ENV SAGE_CHECK_PACKAGES="!cython,!python3,!cysignals,!linbox,!ppl,!cmake,!rpy2,!sage_sws2rst"
349-
$ADD .gitignore /new/.gitignore
350-
$ADD src /new/src
351-
RUN cd /new && rm -rf .git && \\
352-
if /.ci/retrofit-worktree.sh worktree-pre /sage; then \\
353-
cd /sage && touch configure build/make/Makefile; \\
354-
else \\
355-
echo "retrofit-worktree.sh failed, falling back to replacing /sage/src"; \\
356-
rm -rf /sage/src; \\
357-
mv src /sage/src; \\
358-
cd /sage && ./bootstrap && ./config.status; \\
359-
fi; \\
360-
cd /sage && rm -rf .git; rm -rf /new || echo "(error ignored)"
356+
RUN cd /sage && touch configure build/make/Makefile
361357
ARG TARGETS="build"
362358
$RUN$CHECK_STATUS_THEN make SAGE_SPKG="sage-spkg -y -o" \${USE_MAKEFLAGS} \${TARGETS}$ENDRUN$THEN_SAVE_STATUS
363359

.github/workflows/changelog_trigger.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Trigger Changelog Generation
1+
name: Trigger changelog generation
22

33
on:
44
release:

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

Lines changed: 81 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,27 +81,103 @@ jobs:
8181
sage-package metrics :all:
8282
fi
8383
84-
test:
84+
standard:
8585
needs: [changed_files]
8686
uses: ./.github/workflows/docker.yml
8787
with:
88-
# Build incrementally from published Docker image
88+
tox_system_factors: >-
89+
["ubuntu-focal",
90+
"ubuntu-noble",
91+
"debian-bullseye",
92+
"debian-bookworm",
93+
"fedora-30",
94+
"fedora-40",
95+
"archlinux-latest",
96+
"gentoo-python3.11",
97+
"debian-bullseye-i386"]
98+
tox_packages_factors: >-
99+
["standard"]
89100
incremental: true
90101
free_disk_space: true
91102
from_docker_repository: ghcr.io/sagemath/sage/
92103
from_docker_target: "with-targets"
93104
from_docker_tag: "dev"
94105
docker_targets: "with-targets"
95106
targets: "${{needs.changed_files.outputs.build_targets}} ci-build-with-fallback doc-html ptest-nodoc"
107+
docker_push_repository: ghcr.io/${{ github.repository }}/
108+
max_parallel: 8
109+
110+
minimal:
111+
needs: [changed_files]
112+
uses: ./.github/workflows/docker.yml
113+
with:
96114
tox_system_factors: >-
97115
["ubuntu-focal",
98116
"ubuntu-noble",
99117
"debian-bullseye",
100118
"debian-bookworm",
101119
"fedora-30",
102-
"fedora-40",]
120+
"fedora-40",
121+
"archlinux-latest",
122+
"gentoo-python3.11",
123+
"debian-bullseye-i386"]
103124
tox_packages_factors: >-
104-
["standard",
105-
"minimal"]
125+
["minimal"]
126+
incremental: true
127+
free_disk_space: true
128+
from_docker_repository: ghcr.io/sagemath/sage/
129+
from_docker_target: "with-targets"
130+
from_docker_tag: "dev"
131+
docker_targets: "with-targets"
132+
targets: "${{needs.changed_files.outputs.build_targets}} ci-build-with-fallback doc-html ptest-nodoc"
106133
docker_push_repository: ghcr.io/${{ github.repository }}/
107134
max_parallel: 8
135+
136+
standard-constraints_pkgs:
137+
# Turned off until fixed
138+
if: false
139+
needs: [changed_files]
140+
uses: ./.github/workflows/docker.yml
141+
with:
142+
# Build incrementally from published Docker image
143+
incremental: true
144+
free_disk_space: true
145+
from_docker_repository: ghcr.io/sagemath/sage/
146+
from_docker_target: "with-targets-pre"
147+
from_docker_tag: "dev"
148+
docker_targets: "with-targets-pre"
149+
targets_pre: "${{needs.changed_files.outputs.build_targets}} all-sage-local python3-ensure tox-ensure sagelib-tox-sagepython-constraints_pkgs-norequirements"
150+
tox_system_factors: >-
151+
["ubuntu-focal",
152+
"ubuntu-noble",
153+
"debian-bookworm",
154+
"fedora-40",
155+
"debian-bullseye-i386"]
156+
tox_packages_factors: >-
157+
["standard"]
158+
docker_push_repository: ghcr.io/${{ github.repository }}/
159+
max_parallel: 16
160+
161+
standard-sitepackages:
162+
# Turned off until fixed
163+
if: false
164+
needs: [changed_files]
165+
uses: ./.github/workflows/docker.yml
166+
with:
167+
# Build incrementally from published Docker image
168+
incremental: true
169+
free_disk_space: true
170+
from_docker_repository: ghcr.io/sagemath/sage/
171+
from_docker_target: "with-targets"
172+
from_docker_tag: "dev"
173+
docker_targets: "with-targets"
174+
targets: "${{needs.changed_files.outputs.build_targets}} doc-html ptest-nodoc"
175+
# Only test systems with a usable system python (>= 3.9)
176+
# with only a small number of test failures as of 10.2.rc0
177+
tox_system_factors: >-
178+
["gentoo-python3.11",
179+
"archlinux-latest",
180+
"fedora-40"]
181+
tox_packages_factors: >-
182+
["standard-sitepackages"]
183+
docker_push_repository: ghcr.io/${{ github.repository }}/

0 commit comments

Comments
 (0)