Skip to content

Commit c28eb0e

Browse files
author
Matthias Koeppe
committed
Merge branch 'merge_ci_linux' into openssl-3.2.1
2 parents 35587cb + 5726013 commit c28eb0e

File tree

6 files changed

+92
-37
lines changed

6 files changed

+92
-37
lines changed

.ci/retrofit-worktree.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ set -x
2323
# If actions/checkout downloaded our source tree using the GitHub REST API
2424
# instead of with git (because do not have git installed in our image),
2525
# we first make the source tree a repo.
26-
if [ ! -d .git ]; then git init && git add -A && git commit --quiet -m "new"; fi
26+
if [ ! -d .git ]; then git init; fi
2727

28-
# Tag this state of the source tree "new". This is what we want to build and test.
28+
# Commit and tag this state of the source tree "new". This is what we want to build and test.
29+
git add -A && git commit --quiet --allow-empty -m "new"
2930
git tag -f new
3031

3132
# Our container image contains a source tree in $WORKTREE_DIRECTORY with a full build of Sage.

.ci/write-dockerfile.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ cat <<EOF
264264
265265
FROM with-system-packages as bootstrapped
266266
#:bootstrapping:
267+
RUN rm -rf /new /sage/.git
267268
$ADD Makefile VERSION.txt COPYING.txt condarc.yml README.md bootstrap bootstrap-conda configure.ac sage .homebrew-build-env tox.ini Pipfile.m4 .gitignore /new/
268269
$ADD config/config.rpath /new/config/config.rpath
269270
$ADD src/doc/bootstrap /new/src/doc/bootstrap
@@ -338,7 +339,6 @@ ENV SAGE_CHECK=warn
338339
ENV SAGE_CHECK_PACKAGES="!cython,!r,!python3,!gap,!cysignals,!linbox,!git,!ppl,!cmake,!rpy2,!sage_sws2rst"
339340
$ADD .gitignore /new/.gitignore
340341
$ADD src /new/src
341-
ADD .ci /.ci
342342
RUN cd /new && rm -rf .git && \
343343
if /.ci/retrofit-worktree.sh worktree-pre /sage; then \
344344
cd /sage && touch configure build/make/Makefile; \
@@ -347,7 +347,8 @@ RUN cd /new && rm -rf .git && \
347347
rm -rf /sage/src; \
348348
mv src /sage/src; \
349349
cd /sage && ./bootstrap && ./config.status; \
350-
fi
350+
fi; \
351+
cd /sage && rm -rf /new .git
351352
352353
ARG TARGETS="build"
353354
$RUN $CHECK_STATUS_THEN make SAGE_SPKG="sage-spkg -y -o" \${USE_MAKEFLAGS} \${TARGETS} $ENDRUN $THEN_SAVE_STATUS

.github/workflows/build.yml

