-
Notifications
You must be signed in to change notification settings - Fork 11
317 lines (270 loc) · 10.2 KB
/
Copy pathbuild-wheels.yml
File metadata and controls
317 lines (270 loc) · 10.2 KB
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# Ref: https://github.com/scipy/scipy/blob/main/.github/workflows/windows.yml
# Workflow to build and test wheels.
# To work on the wheel building infrastructure on a fork, comment out:
#
# if: github.repository == 'has2k1/scikit-misc'
#
# in the get_commit_message job include [wheel build] in your commit
# message to trigger the build. All files related to wheel building are located
# at tools/wheels/
name: Build Wheels
on:
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
- cron: "0 0 * * 6"
push:
tags:
- v*
branches:
- wheels
workflow_dispatch:
permissions:
contents: read # to fetch code (actions/checkout)
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
parse_commit_info:
name: Parse Commit Information
runs-on: ubuntu-latest
if: github.repository == 'has2k1/scikit-misc'
outputs:
can_build: ${{ steps.decide.outputs.can_build }}
can_release: ${{ steps.decide.outputs.can_release }}
can_pre_release: ${{ steps.decide.outputs.can_pre_release }}
steps:
- name: Checkout scikit-misc
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Fetch all Tags
run: |
git fetch --tags --force
git log -n 1
- name: Copy build utils
run: |
cp -r .github/utils ../utils
- name: Environment information
run: |
echo "GITHUB_REPOSITORY=$GITHUB_REPOSITORY"
echo "GITHUB_SHA=$GITHUB_SHA"
echo "GITHUB_REF_NAME=$GITHUB_REF_NAME"
echo "GITHUB_REF_TYPE=$GITHUB_REF_TYPE"
echo "GITHUB_EVENT_NAME=$GITHUB_EVENT_NAME"
echo "git describe: $(git describe --long)"
- name: Debug
run: |
set -xe
commit_message=$(python ../utils/please.py commit_message)
skip_ci_message=$(python ../utils/please.py skip_ci_message)
skip_gha_message=$(python ../utils/please.py skip_gha_message)
skip_build=$(python ../utils/please.py skip_build)
is_wheel_build=$(python ../utils/please.py is_wheel_build)
- name: Decide Whether to Build and/or Release
id: decide
run: |
set -xe
CAN_BUILD=$(python ../utils/please.py can_i_build)
CAN_RELEASE=$(python ../utils/please.py can_i_release)
CAN_PRE_RELEASE=$(python ../utils/please.py can_i_pre_release)
echo "can_build=$CAN_BUILD" >> $GITHUB_OUTPUT
echo "can_release=$CAN_RELEASE" >> $GITHUB_OUTPUT
echo "can_pre_release=$CAN_PRE_RELEASE" >> $GITHUB_OUTPUT
echo github.ref ${{ github.ref }}
build_wheels:
name: Wheel, ${{ matrix.python }}-${{ matrix.buildplat[1] }}
needs: parse_commit_info
if: contains(needs.parse_commit_info.outputs.can_build, 'true')
runs-on: ${{ matrix.buildplat[0] }}
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
# Github Actions doesn't support pairing matrix values together, let's improvise
# https://github.com/github/feedback/discussions/7835#discussioncomment-1769026
buildplat:
# should also be able to do multi-archs on a single entry, e.g.
# [windows-2019, win*, "AMD64 x86"]. However, those two require a different compiler setup
# so easier to separate out here.
- [ubuntu-24.04, manylinux_x86_64]
- [macos-13, macosx_x86_64]
- [macos-14, macosx_arm64]
- [windows-2025, win_amd64]
python: ["cp310", "cp311", "cp312", "cp313", "cp314"]
python-version: [3.13]
steps:
- name: Checkout scikit-misc
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install a specific version of uv
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
activate-environment: "true"
- name: Fetch all Tags
run: |
git fetch --tags --force
echo "git describe: $(git describe --long)"
- name: Copy build utils
run: |
cp -r .github/utils ../utils
- name: Checkout build target
run: |
python ../utils/please.py checkout_build_commit
git describe --long
- name: Install pip packages
run: |
uv pip install wheel
- name: Windows - Install rtools
if: runner.os == 'Windows'
run: |
# mingw-w64
choco install rtools -y --no-progress --force --version=4.0.0.20220206
echo "c:\rtools40\ucrt64\bin;" >> $env:GITHUB_PATH
- name: macOS - Setup
if: matrix.buildplat[0] == 'macos-13' || matrix.buildplat[0] == 'macos-14'
run: |
# Needed due to https://github.com/actions/runner-images/issues/3371
# Supported versions: https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
echo "FC=gfortran-13" >> "$GITHUB_ENV"
echo "F77=gfortran-13" >> "$GITHUB_ENV"
echo "F90=gfortran-13" >> "$GITHUB_ENV"
CIBW="RUNNER_OS=macOS"
echo "CIBW_ENVIRONMENT_MACOS=$CIBW" >> "$GITHUB_ENV"
- name: Build wheels
uses: pypa/cibuildwheel@v3.2.1
env:
CIBW_PRERELEASE_PYTHONS: True
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
- name: Check Package Version
run: |
ls wheelhouse/*.whl
python ../utils/check_package_version.py
- uses: actions/upload-artifact@v4
with:
# @v4 does not merge artifacts with the name (even if the contents)
# are different. So in a matrix, we have to give each artifact a
# unique name. We merge these later in another job.
name: skmisc-wheel-${{ matrix.python }}-${{ matrix.buildplat[1] }}
path: ./wheelhouse/*.whl
build_sdist:
runs-on: ubuntu-latest
name: Build Source Distribution
needs: [build_wheels]
strategy:
matrix:
python-version: [3.13]
steps:
- name: Checkout scikit-misc
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install a specific version of uv
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
activate-environment: "true"
- name: Fetch all Tags
run: |
git fetch --tags --force
- name: Copy build utils
run: |
cp -r .github/utils ../utils
- name: Checkout build target
run: |
python ../utils/please.py checkout_build_commit
- name: Install Ubuntu dependencies
run: |
sudo apt-get update
sudo apt-get install gfortran
- name: Install requirements
run: |
uv pip install ".[build]"
- name: Create Source Distribution
run: |
make sdist
- name: Check Package Version
run: |
ls dist/*.tar.gz
python ../utils/check_package_version.py
- name: Upload Source dist
uses: actions/upload-artifact@v4
with:
name: skmisc-sdist
path: dist/*.tar.gz
release:
runs-on: ubuntu-latest
name: Upload Release to PyPI
needs: [parse_commit_info, build_wheels, build_sdist]
if: contains(needs.parse_commit_info.outputs.can_release, 'true')
strategy:
matrix:
python-version: [3.13]
steps:
- name: Checkout scikit-misc
uses: actions/checkout@v5
- name: Install a specific version of uv
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
activate-environment: "true"
- name: Install Release Requirements
run: |
uv pip install twine
- name: Download wheels & sdist
uses: actions/download-artifact@v4
with:
pattern: skmisc-*
path: dist
merge-multiple: true
- name: Publish to PyPI
run: |
ls -la ${{ github.workspace }}/dist
# publish wheels first so that there is no window where users
# may accidentally install an sdist instead of a wheel
twine upload --skip-existing ${{ github.workspace }}/dist/*.whl
twine upload --skip-existing ${{ github.workspace }}/dist/*.tar.gz
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
pre_release:
runs-on: ubuntu-latest
name: Upload Release to TestPyPI
needs: [parse_commit_info, build_wheels, build_sdist]
if: contains(needs.parse_commit_info.outputs.can_pre_release, 'true')
strategy:
matrix:
python-version: [3.13]
steps:
- name: Checkout scikit-misc
uses: actions/checkout@v5
- name: Install a specific version of uv
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
activate-environment: "true"
- name: Install Release Requirements
run: |
uv pip install twine
- name: Download wheels & sdist
uses: actions/download-artifact@v4
with:
pattern: skmisc-*
path: dist
merge-multiple: true
- name: Publish to TestPyPI
run: |
ls -la ${{ github.workspace }}/dist
# publish wheels first so that there is no window where users
# may accidentally install an sdist instead of a wheel
twine upload --skip-existing --repository testpypi ${{ github.workspace }}/dist/*.whl
twine upload --skip-existing --repository testpypi ${{ github.workspace }}/dist/*.tar.gz
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME_TEST }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD_TEST }}