forked from wxWidgets/Phoenix
-
Notifications
You must be signed in to change notification settings - Fork 0
379 lines (322 loc) · 11.7 KB
/
ci-build.yml
File metadata and controls
379 lines (322 loc) · 11.7 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
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
#---------------------------------------------------------------------------
# This workflow will build and archive a wxPython source distribution for
# CI. It will start by building a sdist archive first, and then that will be
# used in subsequent jobs on each supported platform and Python version.
#---------------------------------------------------------------------------
name: ci-build
on:
# Trigger on push or PRs targeting the master branch
push:
branches: [ 'master' ]
tags:
- 'wxPython-*'
pull_request:
branches: [ 'master' ]
# Also allow manual triggering (via web ui)
workflow_dispatch:
# Cancel the workflow if another instance in the same workflow and PR is triggered
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
defaults:
run:
# always use bash shell, even on windows
shell: bash
env:
PYTHONUNBUFFERED: 1
WXPYTHON_BUILD_ARGS: ${{ startsWith(github.ref, 'refs/tags/') && '--release' || '' }}
#---------------------------------------------------------------------------
jobs:
# Build a wxPython source archive, and save it as an artifact for use in the
# job that builds the wheels.
build-source-dist:
runs-on: ubuntu-24.04
outputs:
VERSION: ${{ steps.generate.outputs.version }}
steps:
- name: Checkout repo
uses: actions/checkout@v6
with:
submodules: 'recursive'
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.13'
cache: 'pip'
- name: Install dependencies
run: |
sudo apt-get install -y gettext
python -m pip install --upgrade -r requirements.txt
- name: Generate wrapper code
id: generate
run: |
python build.py setrev dox etg sip --nodoc
VERSION=$(python build.py --quiet version)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Create source distribution (sdist)
run: |
python build.py sdist
- name: Save sdist as job artifact
uses: actions/upload-artifact@v7
with:
name: wxPython-source
path: dist/wxpython-${{ steps.generate.outputs.version }}.tar.gz
- name: Create demo source distribution (sdist_demo)
if: github.event_name == 'push'
run: |
python build.py sdist_demo
- name: Save demo sdist as job artifact
if: github.event_name == 'push'
uses: actions/upload-artifact@v7
with:
name: demo
path: dist/wxPython-demo-${{ steps.generate.outputs.version }}.tar.gz
#---------------------------------------------------------------------------
# Use pip and the wxPython-source artifact to build a wxPython wheel for every
# supported Python version and architecture.
build-wheels:
# wait for prior job to complete
needs: build-source-dist
strategy:
fail-fast: false
matrix:
os: [ ubuntu-24.04, windows-2025, macos-15-intel, macos-15, windows-11-arm ]
python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ]
architecture: [ 'x86', 'x64', 'arm64' ]
# Exclude x86 configs on non-Windows OSs
exclude:
- os: ubuntu-24.04
architecture: x86
- os: ubuntu-24.04
architecture: arm64
- os: macos-15-intel
architecture: x86
- os: macos-15-intel
architecture: arm64
- os: macos-15
architecture: x86
- os: macos-15
architecture: x64
- os: windows-2025
architecture: arm64
- os: windows-11-arm
architecture: x86
- os: windows-11-arm
architecture: x64
# Only build oldest and newest Pythons on PRs
- python-version: ${{ github.event_name == 'pull_request' && '3.11' }}
- python-version: ${{ github.event_name == 'pull_request' && '3.12' }}
- python-version: ${{ github.event_name == 'pull_request' && '3.13' }}
# Skip Windows x86 builds on PRs
- architecture: ${{ github.event_name == 'pull_request' && 'x86' }}
# Only build windows-11-arm on pushes
- os: ${{ github.event_name != 'push' && 'windows-11-arm' }}
# Python interpreter < 3.11 doesn't exist for Windows 11 ARM
- os: windows-11-arm
python-version: '3.10'
env:
VERSION: ${{ needs.build-source-dist.outputs.VERSION }}
runs-on: ${{ matrix.os }}
outputs:
short_name: ${{ steps.init.outputs.short_name }}
canonical_id: ${{ steps.init.outputs.canonical_id }}
steps:
- name: initialize variables
id: init
run: |
build_opts=$WXPYTHON_BUILD_ARGS
if [ ${{ runner.os }} == 'Linux' ]; then
short_name=linux
elif [ ${{ matrix.os }} == macos-15-intel ]; then
short_name=macos
echo "CIBW_BUILD=cp$(echo ${{ matrix.python-version }} | sed 's/\.//')-macosx_$(uname -m)" >> "$GITHUB_ENV"
echo "MACOSX_DEPLOYMENT_TARGET=14.0" >> "$GITHUB_ENV"
elif [ ${{ matrix.os }} == macos-15 ]; then
short_name=macos
echo "CIBW_BUILD=cp$(echo ${{ matrix.python-version }} | sed 's/\.//')-macosx_$(uname -m)" >> "$GITHUB_ENV"
echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> "$GITHUB_ENV"
elif [ ${{ matrix.os }} == windows-2025 ]; then
if [ ${{ matrix.architecture }} == x64 ]; then
short_name=win64
else
short_name=win32
fi
elif [ ${{ matrix.os }} == windows-11-arm ]; then
short_name=win64
fi
echo "short_name=$short_name" >> "$GITHUB_OUTPUT"
echo "canonical_id=$short_name-py${{ matrix.python-version }}-${{ matrix.architecture}}" >> "$GITHUB_OUTPUT"
echo "build_opts=$build_opts" >> "$GITHUB_OUTPUT"
- name: Checkout repo
uses: actions/checkout@v6
with:
submodules: 'recursive'
- name: download CI source artifact
uses: actions/download-artifact@v8
with:
name: wxPython-source
path: dist
- name: Set up Python ${{ matrix.python-version }}-${{ matrix.architecture }}
uses: actions/setup-python@v6
with:
python-version: '${{ matrix.python-version }}'
architecture: '${{ matrix.architecture }}'
cache: 'pip'
allow-prereleases: true
- name: Install Python dependencies
run: |
python -m pip install --upgrade -r requirements.txt
- name: Install Ubuntu dependencies
if: runner.os == 'Linux'
run: |
./buildtools/install_depends.sh
- name: Setup MSVC
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: '${{ matrix.architecture }}'
- name: Build the wxPython wheel
env:
WXPYTHON_BUILD_ARGS: ${{ steps.init.outputs.build_opts }}
run: |
if [ -z "$CIBW_BUILD" ]; then
cd dist
pip wheel -v wxpython-${{ env.VERSION }}.tar.gz
else
pip install cibuildwheel
cibuildwheel dist/wxpython-${{ env.VERSION }}.tar.gz --output-dir dist
fi
- name: Simple smoke test
run: |
cd dist
pip install wxpython-*.whl
python -c "import wx; print(wx); print(wx.version()); print(wx.PlatformInfo)"
pip uninstall --yes wxPython
- name: Save wheel as job artifact
uses: actions/upload-artifact@v7
# Just Windows and MacOS for now, all we care about for Linux at this
# point is that the build was successful.
if: runner.os != 'Linux'
with:
name: wxPython-wheel-${{ steps.init.outputs.canonical_id }}
path: dist/wxpython-*.whl
build-documentation:
name: Build wxPython documentation
if: github.event_name == 'push'
runs-on: windows-2025
steps:
- name: Checkout repo
uses: actions/checkout@v6
with:
submodules: 'recursive'
fetch-depth: 0
- name: Set up Python 3.13
uses: actions/setup-python@v6
with:
python-version: '3.13'
cache: 'pip'
- name: Install Python dependencies
run: |
python -m pip install --upgrade -r requirements.txt
python -m pip install --upgrade pillow numpy comtypes pywin32 cairocffi PyMuPDF
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: 'x64'
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v2
- name: Build documentation
run: |
python build.py setrev dox etg sip build_wx build_py wxlib sphinx bdist_docs docset_py
- name: Save docs as job artifact
uses: actions/upload-artifact@v7
with:
name: docs
path: dist/wxPython-docs*.tar.gz
publish-to-pypi:
name: Publish Python distribution to PyPI
if: startsWith(github.ref, 'refs/tags/')
needs: build-wheels
runs-on: ubuntu-24.04
environment:
name: pypi
url: https://pypi.org/p/wxPython
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v8
with:
pattern: wxPython-*
path: dist/
merge-multiple: true
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
github-release:
name: Create GitHub Release and upload source
needs: publish-to-pypi
runs-on: ubuntu-24.04
permissions:
contents: write
id-token: write
steps:
- name: Download source distribution
uses: actions/download-artifact@v8
with:
name: wxPython-source
path: dist
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release create '${{ github.ref_name }}' \
--repo '${{ github.repository }}' \
--notes ""
- name: Upload source distribution to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release upload '${{ github.ref_name }}' dist/* \
--repo '${{ github.repository }}'
upload-demo-docs-to-extras:
name: Upload demo/docs to extras.wxpython.org
needs: [build-source-dist, publish-to-pypi]
runs-on: ubuntu-24.04
steps:
- name: Download demo/docs
uses: actions/download-artifact@v8
with:
pattern: d*
path: dist/
merge-multiple: true
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.RIOBU_SSH_KEY }}
known_hosts: ${{ secrets.RIOBU_KNOWN_HOSTS }}
- name: Make directory and SCP demo/docs
run: |
ssh rbot.wxpython@riobu.com mkdir -p wxpython-extras/htdocs/wxPython4/extras/${{ needs.build-source-dist.outputs.VERSION }}
scp -p dist/* rbot.wxpython@riobu.com:wxpython-extras/htdocs/wxPython4/extras/${{ needs.build-source-dist.outputs.VERSION }}/
upload-wheels-to-snapshot-builds:
name: Upload wheels to snapshot-builds on wxpython.org
if: github.event_name == 'push'
needs: build-wheels
runs-on: ubuntu-24.04
steps:
- name: Download all the dists
uses: actions/download-artifact@v8
with:
path: dist/
merge-multiple: true
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.RIOBU_SSH_KEY }}
known_hosts: ${{ secrets.RIOBU_KNOWN_HOSTS }}
- name: SCP wheels
run: |
scp -p dist/* rbot.wxpython@riobu.com:snapshot-builds/