Lines changed: 62 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ env:
7878
jobs:
7979
test-new:
8080
runs-on: ubuntu-latest
81+
outputs:
82+
build_targets: ${{ steps.build-targets.outputs.build_targets }}
8183
services:
8284
# https://docs.docker.com/build/ci/github-actions/local-registry/
8385
registry:
@@ -98,6 +100,46 @@ jobs:
98100
- name: Checkout
99101
id: checkout
100102
uses: actions/checkout@v4
103+
- name: Get changed files and packages
104+
id: changed-files
105+
uses: tj-actions/changed-files@v44
106+
with:
107+
# File extensions for doctests per sage.doctest.control.skipfile
108+
files_yaml: |
109+
configures:
110+
- 'build/pkgs/*/spkg-configure.m4'
111+
pkgs:
112+
- 'build/pkgs/**'
113+
- 'pkgs/**'
114+
doctests:
115+
- 'src/**/*.{py,pyx,pxd,pxi,sage,spyx,rst,tex}'
116+
- '!src/{setup,conftest*}.py'
117+
- name: Determine targets to build
118+
id: build-targets
119+
run: |
120+
uninstall_targets=$(echo $(for a in '' ${{ steps.changed-files.outputs.configures_all_changed_files }}; do echo $a | sed -E 's,build/pkgs/([a-z0-9][_.a-z0-9]*)/spkg-configure[.]m4 *,\1-uninstall,'; done | sort -u))
121+
build_targets=$(echo $(for a in '' ${{ steps.changed-files.outputs.pkgs_all_changed_files }}; do SPKG=$(echo $a | sed -E 's,-,_,g;s,(build/)?pkgs/([a-z0-9][-_.a-z0-9]*)/[^ ]* *,\2,;'); if [ -f "build/pkgs/$SPKG/checksums.ini" -o -f "build/pkgs/$SPKG/requirements.txt" -o -f "build/pkgs/$SPKG/spkg-install" ]; then echo "$SPKG-ensure"; fi; done | sort -u))
122+
if [ -n "$uninstall_targets" ]; then
123+
echo "build_targets=$uninstall_targets reconfigure $build_targets ci-build-with-fallback" >> $GITHUB_OUTPUT
124+
else
125+
echo "build_targets=$build_targets ci-build-with-fallback" >> $GITHUB_OUTPUT
126+
fi
127+
cat $GITHUB_OUTPUT
128+
- uses: actions/checkout@v4
129+
with:
130+
ref: ${{ github.base_ref }}
131+
path: worktree-base
132+
if: github.base_ref && steps.changed-files.outputs.pkgs_all_changed_files
133+
- name: Compute metrics
134+
run: |
135+
export PATH=build/bin:$PATH
136+
if [ -d worktree-base ]; then
137+
(echo "# $GITHUB_BASE_REF"; SAGE_ROOT=worktree-base sage-package metrics :all:) > base-metrics.txt
138+
(echo "# $GITHUB_REF"; sage-package metrics :all:) > metrics.txt
139+
diff --color=always --width=100 --side-by-side --left-column base-metrics.txt metrics.txt || true
140+
else
141+
sage-package metrics :all:
142+
fi
101143
- name: Install test prerequisites
102144
# From docker.yml
103145
run: |
@@ -142,7 +184,7 @@ jobs:
142184
# more reliable than "load", for which we observed random failure
143185
# conditions in which the built image could not be found.
144186
#
145-
push: true
187+
push: ${{ steps.changed-files.outputs.doctests_all_changed_files && true || false }}
146188
load: false
147189
context: .
148190
tags: ${{ env.BUILD_IMAGE }}
@@ -153,9 +195,12 @@ jobs:
153195
NUMPROC=6
154196
USE_MAKEFLAGS=-k V=0 SAGE_NUM_THREADS=4 --output-sync=recurse
155197
TARGETS_PRE=build/make/Makefile
156-
TARGETS=ci-build-with-fallback
198+
TARGETS=${{ steps.build-targets.outputs.build_targets }}
157199
158200
- name: Start container
201+
id: container
202+
# Try to continue when "exporting to GitHub Actions Cache" failed with timeout
203+
if: (success() || failure()) && steps.changed-files.outputs.doctests_all_changed_files
159204
run: |
160205
docker run --name BUILD -dit \
161206
--mount type=bind,src=$(pwd),dst=$(pwd) \
@@ -165,6 +210,7 @@ jobs:
165210
# Testing
166211

167212
- name: Check that all modules can be imported
213+
if: (success() || failure()) && steps.container.outcome == 'success' && steps.changed-files.outputs.doctests_all_changed_files
168214
run: |
169215
# Increase the length of the lines in the "short summary"
170216
export COLUMNS=120
@@ -175,20 +221,12 @@ jobs:
175221
./sage -python -m pytest -c tox.ini -qq --doctest --collect-only || true
176222
shell: sh .ci/docker-exec-script.sh BUILD /sage {0}
177223

