Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit eb35c62

Browse files
committedJan 30, 2024
.github/workflows/ci-sage.yml: Update using reusable workflows
1 parent 8371486 commit eb35c62

File tree

1 file changed

+49
-216
lines changed

1 file changed

+49
-216
lines changed
 

‎.github/workflows/ci-sage.yml

+49-216
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Run Sage CI for Linux/Cygwin/macOS
1+
name: Run Sage CI
22

33
## This GitHub Actions workflow provides:
44
##
@@ -34,11 +34,7 @@ name: Run Sage CI for Linux/Cygwin/macOS
3434
## Many copies of the second step are run in parallel for each of the tested
3535
## systems/configurations.
3636

37-
#on: [push, pull_request]
38-
3937
on:
40-
pull_request:
41-
types: [opened, synchronize]
4238
push:
4339
tags:
4440
- '*'
@@ -47,62 +43,18 @@ on:
4743

4844
env:
4945
# Ubuntu packages to install so that the project's "make dist" can succeed
50-
DIST_PREREQ: tar
46+
DIST_PREREQ: tar libgmp-dev libmpfr-dev
5147
# Name of this project in the Sage distribution
52-
SPKG: flint
53-
# Sage distribution packages to build
54-
TARGETS_PRE: build/make/Makefile
55-
TARGETS: SAGE_CHECK=yes flint
56-
TARGETS_OPTIONAL: SAGE_CHECK=warn arb
48+
SPKG: flint
5749
# Standard setting: Test the current beta release of Sage:
58-
SAGE_REPO: sagemath/sage
59-
SAGE_REF: develop
60-
# Temporarily test on the branch from sage ticket https://trac.sagemath.org/ticket/34102
61-
# FLINT 2.9 upgrade ticket; this is a no-op when merged in Sage develop.
62-
SAGE_TRAC_GIT: https://github.com/sagemath/sagetrac-mirror.git
63-
SAGE_TICKET: 34102
64-
#REMOVE_PATCHES: "*"
50+
SAGE_REPO: sagemath/sage
51+
SAGE_REF: develop
52+
REMOVE_PATCHES: "*"
6553

6654
jobs:
6755

