Skip to content

Commit bdef1e2

Browse files
committed
ci-sage.yml: New
1 parent a9b46b6 commit bdef1e2

File tree

1 file changed

+147
-0
lines changed

1 file changed

+147
-0
lines changed

.github/workflows/ci-sage.yml

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
name: Run Sage CI
2+
3+
## This GitHub Actions workflow provides:
4+
##
5+
## - portability testing, by building and testing this project on many platforms
6+
## (Linux variants and macOS), each with two configurations (installed packages),
7+
##
8+
## - continuous integration, by building and testing other software
9+
## that depends on this project.
10+
##
11+
## It runs on every pull request and push of a tag to the GitHub repository.
12+
##
13+
## The testing can be monitored in the "Actions" tab of the GitHub repository.
14+
##
15+
## After all jobs have finished (or are canceled) and a short delay,
16+
## tar files of all logs are made available as "build artifacts".
17+
##
18+
## This GitHub Actions workflow uses the portability testing framework
19+
## of SageMath (https://www.sagemath.org/). For more information, see
20+
## https://doc.sagemath.org/html/en/developer/portability_testing.html
21+
22+
## The workflow consists of two jobs:
23+
##
24+
## - First, it builds a source distribution of the project
25+
## and generates a script "update-pkgs.sh". It uploads them
26+
## as a build artifact named upstream.
27+
##
28+
## - Second, it checks out a copy of the SageMath source tree.
29+
## It downloads the upstream artifact and replaces the project's
30+
## package in the SageMath distribution by the newly packaged one
31+
## from the upstream artifact, by running the script "update-pkgs.sh".
32+
## Then it builds a small portion of the Sage distribution.
33+
##
34+
## Many copies of the second step are run in parallel for each of the tested
35+
## systems/configurations.
36+
37+
#on: [push, pull_request]
38+
39+
on:
40+
pull_request:
41+
types: [opened, synchronize]
42+
push:
43+
branches:
44+
- master
45+
tags:
46+
- '*'
47+
workflow_dispatch:
48+
# Allow to run manually
49+
50+
concurrency:
51+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
52+
cancel-in-progress: true
53+
54+
env:
55+
# Ubuntu packages to install so that the project's "make dist" can succeed
56+
DIST_PREREQ: autoconf automake libtool
57+
# Name of this project in the Sage distribution
58+
SPKG: macaulay2
59+
REMOVE_PATCHES: "*"
60+
61+
jobs:
62+
63+
dist:
64+
runs-on: ubuntu-latest
65+
steps:
66+
- name: Check out ${{ env.SPKG }}
67+
uses: actions/checkout@v4
68+
with:
69+
path: build/pkgs/${{ env.SPKG }}/src
70+
- name: Install prerequisites
71+
run: |
72+
sudo DEBIAN_FRONTEND=noninteractive apt-get update
73+
sudo DEBIAN_FRONTEND=noninteractive apt-get install $DIST_PREREQ
74+
75+
# From test_build.yml
76+
77+
- name: Install requirements for Linux
78+
if: runner.os == 'Linux'
79+
run: |
80+
sudo add-apt-repository -y -n ppa:macaulay2/macaulay2
81+
sudo apt-get update
82+
sudo apt-get install -y -q --no-install-recommends clang-16 gfortran libtool-bin ninja-build yasm ccache
83+
sudo apt-get install -y -q --no-install-recommends liblzma-dev libboost-stacktrace-dev \
84+
libncurses-dev libncurses5-dev libreadline-dev libeigen3-dev libopenblas-dev libxml2-dev \
85+
libgc-dev libgdbm-dev libglpk-dev libgmp3-dev libgtest-dev libmpfr-dev libmpfi-dev libntl-dev gfan \
86+
libgivaro-dev libboost-regex-dev fflas-ffpack libflint-dev libmps-dev libfrobby-dev \
87+
libsingular-dev singular-data libcdd-dev cohomcalg topcom 4ti2 libnormaliz-dev normaliz coinor-csdp \
88+
libnauty-dev nauty lrslib polymake pipx phcpack w3c-markup-validator libtbb-dev qepcad libomp-16-dev msolve
89+
90+
91+
- name: Run make dist, prepare upstream artifact
92+
run: |
93+
(cd build/pkgs/${{ env.SPKG }}/src && cd M2 && ./autogen.sh && ./configure && make dist) \
94+
&& mkdir -p upstream && cp build/pkgs/${{ env.SPKG }}/src/M2/*.tar.gz upstream/${{ env.SPKG }}-git.tar.gz \
95+
&& echo "sage-package create ${{ env.SPKG }} --version git --tarball ${{ env.SPKG }}-git.tar.gz --type=optional" > upstream/update-pkgs.sh \
96+
&& if [ -n "${{ env.REMOVE_PATCHES }}" ]; then echo "(cd ../build/pkgs/${{ env.SPKG }}/patches && rm -f ${{ env.REMOVE_PATCHES }}; :)" >> upstream/update-pkgs.sh; fi \
97+
&& ls -l upstream/
98+
- uses: actions/upload-artifact@v4
99+
with:
100+
path: upstream
101+
name: upstream
102+
103+
linux:
104+
uses: passagemath/passagemath/.github/workflows/docker.yml@main
105+
with:
106+
targets: SAGE_CHECK=no SAGE_CHECK_PACKAGES="macaulay2" macaulay2
107+
# Standard setting: Test the current HEAD of passagemath:
108+
sage_repo: passagemath/passagemath
109+
sage_ref: main
110+
upstream_artifact: upstream
111+
# We prefix the image name with the SPKG name ("macaulay2-") to avoid the error
112+
# 'Package "sage-docker-..." is already associated with another repository.'
113+
docker_push_repository: ghcr.io/${{ github.repository }}/macaulay2-
114+
needs: [dist]
115+
116+
macos:
117+
uses: passagemath/passagemath/.github/workflows/macos.yml@main
118+
with:
119+
targets: SAGE_CHECK=no SAGE_CHECK_PACKAGES="macaulay2" macaulay2
120+
# Standard setting: Test the current HEAD of passagemath:
121+
sage_repo: passagemath/passagemath
122+
sage_ref: main
123+
upstream_artifact: upstream
124+
needs: [dist]
125+
126+
passagemath-macaulay2:
127+
uses: passagemath/passagemath/.github/workflows/docker.yml@main
128+
with:
129+
targets: SAGE_CHECK=no SAGE_CHECK_PACKAGES="sagemath_macaulay2" sagemath_macaulay2
130+
# Standard setting: Test the current HEAD of passagemath:
131+
sage_repo: passagemath/passagemath
132+
sage_ref: main
133+
upstream_artifact: upstream
134+
# Build incrementally from published Docker image
135+
incremental: true
136+
free_disk_space: true
137+
from_docker_repository: ghcr.io/passagemath/passagemath/
138+
from_docker_target: "with-targets"
139+
from_docker_tag: "dev"
140+
docker_targets: "with-targets"
141+
tox_system_factors: >-
142+
["ubuntu-jammy"]
143+
tox_packages_factors: >-
144+
["standard"]
145+
# avoid clash with linux job for the same platform
146+
logs_artifact: false
147+
needs: [dist]

0 commit comments

Comments
 (0)