178-
- name: Get changed files
179-
id: changed-files
180-
uses: tj-actions/changed-files@v44
181-
with:
182-
# File extensions per sage.doctest.control.skipfile
183-
files: src/**/*.{py,pyx,pxd,pxi,sage,spyx,rst,tex}
184-
files_ignore: src/{setup,conftest*}.py
185-
186224
- name: Test changed files (sage -t --new)
187-
if: steps.changed-files.outputs.all_changed_files
225+
if: (success() || failure()) && steps.container.outcome == 'success' && steps.changed-files.outputs.doctests_all_changed_files
188226
run: |
189227
export MAKE="make -j2 --output-sync=recurse" SAGE_NUM_THREADS=4
190228
# https://github.com/tj-actions/changed-files?tab=readme-ov-file#outputs-
191-
./sage -t --long --format github -p4 ${{ steps.changed-files.outputs.all_changed_files }}
229+
./sage -t --long --format github -p4 ${{ steps.changed-files.outputs.doctests_all_changed_files }}
192230
shell: sh .ci/docker-exec-script.sh BUILD /sage {0}
193231

194232
test-mod:
@@ -266,9 +304,11 @@ jobs:
266304
NUMPROC=6
267305
USE_MAKEFLAGS=-k V=0 SAGE_NUM_THREADS=4 --output-sync=recurse
268306
TARGETS_PRE=build/make/Makefile
269-
TARGETS=ci-build-with-fallback
307+
TARGETS=${{ needs.test-new.outputs.build_targets }}
270308
271309
- name: Start container
310+
id: container
311+
if: (success() || failure())
272312
run: |
273313
docker run --name BUILD -dit \
274314
--mount type=bind,src=$(pwd),dst=$(pwd) \
@@ -278,6 +318,7 @@ jobs:
278318
# Testing
279319

280320
- name: Test modularized distributions
321+
if: (success() || failure()) && steps.container.outcome == 'success'
281322
run: |
282323
export MAKE="make -j2 --output-sync=recurse" SAGE_NUM_THREADS=4
283324
make V=0 tox-ensure && make ${{ matrix.targets }}
@@ -361,10 +402,11 @@ jobs:
361402
NUMPROC=6
362403
USE_MAKEFLAGS=-k V=0 SAGE_NUM_THREADS=4 --output-sync=recurse
363404
TARGETS_PRE=build/make/Makefile
364-
TARGETS=ci-build-with-fallback
405+
TARGETS=${{ needs.test-new.outputs.build_targets }}
365406
366407
- name: Start container
367408
id: container
409+
if: (success() || failure())
368410
run: |
369411
docker run --name BUILD -dit \
370412
--mount type=bind,src=$(pwd),dst=$(pwd) \
@@ -374,6 +416,7 @@ jobs:
374416
# Testing
375417

376418
- name: Test all files (sage -t --long ${{ matrix.tests }})
419+
if: (success() || failure()) && steps.container.outcome == 'success'
377420
run: |
378421
mkdir .coverage
379422
rm -rf /sage/.coverage
@@ -473,10 +516,11 @@ jobs:
473516
NUMPROC=6
474517
USE_MAKEFLAGS=-k V=0 SAGE_NUM_THREADS=4 --output-sync=recurse
475518
TARGETS_PRE=build/make/Makefile
476-
TARGETS=ci-build-with-fallback
519+
TARGETS=${{ needs.test-new.outputs.build_targets }}
477520
478521
- name: Start container
479522
id: container
523+
if: (success() || failure())
480524
run: |
481525
docker run --name BUILD -dit \
482526
--mount type=bind,src=$(pwd),dst=$(pwd) \
@@ -490,8 +534,10 @@ jobs:
490534
with:
491535
path: .coverage
492536
pattern: coverage-*
537+
if: (success() || failure()) && steps.container.outcome == 'success'
493538

494539
- name: Coverage report
540+
if: (success() || failure()) && steps.container.outcome == 'success'
495541
# Using --omit to avoid "CoverageWarning: Couldn't parse '/tmp/tmp06qizzie/tmp_ldpu46ob.py': No source for code"
496542
run: |
497543
rm -rf /sage/.coverage
@@ -505,6 +551,7 @@ jobs:
505551
shell: sh .ci/docker-exec-script.sh BUILD . {0}
506552