68-
ubuntu-gcc:
69-
runs-on: ubuntu-latest
70-
steps:
71-
- uses: actions/checkout@v2
72-
- run: |
73-
sudo apt-get install texinfo
74-
./.build_dependencies
75-
./configure CFLAGS="-Wredundant-decls" --with-mpir=${LOCAL} --with-mpfr=${LOCAL} --prefix=${LOCAL}
76-
$MAKE
77-
ldd libflint.so
78-
$MAKE check
79-
env:
80-
LOCAL: ${{ github.workspace }}/local
81-
LDFLAGS: "-Wl,-rpath,$LOCAL/lib"
82-
MAKE: "make -j"
83-
84-
ubuntu-cmake-gcc:
85-
runs-on: ubuntu-latest
86-
steps:
87-
- uses: actions/checkout@v2
88-
- run: |
89-
sudo apt-get install texinfo
90-
sudo apt-get install cmake
91-
./.build_dependencies
92-
mkdir build
93-
cd build
94-
cmake -G"Unix Makefiles" -DWITH_NTL=no -DBUILD_TESTING=yes -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$LOCAL ..
95-
$MAKE
96-
ldd lib/libflint.so
97-
env:
98-
LOCAL: ${{ github.workspace }}/local
99-
LDFLAGS: "-Wl,-rpath,$LOCAL/lib"
100-
MAKE: "make -j"
101-
10256
dist:
10357
runs-on: ubuntu-latest
104-
needs: [ubuntu-gcc, ubuntu-cmake-gcc]
105-
10658
steps:
10759
- name: Check out ${{ env.SPKG }}
10860
uses: actions/checkout@v2
@@ -114,9 +66,8 @@ jobs:
11466
sudo DEBIAN_FRONTEND=noninteractive apt-get install $DIST_PREREQ
11567
if: env.DIST_PREREQ != ''
11668
- name: Run make dist, prepare upstream artifact
117-
# FLINT's "make dist" is upstream-centric: it hard-codes repo tags; cannot use
11869
run: |
119-
(cd build/pkgs/${{ env.SPKG }}/src && ./configure && git archive --format tar --prefix flint-git/ HEAD | gzip > ${{ env.SPKG }}-git.tar.gz ) \
70+
(cd build/pkgs/${{ env.SPKG }}/src && ./bootstrap.sh && ./configure && make dist) \
12071
&& mkdir -p upstream && cp build/pkgs/${{ env.SPKG }}/src/*.tar.gz upstream/${{ env.SPKG }}-git.tar.gz \
12172
&& echo "sage-package create ${{ env.SPKG }} --version git --tarball ${{ env.SPKG }}-git.tar.gz --type=standard" > upstream/update-pkgs.sh \
12273
&& if [ -n "${{ env.REMOVE_PATCHES }}" ]; then echo "(cd ../build/pkgs/${{ env.SPKG }}/patches && rm -f ${{ env.REMOVE_PATCHES }}; :)" >> upstream/update-pkgs.sh; fi \
@@ -126,172 +77,54 @@ jobs:
12677
path: upstream
12778
name: upstream
12879

129-
cygwin:
130-
uses: sagemath/sagetrac-mirror/.github/workflows/cygwin.yml@u/mkoeppe/ci_cygwin__refactor_using_reusable_workflows
80+
linux:
81+
uses: sagemath/sage/.github/workflows/docker.yml@develop
13182
with:
132-
# FIXME: duplicated from env.TARGETS
133-
targets: SAGE_CHECK=yes flint
134-
prefix: /opt/sage-flint
83+
# Sage distribution packages to build
84+
targets: SAGE_CHECK=no SAGE_CHECK_flint=yes flint
85+
# Standard setting: Test the current beta release of Sage:
13586
sage_repo: sagemath/sage
13687
sage_ref: develop
13788
upstream_artifact: upstream
138-
sage_trac_git: https://github.com/sagemath/sagetrac-mirror.git
139-
sage_trac_ticket: 34102
89+
# Docker targets (stages) to tag
90+
docker_targets: "with-targets"
91+
# We prefix the image name with the SPKG name ("flint_") to avoid the error
92+
# 'Package "sage-docker-..." is already associated with another repository.'
93+
docker_push_repository: ghcr.io/${{ github.repository }}/flint_
14094
needs: [dist]
14195

142-
docker:
143-
runs-on: ubuntu-latest
144-
needs: [dist]
145-
strategy:
146-
fail-fast: false
147-
max-parallel: 32
148-
matrix:
149-
tox_system_factor: [ubuntu-trusty-toolchain-gcc_9, ubuntu-xenial-toolchain-gcc_9, ubuntu-bionic, ubuntu-focal, ubuntu-hirsute, ubuntu-impish, ubuntu-jammy, ubuntu-kinetic, debian-stretch, debian-buster, debian-bullseye, debian-bookworm, debian-sid, linuxmint-19, linuxmint-19.3, linuxmint-20.1, linuxmint-20.2, linuxmint-20.3, linuxmint-21, fedora-26, fedora-27, fedora-28, fedora-29, fedora-30, fedora-31, fedora-32, fedora-33, fedora-34, fedora-35, fedora-36, fedora-37, centos-7-devtoolset-gcc_11, centos-stream-8, gentoo-python3.9, gentoo-python3.10, archlinux-latest, opensuse-15.3, opensuse-tumbleweed, ubuntu-bionic-i386, manylinux-2_24-i686, debian-buster-i386, raspbian-buster-armhf]
150-
tox_packages_factor: [minimal, standard]
151-
env:
152-
TOX_ENV: docker-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }}
153-
LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-tox-docker-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }}
154-
DOCKER_TARGETS: configured with-targets with-targets-optional
155-
steps:
156-
- name: Check out SageMath
157-
uses: actions/checkout@v2
158-
with:
159-
repository: ${{ env.SAGE_REPO }}
160-
ref: ${{ env.SAGE_REF }}
161-
fetch-depth: 2000
162-
if: env.SAGE_REPO != ''
163-
- name: Check out git-trac-command
164-
uses: actions/checkout@v2
165-
with:
166-
repository: sagemath/git-trac-command
167-
path: git-trac-command
168-
if: env.SAGE_TRAC_GIT != ''
169-
- name: Check out SageMath from trac.sagemath.org
170-
shell: bash {0}
171-
run: |
172-
git config --global user.email "ci-sage@example.com"
173-
git config --global user.name "ci-sage workflow"
174-
if [ ! -d .git ]; then git init; fi; git remote add trac ${{ env.SAGE_TRAC_GIT }} && x=1 && while [ $x -le 5 ]; do x=$(( $x + 1 )); sleep $(( $RANDOM % 60 + 1 )); if git-trac-command/git-trac fetch $SAGE_TICKET; then git merge FETCH_HEAD || echo "(ignored)"; exit 0; fi; sleep 40; done; exit 1
175-
if: env.SAGE_TRAC_GIT != ''
176-
- uses: actions/download-artifact@v2
177-
with:
178-
path: upstream
179-
name: upstream
180-
- name: Install test prerequisites
181-
run: |
182-
sudo DEBIAN_FRONTEND=noninteractive apt-get update
183-
sudo DEBIAN_FRONTEND=noninteractive apt-get install tox python3-setuptools
184-
- name: Update Sage packages from upstream artifact
185-
run: |
186-
(export PATH=$(pwd)/build/bin:$PATH; (cd upstream && bash -x update-pkgs.sh) && sed -i.bak '/upstream/d' .dockerignore && echo "/:toolchain:/i ADD upstream upstream" | sed -i.bak -f - build/bin/write-dockerfile.sh && git diff)
187-
- name: Configure and build Sage distribution within a Docker container
188-
run: |
189-
set -o pipefail; EXTRA_DOCKER_BUILD_ARGS="--build-arg USE_MAKEFLAGS=\"-k V=0 SAGE_NUM_THREADS=3\"" tox -e $TOX_ENV -- $TARGETS 2>&1 | sed "/^configure: notice:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: warning:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: error:/s|^|::error file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;"
190-
- name: Copy logs from the Docker image or build container
191-
run: |
192-
mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"
193-
cp -r .tox/$TOX_ENV/Dockerfile .tox/$TOX_ENV/log "artifacts/$LOGS_ARTIFACT_NAME"
194-
if [ -f .tox/$TOX_ENV/Dockertags ]; then CONTAINERS=$(docker create $(tail -1 .tox/$TOX_ENV/Dockertags) /bin/bash || true); fi
195-
if [ -n "$CONTAINERS" ]; then for CONTAINER in $CONTAINERS; do for ARTIFACT in /sage/logs; do docker cp $CONTAINER:$ARTIFACT artifacts/$LOGS_ARTIFACT_NAME && HAVE_LOG=1; done; if [ -n "$HAVE_LOG" ]; then break; fi; done; fi
196-
if: always()
197-
- uses: actions/upload-artifact@v2
198-
with:
199-
path: artifacts
200-
name: ${{ env.LOGS_ARTIFACT_NAME }}
201-
if: always()
202-
- name: Print out logs for immediate inspection
203-
# and markup the output with GitHub Actions logging commands
204-
run: |
205-
.github/workflows/scan-logs.sh "artifacts/$LOGS_ARTIFACT_NAME"
206-
if: always()
207-
- name: Push Docker images
208-
run: |
209-
if [ -f .tox/$TOX_ENV/Dockertags ]; then
210-
TOKEN="${{ secrets.DOCKER_PKG_GITHUB_TOKEN }}"
211-
if [ -z "$TOKEN" ]; then
212-
TOKEN="${{ secrets.GITHUB_TOKEN }}"
213-
fi
214-
echo "$TOKEN" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
215-
for a in $(cat .tox/$TOX_ENV/Dockertags); do
216-
FULL_TAG=docker.pkg.github.com/$(echo ${{ github.repository }}|tr 'A-Z' 'a-z')/$a
217-
docker tag $a $FULL_TAG
218-
echo Pushing $FULL_TAG
219-
docker push $FULL_TAG
220-
done || echo "(Ignoring errors)"
221-
fi
222-
if: always()
223-
22496
macos:
225-
226-
runs-on: macos-latest
227-
strategy:
228-
fail-fast: false
229-
max-parallel: 4
230-
matrix:
231-
os: [ macos-10.15, macos-11.0 ]
232-
tox_system_factor: [homebrew-macos, homebrew-macos-python3_xcode, homebrew-macos-python3_xcode-nokegonly, conda-forge-macos]
233-
tox_packages_factor: [minimal, standard]
234-
xcode_version_factor: [11.7, default, 12.3]
235-
97+
uses: sagemath/sage/.github/workflows/macos.yml@develop
98+
with:
99+
osversion_xcodeversion_toxenv_tuples: >-
100+
[["latest", "", "homebrew-macos-usrlocal-minimal"],
101+
["latest", "", "homebrew-macos-usrlocal-standard"],
102+
["13", "xcode_15.0", "homebrew-macos-usrlocal-standard"]]
103+
targets: SAGE_CHECK=no SAGE_CHECK_flint=yes flint
104+
# Standard setting: Test the current beta release of Sage:
105+
sage_repo: sagemath/sage
106+
sage_ref: develop
107+
upstream_artifact: upstream
236108
needs: [dist]
237109

238-
env:
239-
TOX_ENV: local-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }}
240-
LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-tox-local-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }}-${{ matrix.os }}-xcode_${{ matrix.xcode_version_factor }}
241-
DOCKER_TARGETS: configured with-targets with-targets-optional
242-
243-
steps:
244-
245-
- name: Select Xcode version
246-
run: |
247-
if [ ${{ matrix.xcode_version_factor }} != default ]; then sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode_version_factor }}.app; fi
248-
- name: Check out SageMath
249-
uses: actions/checkout@v2
250-
with:
251-
repository: ${{ env.SAGE_REPO }}
252-
ref: ${{ env.SAGE_REF }}
253-
fetch-depth: 2000
254-
if: env.SAGE_REPO != ''
255-
- name: Check out git-trac-command
256-
uses: actions/checkout@v2
257-
with:
258-
repository: sagemath/git-trac-command
259-
path: git-trac-command
260-
if: env.SAGE_TRAC_GIT != ''
261-
- name: Check out SageMath from trac.sagemath.org
262-
shell: bash {0}
263-
run: |
264-
git config --global user.email "ci-sage@example.com"
265-
git config --global user.name "ci-sage workflow"
266-
if [ ! -d .git ]; then git init; fi; git remote add trac ${{ env.SAGE_TRAC_GIT }} && x=1 && while [ $x -le 5 ]; do x=$(( $x + 1 )); sleep $(( $RANDOM % 60 + 1 )); if git-trac-command/git-trac fetch $SAGE_TICKET; then git merge FETCH_HEAD || echo "(ignored)"; exit 0; fi; sleep 40; done; exit 1
267-
if: env.SAGE_TRAC_GIT != ''
268-
- uses: actions/download-artifact@v2
269-
with:
270-
path: upstream
271-
name: upstream
272-
- name: Update Sage packages from upstream artifact
273-
run: |
274-
(export PATH=$(pwd)/build/bin:$PATH; (cd upstream && bash -x update-pkgs.sh) && git diff)
275-
276-
- name: Install test prerequisites
277-
run: |
278-
brew install tox
279-
- name: Build and test with tox
280-
# We use a high parallelization on purpose in order to catch possible parallelization bugs in the build scripts.
281-
# For doctesting, we use a lower parallelization to avoid timeouts.
282-
run: |
283-
MAKE="make -j12" tox -e $TOX_ENV -- SAGE_NUM_THREADS=4 $TARGETS
284-
- name: Prepare logs artifact
285-
run: |
286-
mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; cp -r .tox/*/log "artifacts/$LOGS_ARTIFACT_NAME"
287-
if: always()
288-
- uses: actions/upload-artifact@v1
289-
with:
290-
path: artifacts
291-
name: ${{ env.LOGS_ARTIFACT_NAME }}
292-
if: always()
293-
- name: Print out logs for immediate inspection
294-
# and markup the output with GitHub Actions logging commands
295-
run: |
296-
.github/workflows/scan-logs.sh "artifacts/$LOGS_ARTIFACT_NAME"
297-
if: always()
110+
sage:
111+
uses: sagemath/sage/.github/workflows/docker.yml@develop
112+
with:
113+
# Standard setting: Test the current beta release of Sage:
114+
sage_repo: sagemath/sage
115+
sage_ref: develop
116+
upstream_artifact: upstream
117+
# Build incrementally from published Docker image
118+
incremental: true
119+
free_disk_space: true
120+
from_docker_repository: ghcr.io/sagemath/sage/
121+
from_docker_target: "with-targets"
122+
from_docker_tag: "dev"
123+
docker_targets: "with-targets"
124+
targets: "build ptest-nodoc"
125+
tox_system_factors: >-
126+
["debian-bookworm"]
127+
tox_packages_factors: >-
128+
["standard"]
129+
docker_push_repository: ghcr.io/${{ github.repository }}/flint_
130+
needs: [dist]

0 commit comments

Comments
 (0)
Please sign in to comment.