Skip to content

Commit 3949cc7

Browse files
author
Matthias Koeppe
committed
build.yml, doc-build.yml: First create CI fixes as an artifact, so gh is not needed in the container
1 parent e4025c1 commit 3949cc7

File tree

3 files changed

+70
-8
lines changed

3 files changed

+70
-8
lines changed

.ci/merge-fixes.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,23 @@ else
1111
export GIT_AUTHOR_EMAIL="[email protected]"
1212
export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
1313
export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
14+
git tag -f test_base
1415
git commit -q -m "Uncommitted changes" --no-allow-empty -a
1516
for a in $PRs; do
1617
echo "::group::Merging PR https://github.com/$REPO/pull/$a"
1718
git tag -f test_head
1819
$GH pr checkout -b pr-$a $a
1920
git fetch --unshallow --all
2021
git checkout -q test_head
21-
if git merge --no-edit -q pr-$a; then
22+
if git merge --no-edit --squash -q pr-$a; then
2223
echo "::endgroup::"
24+
git commit -q -m "Merge https://github.com/$REPO/pull/$a" -a --allow-empty
2325
echo "Merged #$a"
2426
else
2527
echo "::endgroup::"
2628
echo "Failure merging #$a, resetting"
2729
git reset --hard
2830
fi
2931
done
30-
git log test_head..HEAD
32+
git log test_base..HEAD
3133
fi

.github/workflows/build.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,34 @@ concurrency:
2424
cancel-in-progress: true
2525

2626
jobs:
27-
build:
27+
get_ci_fixes:
2828
runs-on: ubuntu-latest
29-
container: ghcr.io/sagemath/sage/sage-${{ github.event.inputs.platform || 'ubuntu-focal-standard' }}-with-targets:${{ github.event.inputs.docker_tag || 'dev'}}
3029
steps:
3130
- name: Checkout
3231
id: checkout
3332
uses: actions/checkout@v4
34-
3533
- name: Merge CI fixes from sagemath/sage
3634
run: |
3735
.ci/merge-fixes.sh
3836
env:
3937
GH_TOKEN: ${{ github.token }}
38+
- name: Store CI fixes in upstream artifact
39+
run: |
40+
mkdir -p upstream
41+
git format-patch --stdout test_base > upstream/ci_fixes.patch
42+
- uses: actions/upload-artifact@v2
43+
with:
44+
path: upstream
45+
name: upstream
46+
47+
build:
48+
runs-on: ubuntu-latest
49+
container: ghcr.io/sagemath/sage/sage-${{ github.event.inputs.platform || 'ubuntu-focal-standard' }}-with-targets:${{ github.event.inputs.docker_tag || 'dev'}}
50+
needs: [get_ci_fixes]
51+
steps:
52+
- name: Checkout
53+
id: checkout
54+
uses: actions/checkout@v4
4055

4156
- name: Update system packages
4257
id: prepare
@@ -74,6 +89,21 @@ jobs:
7489
if [ ! -f worktree-image/.gitignore ]; then cp .gitignore worktree-image/; fi
7590
(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)
7691
92+
- name: Download upstream artifact
93+
uses: actions/download-artifact@v3
94+
with:
95+
path: upstream
96+
name: upstream
97+
98+
- name: Apply CI fixes from sagemath/sage
99+
# After applying the fixes, make sure all changes are marked as uncommitted changes.
100+
run: |
101+
if [ -r upstream/ci_fixes.patch ]; then
102+
(cd worktree-image && git commit --quiet -m "current changes" --allow-empty -a && git am) < upstream/ci_fixes.patch
103+
git reset --quiet old
104+
git add -N .
105+
fi
106+
77107
- name: Incremental build, test changed files (sage -t --new)
78108
id: incremental
79109
run: |

.github/workflows/doc-build.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,33 @@ concurrency:
1212
cancel-in-progress: true
1313

1414
jobs:
15-
build-docs:
15+
get_ci_fixes:
1616
runs-on: ubuntu-latest
17-
container: ghcr.io/sagemath/sage/sage-ubuntu-focal-standard-with-targets:dev
1817
steps:
1918
- name: Checkout
19+
id: checkout
2020
uses: actions/checkout@v4
21-
2221
- name: Merge CI fixes from sagemath/sage
2322
run: |
2423
.ci/merge-fixes.sh
2524
env:
2625
GH_TOKEN: ${{ github.token }}
26+
- name: Store CI fixes in upstream artifact
27+
run: |
28+
mkdir -p upstream
29+
git format-patch --stdout test_base > upstream/ci_fixes.patch
30+
- uses: actions/upload-artifact@v2
31+
with:
32+
path: upstream
33+
name: upstream
34+
35+
build-docs:
36+
runs-on: ubuntu-latest
37+
container: ghcr.io/sagemath/sage/sage-ubuntu-focal-standard-with-targets:dev
38+
needs: [get_ci_fixes]
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
2742

2843
- name: Update system packages
2944
run: |
@@ -60,6 +75,21 @@ jobs:
6075
# Keep track of changes to built HTML
6176
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")
6277
78+
- name: Download upstream artifact
79+
uses: actions/download-artifact@v3
80+
with:
81+
path: upstream
82+
name: upstream
83+
84+
- name: Apply CI fixes from sagemath/sage
85+
# After applying the fixes, make sure all changes are marked as uncommitted changes.
86+
run: |
87+
if [ -r upstream/ci_fixes.patch ]; then
88+
(cd worktree-image && git commit -m "current changes" --allow-empty -a && git am) < upstream/ci_fixes.patch
89+
git reset --quiet old
90+
git add -N .
91+
fi
92+
6393
- name: Incremental build
6494
id: incremental
6595
run: |

0 commit comments

Comments
 (0)