forked from flet-dev/serious-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.appveyor.yml
435 lines (345 loc) · 14.9 KB
/
.appveyor.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
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
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
skip_branch_with_pr: true
environment:
PYTHON_STACK: python 3.10
GITHUB_TOKEN:
secure: 9SKIwc3VSfYJ5IChvNR74mEv2nb0ZFftUzn3sGRdXipXEfKSxY50DoodChHvlqZduQNhjg0oyLWAAa3n+iwWvVM2yI7Cgb14lFNClijz/kHI/PibnjDMNvLKaAygcfAc
matrix:
- job_name: Build Python for iOS
job_group: build_python_darwin
APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
- job_name: Build Python for Android
job_group: build_python_android
APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004
- job_name: Test on macOS
job_group: test_serious_python
job_depends_on: build_python_darwin
APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
# - job_name: Test on iOS
# job_group: test_serious_python
# job_depends_on: build_python_darwin
# APPVEYOR_BUILD_WORKER_IMAGE: macos-sonoma
- job_name: Test on Android
job_group: test_serious_python
job_depends_on: build_python_android
APPVEYOR_BUILD_WORKER_IMAGE: ubuntu-gce-c
- job_name: Test on Windows
job_group: test_serious_python
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
- job_name: Test on Linux
job_group: test_serious_python
APPVEYOR_BUILD_WORKER_IMAGE: ubuntu2004
- job_name: Test on Linux ARM64
job_group: test_serious_python
APPVEYOR_BUILD_WORKER_IMAGE: ubuntu2004-arm
- job_name: Publish serious_python package to pub.dev
job_group: publish_package
job_depends_on: build_python, test_serious_python
APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004
stack:
- $PYTHON_STACK
for:
# ======================================
# Build Python for iOS
# ======================================
- matrix:
only:
- job_name: Build Python for iOS
install:
# update build version
- ps: |
if ($env:APPVEYOR_REPO_TAG_NAME) {
$v = $env:APPVEYOR_REPO_TAG_NAME.replace("v", "")
} else {
$cv = [version](git describe --abbrev=0).substring(1)
$v = "$($cv.major).$($cv.minor+1).0+$($env:APPVEYOR_BUILD_NUMBER)"
}
Update-AppveyorBuild -Version $v
# install Kivy toolchain
- pip3 list
- pip3 install git+https://github.com/flet-dev/python-for-ios.git
- HOMEBREW_NO_AUTO_UPDATE=1 brew install autoconf automake libtool pkg-config
- brew link libtool
build_script:
# build Python 3
- toolchain build python3
- ls dist
# package dist
- DIST_FILE_NAME=dist/python-ios-dist-v$APPVEYOR_BUILD_VERSION.tar.gz
- tar -czvf $DIST_FILE_NAME dist/*
- appveyor PushArtifact $DIST_FILE_NAME -DeploymentName python-dist-macos
deploy:
provider: GitHub
auth_token: $(GITHUB_TOKEN)
release: $(APPVEYOR_REPO_TAG_NAME)
artifact: python-dist-macos
on:
APPVEYOR_REPO_TAG: true
test: off
# ======================================
# Build Python for Android
# ======================================
- matrix:
only:
- job_name: Build Python for Android
install:
# update build version
- ps: |
if ($env:APPVEYOR_REPO_TAG_NAME) {
$v = $env:APPVEYOR_REPO_TAG_NAME.replace("v", "")
} else {
$cv = [version](git describe --abbrev=0).substring(1)
$v = "$($cv.major).$($cv.minor+1).0+$($env:APPVEYOR_BUILD_NUMBER)"
}
Update-AppveyorBuild -Version $v
# install NDK
- export ANDROID_SDK_ROOT="/usr/lib/android-sdk"
- export NDK_VERSION=25.2.9519653
- export SDK_VERSION=android-33
- echo "y" | sdkmanager --install "ndk;$NDK_VERSION" --channel=3 > /dev/null
- echo "y" | sdkmanager --install "platforms;$SDK_VERSION" > /dev/null
# install Kivy for Android
- pip3 install git+https://github.com/flet-dev/[email protected]
- pip3 install --upgrade cython
- p4a --help
- p4a create --requirements python3 --arch arm64-v8a --arch armeabi-v7a --arch x86_64 --sdk-dir $ANDROID_SDK_ROOT --ndk-dir $ANDROID_SDK_ROOT/ndk/$NDK_VERSION --dist-name serious_python
# package
- BUNDLE_NAME=libpythonbundle.so
# arm64-v8a
- cd ~/.local/share/python-for-android/dists/serious_python/_python_bundle__arm64-v8a/_python_bundle
- zip -r $BUNDLE_NAME .
- mv $BUNDLE_NAME ../../libs/arm64-v8a
- cd $APPVEYOR_BUILD_FOLDER
# armeabi-v7a
- cd ~/.local/share/python-for-android/dists/serious_python/_python_bundle__armeabi-v7a/_python_bundle
- zip -r $BUNDLE_NAME .
- mv $BUNDLE_NAME ../../libs/armeabi-v7a
- cd $APPVEYOR_BUILD_FOLDER
# armeabi-v7a
- cd ~/.local/share/python-for-android/dists/serious_python/_python_bundle__x86_64/_python_bundle
- zip -r $BUNDLE_NAME .
- mv $BUNDLE_NAME ../../libs/x86_64
- cd $APPVEYOR_BUILD_FOLDER
# package all .so files
- DIST_FILE_NAME=python-android-dist-v$APPVEYOR_BUILD_VERSION.tar.gz
- cd ~/.local/share/python-for-android/dists/serious_python/libs
- tar -czvf $DIST_FILE_NAME *
- appveyor PushArtifact $DIST_FILE_NAME -DeploymentName python-dist-android
- cd $APPVEYOR_BUILD_FOLDER
deploy:
provider: GitHub
auth_token: $(GITHUB_TOKEN)
release: $(APPVEYOR_REPO_TAG_NAME)
artifact: python-dist-android
on:
APPVEYOR_REPO_TAG: true
# ======================================
# Test on macOS
# ======================================
- matrix:
only:
- job_name: Test on macOS
install:
- HOMEBREW_NO_AUTO_UPDATE=1 brew install cocoapods
- flutter upgrade
- flutter config --enable-macos-desktop
- flutter doctor
# download dist for non-releases
- |
if [[ "$APPVEYOR_REPO_TAG_NAME" == "" ]]; then
python3 ci/download_artifact.py "Build Python for iOS" "python-ios-dist-v{version}.tar.gz"
export SERIOUS_PYTHON_IOS_DIST=$APPVEYOR_BUILD_FOLDER/python_dist/dist
fi
build: off
test_script:
- cd src/serious_python/example/flet_example
- dart run serious_python:main package app/src --dep-mappings "flet=flet-embed" --req-deps "flet-embed"
- flutter test integration_test -d macos
# ======================================
# Test on iOS
# ======================================
- matrix:
only:
- job_name: Test on iOS
install:
- HOMEBREW_NO_AUTO_UPDATE=1 brew install cocoapods
- flutter upgrade
- flutter config --enable-macos-desktop
- xcrun simctl list runtimes
- xcrun simctl create "e2e test" "iPhone 12" "com.apple.CoreSimulator.SimRuntime.iOS-17-2"
- xcrun xctrace list devices
- |
UDID=$(xcrun xctrace list devices | grep "^e2e test Simulator (17.2)" | awk '{gsub(/[()]/,""); print $NF}')
echo $UDID
xcrun simctl boot "${UDID:?No Simulator with this name found}"
#- flutter doctor -v
# download dist for non-releases
- |
if [[ "$APPVEYOR_REPO_TAG_NAME" == "" ]]; then
python3 ci/download_artifact.py "Build Python for iOS" "python-ios-dist-v{version}.tar.gz"
export SERIOUS_PYTHON_IOS_DIST=$APPVEYOR_BUILD_FOLDER/python_dist/dist
fi
build: off
test_script:
- cd src/serious_python/example/flet_example
- dart run serious_python:main package app/src --mobile --dep-mappings "flet=flet-embed" --req-deps "flet-embed"
- flutter drive --driver=test_driver/integration_test.dart --target=integration_test/app_test.dart
# ======================================
# Test on Android
# ======================================
- matrix:
only:
- job_name: Test on Android
install:
- API_LEVEL="33"
- TARGET="google_atd"
- ARCH="x86_64"
- DEVICE_NAME="android_emulator"
- DEVICE_TYPE="pixel_5"
- 'export PATH=$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/emulator:$PATH'
- sdkmanager "platform-tools" "platforms;android-${API_LEVEL}"
- sdkmanager --install "system-images;android-${API_LEVEL};${TARGET};${ARCH}"
- sdkmanager --update
- echo "y" | sdkmanager --licenses
- echo "no" | avdmanager -v create avd --force --name "${DEVICE_NAME}" --package "system-images;android-${API_LEVEL};${TARGET};${ARCH}" --tag "${TARGET}" --sdcard 128M --device "${DEVICE_TYPE}"
- ls -al ~/.android/avd
- sudo adduser $USER kvm
- sudo chown $USER /dev/kvm
- emulator -avd "${DEVICE_NAME}" -memory 2048 -wipe-data -no-boot-anim -cache-size 1000 -noaudio -no-window -partition-size 8192 &
- adb wait-for-device shell 'while [[ -z $(getprop dev.bootcomplete) ]]; do sleep 1; done;'
- flutter upgrade --force
- flutter doctor -v
# download dist for non-releases
- |
if [[ "$APPVEYOR_REPO_TAG_NAME" == "" ]]; then
python3 ci/download_artifact.py "Build Python for Android" "python-android-dist-v{version}.tar.gz"
export SERIOUS_PYTHON_BUILD_DIST=$APPVEYOR_BUILD_FOLDER/python_dist
fi
build: off
test_script:
- cd src/serious_python/example/flet_example
- dart run serious_python:main package app/src --mobile --dep-mappings "flet=flet-embed" --req-deps "flet-embed"
- flutter test integration_test -d emulator-5554
# ======================================
# Test on Windows
# ======================================
- matrix:
only:
- job_name: Test on Windows
#environment:
# VC_REDIST_DIR: 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT'
install:
- flutter upgrade --force
build: off
test_script:
- cd src/serious_python/example/flet_example
- dart run serious_python:main package app/src --dep-mappings "flet=flet-embed" --req-deps "flet-embed"
- flutter test integration_test -d windows
# ======================================
# Test on Linux
# ======================================
- matrix:
only:
- job_name: Test on Linux
install:
- sudo apt update --allow-releaseinfo-change
- sudo apt install -y xvfb libgtk-3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio
- flutter upgrade --force
build: off
test_script:
- cd src/serious_python/example/flet_example
- dart run serious_python:main package app/src --dep-mappings "flet=flet-embed" --req-deps "flet-embed"
- xvfb-run flutter test integration_test -d linux
# ======================================
# Test on Linux ARM64
# ======================================
- matrix:
only:
- job_name: Test on Linux ARM64
install:
# Flutter SDK
- sudo apt update --allow-releaseinfo-change
- sudo apt install -y clang xvfb libgtk-3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio
- git clone https://github.com/flutter/flutter.git -b stable "$HOME/flutter"
- export PATH="$PATH:$HOME/flutter/bin"
- flutter upgrade
- flutter doctor
build: off
test_script:
- cd src/serious_python/example/flet_example
- dart run serious_python:main package app/src --dep-mappings "flet=flet-embed" --req-deps "flet-embed"
- xvfb-run flutter test integration_test -d linux
# =========================================
# Publish serious_python package to pub.dev
# =========================================
- matrix:
only:
- job_name: Publish serious_python package to pub.dev
install:
# update build version
- ps: |
if ($env:APPVEYOR_REPO_TAG_NAME) {
$env:PKG_VER = $env:APPVEYOR_REPO_TAG_NAME.replace("v", "")
} else {
$cv = [version](git describe --abbrev=0).substring(1)
$env:PKG_VER = "$($cv.major).$($cv.minor).$($env:APPVEYOR_BUILD_NUMBER)"
}
Write-Host "Package version: $($env:PKG_VER)"
- pip3 install pyyaml
- flutter upgrade --force
build_script:
# publish package
- sh: |
if [[ "$APPVEYOR_REPO_TAG_NAME" != "" ]]; then
mkdir -p $HOME/.config/dart
echo $PUB_DEV_TOKEN | base64 --decode > $HOME/.config/dart/pub-credentials.json
# patch pubspecs
python3 ci/patch_pubspec.py src/serious_python_platform_interface/pubspec.yaml $PKG_VER
python3 ci/patch_pubspec.py src/serious_python/pubspec.yaml $PKG_VER
python3 ci/patch_pubspec.py src/serious_python_android/pubspec.yaml $PKG_VER
python3 ci/patch_pubspec.py src/serious_python_darwin/pubspec.yaml $PKG_VER
python3 ci/patch_pubspec.py src/serious_python_windows/pubspec.yaml $PKG_VER
python3 ci/patch_pubspec.py src/serious_python_linux/pubspec.yaml $PKG_VER
cd src/serious_python_platform_interface
dart pub publish --force || exit 1
cd $APPVEYOR_BUILD_FOLDER
sleep 60
cd src/serious_python_android
dart pub publish --force || exit 1
cd $APPVEYOR_BUILD_FOLDER
sleep 60
cd src/serious_python_darwin
dart pub publish --force || exit 1
cd $APPVEYOR_BUILD_FOLDER
sleep 60
cd src/serious_python_windows
dart pub publish --force || exit 1
cd $APPVEYOR_BUILD_FOLDER
sleep 60
cd src/serious_python_linux
dart pub publish --force || exit 1
cd $APPVEYOR_BUILD_FOLDER
sleep 60
cd src/serious_python
dart pub publish --force || exit 1
cd $APPVEYOR_BUILD_FOLDER
elif [[ "$APPVEYOR_PULL_REQUEST_NUMBER" == "" ]]; then
cd src/serious_python_platform_interface
dart pub publish --dry-run
cd $APPVEYOR_BUILD_FOLDER
cd src/serious_python_android
dart pub publish --dry-run
cd $APPVEYOR_BUILD_FOLDER
cd src/serious_python_darwin
dart pub publish --dry-run
cd $APPVEYOR_BUILD_FOLDER
cd src/serious_python_windows
dart pub publish --dry-run
cd $APPVEYOR_BUILD_FOLDER
cd src/serious_python_linux
dart pub publish --dry-run
cd $APPVEYOR_BUILD_FOLDER
cd src/serious_python
dart pub publish --dry-run
cd $APPVEYOR_BUILD_FOLDER
fi
test: off