507553
- name: Upload coverage to codecov
554+
if: (success() || failure()) && steps.container.outcome == 'success'
508555
uses: codecov/codecov-action@v4
509556
with:
510557
directory: .coverage/coverage-report

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

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@ jobs:
4141
runs-on: ubuntu-latest
4242
name: List changed packages
4343
outputs:
44-
uninstall_targets: ${{ steps.build-targets.outputs.uninstall_targets }}
4544
build_targets: ${{ steps.build-targets.outputs.build_targets }}
4645
steps:
4746
- uses: actions/checkout@v4
4847
- name: Get all packages that have changed
49-
id: changed-packages
48+
id: changed-files
5049
uses: tj-actions/changed-files@v44
5150
with:
5251
files_yaml: |
@@ -58,14 +57,19 @@ jobs:
5857
- name: Determine targets to build
5958
id: build-targets
6059
run: |
61-
echo "uninstall_targets=$(echo $(for a in '' ${{ steps.changed-packages.outputs.configures_all_changed_files }}; do echo $a | sed -E 's,build/pkgs/([a-z0-9][_.a-z0-9]*)/spkg-configure[.]m4 *,\1-uninstall,'; done | sort -u))" >> $GITHUB_OUTPUT
62-
echo "build_targets=$(echo $(for a in '' ${{ steps.changed-packages.outputs.pkgs_all_changed_files }}; do SPKG=$(echo $a | sed -E 's,-,_,g;s,(build/)?pkgs/([a-z0-9][-_.a-z0-9]*)/[^ ]* *,\2,;'); if [ -f "build/pkgs/$SPKG/checksums.ini" -o -f "build/pkgs/$SPKG/requirements.txt" -o -f "build/pkgs/$SPKG/spkg-install" ]; then echo "$SPKG-ensure"; fi; done | sort -u))" >> $GITHUB_OUTPUT
60+
uninstall_targets=$(echo $(for a in '' ${{ steps.changed-files.outputs.configures_all_changed_files }}; do echo $a | sed -E 's,build/pkgs/([a-z0-9][_.a-z0-9]*)/spkg-configure[.]m4 *,\1-uninstall,'; done | sort -u))
61+
build_targets=$(echo $(for a in '' ${{ steps.changed-files.outputs.pkgs_all_changed_files }}; do SPKG=$(echo $a | sed -E 's,-,_,g;s,(build/)?pkgs/([a-z0-9][-_.a-z0-9]*)/[^ ]* *,\2,;'); if [ -f "build/pkgs/$SPKG/checksums.ini" -o -f "build/pkgs/$SPKG/requirements.txt" -o -f "build/pkgs/$SPKG/spkg-install" ]; then echo "$SPKG-ensure"; fi; done | sort -u))
62+
if [ -n "$uninstall_targets" ]; then
63+
echo "build_targets=$uninstall_targets reconfigure $build_targets ci-build-with-fallback" >> $GITHUB_OUTPUT
64+
else
65+
echo "build_targets=$build_targets ci-build-with-fallback" >> $GITHUB_OUTPUT
66+
fi
6367
cat $GITHUB_OUTPUT
6468
- uses: actions/checkout@v4
6569
with:
6670
ref: ${{ github.base_ref }}
6771
path: worktree-base
68-
if: github.base_ref
72+
if: github.base_ref && steps.changed-files.outputs.pkgs_all_changed_files
6973
- name: Compute metrics
7074
run: |
7175
export PATH=build/bin:$PATH
@@ -88,15 +92,14 @@ jobs:
8892
from_docker_target: "with-targets"
8993
from_docker_tag: "dev"
9094
docker_targets: "with-targets"
91-
targets: "${{needs.changed_files.outputs.uninstall_targets}} reconfigure ${{needs.changed_files.outputs.build_targets}} build doc-html ptest"
95+
targets: "${{needs.changed_files.outputs.build_targets}} doc-html ptest-nodoc"
9296
tox_system_factors: >-
9397
["ubuntu-focal",
94-
"ubuntu-jammy",
95-
"ubuntu-mantic",
98+
"ubuntu-noble",
9699
"debian-bullseye",
97100
"debian-bookworm",
98101
"fedora-30",
99-
"fedora-38",
102+
"fedora-40",
100103
"gentoo-python3.11",
101104
"debian-bullseye-i386"]
102105
tox_packages_factors: >-
@@ -107,14 +110,6 @@ jobs:
107110

