-
Notifications
You must be signed in to change notification settings - Fork 0
306 lines (298 loc) · 9.99 KB
/
osx_wheels_app.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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
name: OSX wheels/app
on:
push:
pull_request:
create:
schedule:
- cron: '23 1 * * *'
env:
KIVY_SPLIT_EXAMPLES: 1
SERVER_IP: '159.203.106.198'
CC: clang
CXX: clang
FFLAGS: '-ff2c'
USE_SDL2: 1
jobs:
kivy_examples_create:
# we need examples wheel for tests, but only windows actually uploads kivy-examples to pypi/server
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
run: |
source .ci/ubuntu_ci.sh
install_kivy_test_wheel_run_pip_deps dev
- name: Create wheel
run: |
source .ci/ubuntu_ci.sh
create_kivy_examples_wheel
- name: Upload kivy-examples wheel as artifact
uses: actions/upload-artifact@v3
with:
name: osx_examples_wheel
path: dist
osx_wheels_create:
if: github.event_name == 'schedule' || (github.event_name == 'create' && github.event.ref_type == 'tag') || contains(github.event.head_commit.message, '[build wheel]') || contains(github.event.head_commit.message, '[build wheel osx]') || contains(github.event.pull_request.title, '[build wheel]') || contains(github.event.pull_request.title, '[build wheel osx]')
env:
CIBW_BUILD: "cp37-macosx_x86_64 cp38-macosx_universal2 cp39-macosx_universal2 cp310-macosx_universal2 cp311-macosx_universal2"
CIBW_ARCHS_MACOS: "x86_64 universal2"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-listdeps {wheel} &&
DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}
runs-on: ${{ matrix.runs_on }}
strategy:
matrix:
include:
- runs_on: macos-latest
python: '3.x'
steps:
- uses: actions/checkout@v3
- name: Set up Python
# Needs to be skipped on our self-hosted runners tagged as 'apple-silicon-m1'
if: ${{ matrix.runs_on != 'apple-silicon-m1' }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Cache macOS deps downloads
uses: actions/cache@v3
with:
path: osx-cache
key: ${{ runner.OS }}-build-${{ hashFiles('.ci/osx_ci.sh') }}
- name: Generate version metadata
run: |
source .ci/ubuntu_ci.sh
update_version_metadata
- name: Install build dependencies
run: |
source .ci/ubuntu_ci.sh
source .ci/osx_ci.sh
arm64_set_path_and_python_version ${{ matrix.python }}
brew install pkg-config cmake ninja
- name: Build universal Kivy dependencies
run: |
source .ci/ubuntu_ci.sh
source .ci/osx_ci.sh
arm64_set_path_and_python_version ${{ matrix.python }}
./tools/build_macos_dependencies.sh
- name: Install cibuildwheel
run: |
source .ci/osx_ci.sh
arm64_set_path_and_python_version ${{ matrix.python }}
python -m pip install cibuildwheel==2.11.2
- name: Build wheels
run: |
source .ci/osx_ci.sh
arm64_set_path_and_python_version ${{ matrix.python }}
export KIVY_DEPS_ROOT=$(pwd)/kivy-dependencies
export REPAIR_LIBRARY_PATH=$KIVY_DEPS_ROOT/dist/Frameworks:$KIVY_DEPS_ROOT/dist/Frameworks/SDL2_mixer.framework/Frameworks
python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v3
with:
name: osx_wheels
path: ./wheelhouse/*.whl
osx_wheel_upload:
runs-on: macos-latest
needs: osx_wheels_create
if: github.event_name != 'pull_request'
env:
KIVY_GL_BACKEND: 'mock'
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: actions/download-artifact@v3
with:
name: osx_wheels
path: dist
- name: Rename wheels
if: github.event.ref_type != 'tag'
run: |
source .ci/ubuntu_ci.sh
rename_wheels
- name: Upload wheels to server
env:
UBUNTU_UPLOAD_KEY: ${{ secrets.UBUNTU_UPLOAD_KEY }}
run: |
source .ci/ubuntu_ci.sh
upload_file_to_server "$SERVER_IP" "osx/kivy/"
- name: Upload to GitHub Release
uses: softprops/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
files: dist/*
draft: true
- name: Publish to PyPI
if: github.event_name == 'create' && github.event.ref_type == 'tag'
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
source .ci/ubuntu_ci.sh
upload_artifacts_to_pypi
osx_wheel_test:
name: "osx_wheel_test (${{ matrix.runs_on }}, ${{ matrix.python }})"
needs: [ osx_wheels_create, kivy_examples_create ]
runs-on: ${{ matrix.runs_on }}
strategy:
matrix:
include:
- runs_on: macos-latest
python: '3.7'
- runs_on: macos-latest
python: '3.8'
- runs_on: macos-latest
python: '3.9'
- runs_on: macos-latest
python: '3.10'
- runs_on: macos-latest
python: '3.11'
- runs_on: apple-silicon-m1
python: '3.8.13'
- runs_on: apple-silicon-m1
python: '3.9.7'
- runs_on: apple-silicon-m1
python: '3.10.1'
- runs_on: apple-silicon-m1
python: '3.11'
env:
KIVY_GL_BACKEND: 'mock'
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }} on ${{ matrix.runs_on }}
# Needs to be skipped on our self-hosted runners tagged as 'apple-silicon-m1'
if: ${{ matrix.runs_on != 'apple-silicon-m1' }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- uses: actions/download-artifact@v3
with:
name: osx_wheels
path: dist
- name: Install test dependencies
run: |
source .ci/ubuntu_ci.sh
source .ci/osx_ci.sh
arm64_set_path_and_python_version ${{ matrix.python }}
install_kivy_test_wheel_run_pip_deps dev
- name: Install Kivy wheel
run: |
source .ci/ubuntu_ci.sh
source .ci/osx_ci.sh
arm64_set_path_and_python_version ${{ matrix.python }}
install_kivy_wheel dev
- uses: actions/download-artifact@v3
with:
name: osx_examples_wheel
path: dist
- name: Install kivy-examples wheel
run: |
source .ci/ubuntu_ci.sh
source .ci/osx_ci.sh
arm64_set_path_and_python_version ${{ matrix.python }}
install_kivy_examples_wheel dev
- name: Test Kivy wheel
run: |
source .ci/ubuntu_ci.sh
source .ci/osx_ci.sh
arm64_set_path_and_python_version ${{ matrix.python }}
test_kivy_install
osx_app_create:
runs-on: macos-latest
if: github.event_name != 'pull_request' && (github.event_name == 'schedule' || (github.event_name == 'create' && github.event.ref_type == 'tag') || contains(github.event.head_commit.message, '[build app osx]')) || contains(github.event.pull_request.title, '[build app osx]')
env:
KIVY_SPLIT_EXAMPLES: 0
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Cache macOS deps downloads
uses: actions/cache@v3
with:
path: osx-cache
key: ${{ runner.OS }}-build-${{ hashFiles('.ci/osx_ci.sh') }}
- name: Generate version metadata
run: |
source .ci/ubuntu_ci.sh
update_version_metadata
- name: Install dependencies
run: |
source .ci/ubuntu_ci.sh
source .ci/osx_ci.sh
install_platypus
install_kivy_test_run_pip_deps dev
- name: Make app bundle
run: |
py_version=$(python3 -c "import platform; print(platform.python_version())")
source .ci/osx_ci.sh
generate_osx_app_bundle "$py_version"
- name: Create dmg from bundle
run: |
source .ci/osx_ci.sh
generate_osx_app_dmg_from_bundle
- name: Upload dmg as artifact
uses: actions/upload-artifact@v3
with:
name: osx_app
path: app
osx_app_upload_test:
runs-on: macos-latest
needs: [osx_app_create, kivy_examples_create]
env:
KIVY_GL_BACKEND: 'mock'
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: actions/download-artifact@v3
with:
name: osx_app
path: app
- name: Rename app
if: github.event.ref_type != 'tag'
run: |
py_version=$(python3 -c "import platform; print(platform.python_version())")
source .ci/osx_ci.sh
rename_osx_app "$py_version"
- name: Upload app to server
env:
UBUNTU_UPLOAD_KEY: ${{ secrets.UBUNTU_UPLOAD_KEY }}
run: |
source .ci/ubuntu_ci.sh
upload_file_to_server "$SERVER_IP" "osx/app/" "*.dmg" "app"
- name: Upload to GitHub Release
uses: softprops/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
files: app/*
draft: true
- name: Mount Kivy.app
run: |
source .ci/osx_ci.sh
mount_osx_app
- uses: actions/download-artifact@v3
with:
name: osx_examples_wheel
path: dist
- name: Install test dependencies
run: |
source .ci/osx_ci.sh
source .ci/ubuntu_ci.sh
activate_osx_app_venv
install_kivy_test_wheel_run_pip_deps dev
install_kivy_examples_wheel dev
- name: Test Kivy app
run: |
source .ci/osx_ci.sh
source .ci/ubuntu_ci.sh
activate_osx_app_venv
test_kivy_install