-
-
Notifications
You must be signed in to change notification settings - Fork 478
287 lines (260 loc) · 11.1 KB
/
dist.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
name: Prepare source distributions and wheels
on:
push:
tags:
# Match all release tags including beta, rc
- '[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.beta[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+.beta[0-9]+'
- '[0-9]+.[0-9]+.rc[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+.rc[0-9]+'
workflow_dispatch:
# Allow to run manually
jobs:
release_dist:
# This job first checks whether "configure --enable-download-from-upstream-url"
# (the default since #32390) is needed.
#
# In this way, we check that all necessary package tarballs
# have already been uploaded to the Sage server at the time
# of pushing a release tag.
#
# It also uses "bootstrap -D", thus checking that the "configure"
# tarball has been uploaded to the Sage server at the time
# of pushing a release tag.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install bootstrap prerequisites
run: |
sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install $(build/bin/sage-get-system-packages debian _bootstrap)
- name: make dist (--disable-download-from-upstream-url)
id: make_dist
run: |
./bootstrap -D && ./configure --disable-download-from-upstream-url && make dist
env:
MAKE: make -j8
- name: make download (--disable-download-from-upstream-url)
id: make_download
run: |
make -k download DOWNLOAD_PACKAGES=":all: --no-file huge"
env:
MAKE: make -j8
- name: Reconfigure with --enable-download-from-upstream-url
if: (success() || failure()) && (steps.make_dist.outcome != 'success' || steps.make_download.outcome != 'success')
run: |
./configure
- name: make dist (--enable-download-from-upstream-url)
if: (success() || failure()) && steps.make_dist.outcome != 'success'
run: |
make dist
env:
MAKE: make -j8
- name: make download (--enable-download-from-upstream-url)
if: (success() || failure()) && steps.make_download.outcome != 'success'
run: |
make -k download DOWNLOAD_PACKAGES=":all: --no-file huge --allow-upstream"
env:
MAKE: make -j8
- name: Remove what cannot be distributed
if: success() || failure()
run: |
rm -f upstream/*do-not-distribute*
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
path: |
dist/*.tar.gz
upstream
name: release_dist
release:
needs: release_dist
runs-on: ubuntu-latest
if: (success() || failure()) && github.repository == 'sagemath/sage' && startsWith(github.ref, 'refs/tags/') && !contains(github.ref, 'beta') && !contains(github.ref, 'rc')
steps:
- uses: actions/download-artifact@v4
with:
name: release_dist
- uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
dist/*
upstream/*
permissions:
contents: write
sdists_for_pypi:
runs-on: ubuntu-latest
env:
CAN_DEPLOY: ${{ secrets.SAGEMATH_PYPI_API_TOKEN != '' }}
steps:
- uses: actions/checkout@v4
- name: Install bootstrap prerequisites
run: |
sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install $(build/bin/sage-get-system-packages debian _bootstrap)
- name: make pypi-sdists
run: |
./bootstrap
./configure
make pypi-sdists V=0
(mkdir dist && mv upstream/sage*.tar.gz dist/)
ls -l dist
- uses: actions/upload-artifact@v4
with:
path: "dist/*.tar.gz"
name: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.SAGEMATH_PYPI_API_TOKEN }}
skip-existing: true
verbose: true
if: env.CAN_DEPLOY == 'true'
noarch_wheels_for_pypi:
runs-on: ubuntu-latest
env:
CAN_DEPLOY: ${{ secrets.SAGEMATH_PYPI_API_TOKEN != '' }}
steps:
- uses: actions/checkout@v4
- name: Install bootstrap prerequisites
run: |
sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install $(build/bin/sage-get-system-packages debian _bootstrap)
- name: make pypi-noarch-wheels
run: |
./bootstrap
./configure
make pypi-noarch-wheels V=0
(mkdir dist && mv venv/var/lib/sage/wheels/sage*-none-any.whl dist/)
ls -l dist
- uses: actions/upload-artifact@v4
with:
path: "dist/*.whl"
name: noarch-wheels
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.SAGEMATH_PYPI_API_TOKEN }}
skip-existing: true
verbose: true
if: env.CAN_DEPLOY == 'true'
build_wheels:
name: wheels ${{ matrix.build }}*_${{ matrix.arch }}
runs-on: ${{ matrix.os }}
needs: sdists_for_pypi
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
arch: [x86_64, i686, aarch64]
build: [manylinux, musllinux]
include:
- os: macos-13
arch: x86_64
build: macosx
- os: macos-14
arch: arm64
build: macosx
env:
CAN_DEPLOY: ${{ secrets.SAGEMATH_PYPI_API_TOKEN != '' }}
# SPKGs to install as system packages
SPKGS: _bootstrap _prereq
# Non-Python packages to install as spkgs
TARGETS_PRE: gmp mpfr mpc bliss coxeter3 mcqd meataxe sirocco boost_cropped tdlib
CIBW_BUILD: "*${{ matrix.build }}*"
# Disable building PyPy wheels on all platforms
CIBW_SKIP: "pp*"
#
CIBW_ARCHS: ${{ matrix.arch }}
# https://cibuildwheel.readthedocs.io/en/stable/options/#requires-python
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9, <3.13"
# Environment during wheel build
CIBW_ENVIRONMENT: "PATH=$(pwd)/prefix/bin:$PATH CPATH=$(pwd)/prefix/include:$CPATH LIBRARY_PATH=$(pwd)/prefix/lib:$LIBRARY_PATH LD_LIBRARY_PATH=$(pwd)/prefix/lib:$LD_LIBRARY_PATH PKG_CONFIG_PATH=$(pwd)/prefix/share/pkgconfig:$PKG_CONFIG_PATH ACLOCAL_PATH=/usr/share/aclocal PIP_CONSTRAINT=$(pwd)/constraints.txt PIP_FIND_LINKS=file://$(pwd)/wheelhouse SAGE_NUM_THREADS=6"
# Use 'build', not 'pip wheel'
CIBW_BUILD_FRONTEND: build
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
if: runner.os == 'Linux' && matrix.arch != 'x86_64' && matrix.arch != 'i686'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
- uses: actions/setup-python@v5
# As of 2024-02-03, the macOS M1 runners do not have preinstalled python or pipx.
# Installing pipx follows the approach of https://github.com/pypa/cibuildwheel/pull/1743
id: python
with:
python-version: "3.8 - 3.12"
update-environment: false
- name: Bootstrap
run: |
export PATH=$(pwd)/build/bin:$PATH
eval $(sage-print-system-package-command auto --sudo --yes --no-install-recommends --spkg install _bootstrap)
./bootstrap
- name: Unpack and prepare
# We build the wheels from the sdists so that MANIFEST filtering becomes effective.
# But we must run cibuildwheel with the unpacked source directory, not a tarball,
# so that SAGE_ROOT is copied into the build containers.
#
# In the CIBW_BEFORE_ALL phase, we install libraries using the Sage distribution.
# https://cibuildwheel.readthedocs.io/en/stable/options/#before-all
# For Linux, this is repeated for each of the packages that we build wheels for
# because CIBW starts with a fresh container on each invocation.
# Therefore we cache it in a directory mounted from the host: /host
# https://cibuildwheel.pypa.io/en/stable/faq/#linux-builds-in-containers
#
# omit sagemath-{meataxe,sirocco} for now -- needs sagemath-modules
run: |
"${{ steps.python.outputs.python-path }}" -m pip install cibuildwheel==2.18.0
export PATH=build/bin:$PATH
echo CIBW_BEFORE_ALL="( $(sage-print-system-package-command debian --yes --no-install-recommends install $(sage-get-system-packages debian $SPKGS)) || $(sage-print-system-package-command fedora --yes --no-install-recommends install $(sage-get-system-packages fedora $SPKGS | sed s/pkg-config/pkgconfig/)) || ( $(sage-print-system-package-command homebrew --yes --no-install-recommends install $(sage-get-system-packages homebrew $SPKGS)) || $(sage-print-system-package-command alpine --yes --no-install-recommends install $(sage-get-system-packages alpine $SPKGS)) || echo error ignored) ) && if cp /host/sage-\$AUDITWHEEL_PLAT/config.status . 2>/dev/null; then chmod +x config.status; fi && if [ -x ./config.status ]; then ./config.status; else ./configure --enable-build-as-root ${{ startsWith(matrix.os, 'ubuntu') && '--prefix=/host/sage-\$AUDITWHEEL_PLAT' || '' }} && cp config.status prefix/; fi && MAKE=\"make -j6\" make V=0 $TARGETS_PRE && (echo \"sage_conf @ file://\$(pwd)/pkgs/sage-conf\" && echo \"sage_setup @ file://\$(pwd)/pkgs/sage-setup\") > constraints.txt" >> "$GITHUB_ENV"
mkdir -p unpacked
for sdist in dist/$pkg*.tar.gz; do
(cd unpacked && tar xfz - ) < $sdist
done
- name: sagemath-objects
run: |
"${{ steps.python.outputs.python-path }}" -m cibuildwheel unpacked/sagemath*objects*
- name: sagemath-categories
run: |
"${{ steps.python.outputs.python-path }}" -m cibuildwheel unpacked/sagemath*categories*
- name: sagemath-bliss
run: |
"${{ steps.python.outputs.python-path }}" -m cibuildwheel unpacked/sagemath*bliss*
- name: sagemath-coxeter3
run: |
"${{ steps.python.outputs.python-path }}" -m cibuildwheel unpacked/sagemath*coxeter3*
- name: sagemath-mcqd
run: |
"${{ steps.python.outputs.python-path }}" -m cibuildwheel unpacked/sagemath*mcqd*
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.build }}-${{ matrix.arch }}-wheels
path: ./wheelhouse/*.whl
upload_wheels:
# This needs to be a separate job because pypa/gh-action-pypi-publish cannot run on macOS
needs: build_wheels
runs-on: ubuntu-latest
env:
CAN_DEPLOY: ${{ secrets.SAGEMATH_PYPI_API_TOKEN != '' }}
steps:
- uses: actions/download-artifact@v4
with:
pattern: "*-*-*-wheels"
path: wheelhouse
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.SAGEMATH_PYPI_API_TOKEN }}
packages-dir: wheelhouse/
skip-existing: true
verbose: true
if: env.CAN_DEPLOY == 'true'