108111
site:
109112
needs: [changed_files]
110-
if: |
111-
github.event_name != 'pull_request' ||
112-
((github.event.action != 'labeled' &&
113-
(contains(github.event.pull_request.labels.*.name, 'c: packages: standard') ||
114-
contains(github.event.pull_request.labels.*.name, 'c: packages: optional'))) ||
115-
(github.event.action == 'labeled' &&
116-
(github.event.label.name == 'c: packages: optional' ||
117-
github.event.label.name == 'c: packages: standard')))
118113
uses: ./.github/workflows/docker.yml
119114
with:
120115
# Build incrementally from published Docker image
@@ -124,7 +119,7 @@ jobs:
124119
from_docker_target: "with-targets"
125120
from_docker_tag: "dev"
126121
docker_targets: "with-targets"
127-
targets: "${{needs.changed_files.outputs.uninstall_targets}} reconfigure ${{needs.changed_files.outputs.build_targets}} build doc-html ptest"
122+
targets: "${{needs.changed_files.outputs.build_targets}} doc-html ptest-nodoc"
128123
# Only test systems with a usable system python (>= 3.9)
129124
# with only a small number of test failures as of 10.2.rc0
130125
tox_system_factors: >-

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ jobs:
101101
TARGETS=ci-build-with-fallback
102102
103103
- name: Start container
104+
id: container
105+
# Try to continue when "exporting to GitHub Actions Cache" failed with timeout
106+
if: (success() || failure())
104107
run: |
105108
docker run --name BUILD -dit \
106109
--mount type=bind,src=$(pwd),dst=$(pwd) \
@@ -110,6 +113,8 @@ jobs:
110113
# Docs
111114

112115
- name: Update system packages
116+
id: packages
117+
if: (success() || failure()) && steps.container.outcome == 'success'
113118
run: |
114119
export PATH="build/bin:$PATH"
115120
eval $(sage-print-system-package-command auto update)
@@ -119,6 +124,7 @@ jobs:
119124

120125
- name: Build docs (PDF)
121126
id: docbuild
127+
if: (success() || failure()) && steps.packages.outcome == 'success'
122128
run: |
123129
export MAKE="make -j5 --output-sync=recurse" SAGE_NUM_THREADS=5
124130
make doc-clean doc-uninstall; make sagemath_doc_html-build-deps sagemath_doc_pdf-no-deps

.github/workflows/doc-build.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ jobs:
105105
TARGETS=ci-build-with-fallback
106106
107107
- name: Start container
108+
id: container
109+
# Try to continue when "exporting to GitHub Actions Cache" failed with timeout
110+
if: (success() || failure())
108111
run: |
109112
docker run --name BUILD -dit \
110113
--mount type=bind,src=$(pwd),dst=$(pwd) \
@@ -115,6 +118,7 @@ jobs:
115118

116119
- name: Store old docs
117120
id: worktree
121+
if: (success() || failure()) && steps.container.outcome == 'success'
118122
run: |
119123
git config --global --add safe.directory $(pwd)
120124
git config --global user.email "ci-sage@example.com"
@@ -140,6 +144,7 @@ jobs:
140144
141145
- name: Build docs
142146
id: docbuild
147+
if: (success() || failure()) && steps.worktree.outcome == 'success'
143148
# Always non-incremental because of the concern that
144149
# incremental docbuild may introduce broken links (inter-file references) though build succeeds
145150
run: |

0 commit comments

Comments
 (0)