@@ -11,128 +11,75 @@ concurrency:
11
11
cancel-in-progress : true
12
12
13
13
jobs :
14
-
15
- sdists_for_pypi :
16
- name : Build sdist (and upload to PyPI on release tags)
14
+ make_sdist :
15
+ name : Build sdist
17
16
runs-on : ubuntu-latest
18
- env :
19
- CAN_DEPLOY : ${{ secrets.SAGEMATH_PYPI_API_TOKEN != '' }}
20
17
steps :
21
18
- uses : actions/checkout@v4
22
- - uses : actions/setup-python@v4
23
- - name : Install dependencies
24
- run : |
25
- pip install --upgrade pip
26
- pip install --upgrade -r requirements.txt
19
+ - uses : astral-sh/setup-uv@v6
27
20
- name : Build sdist
28
- run : python -m build --sdist .
21
+ run : uv build --sdist
29
22
- uses : actions/upload-artifact@v4
30
23
with :
31
24
path : " dist/*.tar.*"
32
- name : dist
33
- - uses : pypa/gh-action-pypi-publish@release/v1
34
- with :
35
- user : __token__
36
- password : ${{ secrets.SAGEMATH_PYPI_API_TOKEN }}
37
- skip_existing : true
38
- verbose : true
39
- if : env.CAN_DEPLOY == 'true' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
25
+ name : release-sdist
40
26
41
27
build_wheels :
42
- name : Build wheels on ${{ matrix.os }}, arch ${{ matrix.arch }}
28
+ name : Build wheels on ${{ matrix.os }}
43
29
runs-on : ${{ matrix.os }}
44
- needs : sdists_for_pypi
45
30
strategy :
46
31
fail-fast : false
47
32
matrix :
48
- include :
49
- - os : ubuntu-latest
50
- arch : x86_64
51
- - os : ubuntu-latest
52
- arch : i686
53
- - os : macos-13
54
- arch : x86_64
55
- - os : macos-14
56
- arch : arm64
57
- env :
58
- # SPKGs to install as system packages
59
- SPKGS : _bootstrap _prereq
60
- # Non-Python packages to install as spkgs
61
- TARGETS_PRE :
62
- # on pp310: build/src/cysignals/implementation.c:231:9: error: implicit declaration of function 'PyPyErr_SetInterrupt' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
63
- CIBW_SKIP : " pp31*"
64
- #
65
- CIBW_ARCHS : ${{ matrix.arch }}
66
- # https://cibuildwheel.readthedocs.io/en/stable/options/#requires-python
67
- CIBW_PROJECT_REQUIRES_PYTHON : " >=3.9"
68
- # Environment during wheel build
69
- CIBW_ENVIRONMENT : " PATH=$(pwd)/local/bin:$PATH CPATH=$(pwd)/local/include:$CPATH LIBRARY_PATH=$(pwd)/local/lib:$LIBRARY_PATH LD_LIBRARY_PATH=$(pwd)/local/lib:$LD_LIBRARY_PATH PKG_CONFIG_PATH=$(pwd)/local/share/pkgconfig:$PKG_CONFIG_PATH ACLOCAL_PATH=/usr/share/aclocal"
70
- # Use 'build', not 'pip wheel'
71
- CIBW_BUILD_FRONTEND : build
33
+ os :
34
+ - ubuntu-latest
35
+ - ubuntu-24.04-arm
36
+ - windows-latest
37
+ - windows-11-arm
38
+ - macos-13
39
+ - macos-latest
72
40
steps :
73
41
- uses : actions/checkout@v4
74
- with :
75
- repository : sagemath/sage
76
- ref : develop
77
-
78
- - uses : actions/download-artifact@v4
79
- with :
80
- name : dist
81
- path : dist
82
-
83
- - uses : actions/setup-python@v5
84
- # As of 2024-02-03, the macOS M1 runners do not have preinstalled python or pipx.
85
- # Installing pipx follows the approach of https://github.com/pypa/cibuildwheel/pull/1743
86
- id : python
87
- with :
88
- python-version : " 3.9 - 3.12"
89
- update-environment : false
90
-
91
- - name : Build platform wheels
92
- # We build the wheel from the sdist.
93
- # But we must run cibuildwheel with the unpacked source directory, not a tarball,
94
- # so that SAGE_ROOT is copied into the build containers.
95
- #
96
- # In the CIBW_BEFORE_ALL phase, we install libraries using the Sage distribution.
97
- # https://cibuildwheel.readthedocs.io/en/stable/options/#before-all
98
- run : |
99
- "${{ steps.python.outputs.python-path }}" -m pip install pipx
100
- export PATH=build/bin:$PATH
101
- export 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) )"
102
- mkdir -p unpacked
103
- for pkg in cysignals; do
104
- (cd unpacked && tar xfz - ) < dist/$pkg*.tar.gz
105
- "${{ steps.python.outputs.python-path }}" -m pipx run cibuildwheel==2.18.0 unpacked/$pkg*
106
- done
107
-
42
+ - uses : astral-sh/setup-uv@v6
43
+ - name : Build wheels
44
+ uses : pypa/cibuildwheel@v3.1
108
45
- uses : actions/upload-artifact@v4
109
46
with :
110
- name : ${{ matrix.os }}-${{ matrix.arch }}-wheels
111
- path : ./ wheelhouse/*.whl
47
+ name : release-wheels- ${{ matrix.os }}
48
+ path : wheelhouse/*.whl
112
49
113
50
pypi-publish :
114
51
# This needs to be a separate job because pypa/gh-action-pypi-publish cannot run on macOS
115
52
# https://github.com/pypa/gh-action-pypi-publish
116
53
name : Upload wheels to PyPI
117
- needs : build_wheels
118
- if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
54
+ needs : [ build_wheels, make_sdist]
55
+ if :
119
56
runs-on : ubuntu-latest
120
57
env :
121
58
CAN_DEPLOY : ${{ secrets.SAGEMATH_PYPI_API_TOKEN != '' }}
59
+ permissions :
60
+ id-token : write
61
+ attestations : write
62
+ contents : read
122
63
steps :
123
-
124
64
- uses : actions/download-artifact@v4
125
65
with :
126
- pattern : " *-*-wheels "
127
- path : wheelhouse
66
+ pattern : release-*
67
+ path : dist
128
68
merge-multiple : true
69
+
70
+ - name : List files
71
+ run : ls -l -R dist
72
+
73
+ - name : Generate artifact attestations
74
+ uses : actions/attest-build-provenance@v2
75
+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
76
+ with :
77
+ subject-path : " dist/*"
129
78
130
79
- name : Publish package distributions to PyPI
131
80
uses : pypa/gh-action-pypi-publish@release/v1
132
81
with :
133
82
user : __token__
134
83
password : ${{ secrets.SAGEMATH_PYPI_API_TOKEN }}
135
- packages_dir : wheelhouse/
136
- skip_existing : true
137
84
verbose : true
138
- if : env.CAN_DEPLOY == 'true'
85
+ if : env.CAN_DEPLOY == 'true' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
0 commit comments