@@ -32,24 +32,52 @@ jobs:
32
32
id : checkout
33
33
uses : actions/checkout@v3
34
34
35
- - name : Prepare
35
+ - name : Update system packages
36
36
id : prepare
37
37
run : |
38
- # Install test tools.
39
- if apt-get update && apt-get install -y git python3-venv; then
40
- # Debian-specific temporary code:
41
- # Installation of python3-venv can be removed as soon as a
42
- # base image with a release including #33822 is available
43
- :
44
- else
45
- export PATH="build/bin:$PATH"
46
- eval $(sage-print-system-package-command auto update)
47
- eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git)
48
- fi
49
- # Reuse built SAGE_LOCAL contained in the Docker image
38
+ export PATH="build/bin:$PATH"
39
+ eval $(sage-print-system-package-command auto update)
40
+ eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git)
41
+
42
+ - name : Incremental build and test
43
+ if : always() && steps.prepare.outcome == 'success'
44
+ id : incremental
45
+ run : |
46
+ set -ex
47
+ git config --global user.email "[email protected] "
48
+ git config --global user.name "Build & Test workflow"
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 config --global --add safe.directory $(pwd) && 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".
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
+ git worktree add --detach worktree-image
64
+ rm -rf /sage/.git && mv worktree-image/.git /sage/
65
+ rm -rf worktree-image && ln -s /sage worktree-image
66
+ (cd worktree-image && git commit --allow-empty -m "old" -a && git tag -f old && git reset --hard new && git reset old)
67
+ # Now re-bootstrap and build. The build is incremental because we were careful with the timestamps.
68
+ # We run tests with "sage -t --new"; this only tests the uncommitted changes.
69
+ (cd worktree-image && ./bootstrap && make build && ./sage -t --new -p2)
70
+ env :
71
+ MAKE : make -j2
72
+ SAGE_NUM_THREADS : 2
73
+
74
+ - name : Configure new tree
75
+ if : always() && steps.prepare.outcome == 'success'
76
+ run : |
77
+ # Reuse built SAGE_LOCAL contained in the Docker image
50
78
./bootstrap
51
79
./configure --enable-build-as-root --prefix=/sage/local --with-sage-venv --enable-editable --enable-download-from-upstream-url
52
-
80
+
53
81
- name : Build and test modularized distributions
54
82
if : always() && steps.prepare.outcome == 'success'
55
83
run : make V=0 tox && make pypi-wheels
70
98
71
99
- name : Static code check with pyright
72
100
if : always() && steps.prepare.outcome == 'success'
73
- run : pyright
74
-
101
+ run : pyright
102
+
75
103
- name : Build
76
104
id : build
77
105
if : always() && steps.prepare.outcome == 'success'
94
122
if : always() && steps.build.outcome == 'success'
95
123
run : |
96
124
../sage -python -m pip install coverage
97
- ../sage -python -m coverage run ./bin/sage-runtests --all -p2 --random-seed=286735480429121101562228604801325644303
125
+ ../sage -python -m coverage run ./bin/sage-runtests --all --long -p2
98
126
working-directory : ./src
99
127
100
128
- name : Prepare coverage results
@@ -103,7 +131,7 @@ jobs:
103
131
./venv/bin/python3 -m coverage combine src/.coverage/
104
132
./venv/bin/python3 -m coverage xml
105
133
find . -name *coverage*
106
-
134
+
107
135
- name : Upload coverage to codecov
108
136
if : always() && steps.build.outcome == 'success'
109
137
uses : codecov/codecov-action@v3
0 commit comments