forked from flet-dev/flet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.appveyor.yml
512 lines (424 loc) · 15.7 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
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
version: 0.0.{build}
skip_branch_with_pr: true
skip_commits:
files:
- docs/**/*
- media/**/*
- "*.md"
environment:
python_stack: python 3.12
FLUTTER_VERSION: 3.24.4
GITHUB_TOKEN:
secure: 9SKIwc3VSfYJ5IChvNR74hQprJ0DRmcV9pPX+8KyE6IXIdfMsX6ikeUmMhJGRu3ztkZaF45jmU7Xn/6tauXQXhDBxK1N8kFHFSAnq6LjUXyhS0TZKX/H+jDozBeVbCXp
TWINE_USERNAME: __token__
TWINE_PASSWORD:
secure: 174ncAbF5IjSIkmioPt62jeSnzmTlRNchUkE4QdjDWH8xK1olYtySXLJpo2q95HcP7lWJky1hv4APESiRRHnBWoY0XRFafzM/mbCDMzG1tZXiXZmpP1qzHAtRP2QSCIg18xh1TMktraUdTi7sbJnjjRhqzgbW1k0kLBxKw79MPFBhYQ/TiGcmaYWZbWVZNY3HCUCb6Dt7bG1OE2Ul9rD1gvs55xwO9Oq9FOVA1VnMYw=
TWINE_NON_INTERACTIVE: true
GEMFURY_TOKEN:
secure: trYGM65OQ1+HYnOYOe/NOHrofLpP3bz64nHwVWPJhiUIYll3MrrQd7ilFNp+zSkI
matrix:
- job_name: Build Flet package for Flutter
job_group: build_flet_package
APPVEYOR_BUILD_WORKER_IMAGE: ubuntu
- job_name: Build Flet for Windows
job_group: build_flet
job_depends_on: build_flet_package
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
- job_name: Build Flet for macOS
job_group: build_flet
job_depends_on: build_flet_package
APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
- job_name: Build Flet for Linux
job_group: build_flet_linux
job_depends_on: build_flet_package
ARCH: amd64
PACKAGE_NAME: flet-desktop
APPVEYOR_BUILD_WORKER_IMAGE: ubuntu2004
- job_name: Build Flet Light for Linux
job_group: build_flet_linux
job_depends_on: build_flet_package
ARCH: amd64
PACKAGE_NAME: flet-desktop-light
APPVEYOR_BUILD_WORKER_IMAGE: ubuntu2004
- job_name: Build Flet for Linux ARM64
job_group: build_flet_linux
job_depends_on: build_flet_package
ARCH: arm64
PACKAGE_NAME: flet-desktop
python_stack: python 3.10
APPVEYOR_BUILD_WORKER_IMAGE: ubuntu2004-arm
- job_name: Build Flet Light for Linux ARM64
job_group: build_flet_linux
job_depends_on: build_flet_package
ARCH: arm64
PACKAGE_NAME: flet-desktop-light
python_stack: python 3.10
APPVEYOR_BUILD_WORKER_IMAGE: ubuntu2004-arm
- job_name: Build Flet for web
job_group: build_flet
job_depends_on: build_flet_package
APPVEYOR_BUILD_WORKER_IMAGE: ubuntu2004
- job_name: Test Python 3.8
job_group: python_tests
python_stack: python 3.8
APPVEYOR_BUILD_WORKER_IMAGE: ubuntu2004
- job_name: Test Python 3.9
job_group: python_tests
python_stack: python 3.9
APPVEYOR_BUILD_WORKER_IMAGE: ubuntu2004
- job_name: Test Python 3.10
job_group: python_tests
python_stack: python 3.10
APPVEYOR_BUILD_WORKER_IMAGE: ubuntu2004
- job_name: Test Python 3.11
job_group: python_tests
python_stack: python 3.11
APPVEYOR_BUILD_WORKER_IMAGE: ubuntu2004
- job_name: Test Python 3.12
job_group: python_tests
python_stack: python 3.12
APPVEYOR_BUILD_WORKER_IMAGE: ubuntu2004
- job_name: Test Python 3.13
job_group: python_tests
python_stack: python 3.13
APPVEYOR_BUILD_WORKER_IMAGE: ubuntu2004
- job_name: Build Python wheels
job_group: python_build
job_depends_on: python_tests, build_flet, build_flet_linux
APPVEYOR_BUILD_WORKER_IMAGE: ubuntu2004
matrix:
fast_finish: true
stack: $python_stack
for:
# ======================================
# Build Flet package for Flutter
# ======================================
- matrix:
only:
- job_name: Build Flet package for Flutter
install:
- 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+1).0+$($env:APPVEYOR_BUILD_NUMBER)"
}
Update-AppveyorBuild -Version $env:PKG_VER
- python3 -m ensurepip --upgrade
- pip3 install --upgrade setuptools
- pip3 install pyyaml
- source ci/install_flutter.sh
build_script:
- 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
for dir in packages/flet*; do
echo "Patching $dir/pubspec.yaml"
python3 ci/patch_pubspec.py $dir/pubspec.yaml $PKG_VER
done
cd packages/flet
echo "Running flet tests"
flutter test || exit 1
dart pub publish --force || exit 1
cd $APPVEYOR_BUILD_FOLDER
sleep 120
for dir in packages/flet_*; do
cd "$dir"
echo "Publishing $dir package"
dart pub publish --force || exit 1
cd "$APPVEYOR_BUILD_FOLDER"
done
else
cd packages/flet
echo "Running flet tests"
flutter test || exit 1
dart pub publish --dry-run
cd $APPVEYOR_BUILD_FOLDER
for dir in packages/flet_*; do
cd "$dir"
echo "Dry-run publishing $dir package"
dart pub publish --dry-run
cd "$APPVEYOR_BUILD_FOLDER"
done
fi
# ======================================
# Build Flet Client for Windows
# ======================================
- matrix:
only:
- job_name: Build Flet for Windows
install:
- python --version
- pip3 install --upgrade setuptools wheel twine poetry tomlkit virtualenv
- dart pub global activate fvm
- set PATH=%LOCALAPPDATA%\Pub\Cache\bin;%USERPROFILE%\fvm\default\bin;%PATH%
- fvm install %FLUTTER_VERSION%
- fvm global %FLUTTER_VERSION%
- flutter --version
build_script:
- ps: $env:flet_sdk_root="$env:APPVEYOR_BUILD_FOLDER\sdk\python"
# patch version
- ps: |
$ErrorActionPreference = "Stop"
$env:PYPI_VER = $env:APPVEYOR_BUILD_VERSION.replace("+", ".dev")
$vp = "$env:flet_sdk_root/packages/flet-desktop/src/flet_desktop/version.py"; (Get-Content $vp).replace("version = `"`"", "version = `"$env:PYPI_VER`"") | Set-Content $vp
- python ci/patch_toml_versions.py %flet_sdk_root%/packages/flet-desktop/pyproject.toml %PYPI_VER%
- cd client
- set RELEASE_DIR=build\windows\x64\runner\Release
- flutter build windows --build-name=%APPVEYOR_BUILD_VERSION%
# - mkdir %RELEASE_DIR%
# - mkdir %RELEASE_DIR%\data
# - echo "Test!" > %RELEASE_DIR%\flet.bat
# - echo "Another thest!" > %RELEASE_DIR%\data\something.txt
- copy "%WINDIR%\system32\msvcp140.dll" %RELEASE_DIR%
- copy "%WINDIR%\system32\vcruntime140.dll" %RELEASE_DIR%
- copy "%WINDIR%\system32\vcruntime140_1.dll" %RELEASE_DIR%
- dir %RELEASE_DIR%
- ren build\windows\x64\runner\Release flet
- cd build\windows\x64\runner
- 7z a flet-windows.zip flet
- mkdir %flet_sdk_root%\packages\flet-desktop\src\flet_desktop\app
- xcopy flet %flet_sdk_root%\packages\flet-desktop\src\flet_desktop\app\flet\ /s /e
# install poetry env
- cd %flet_sdk_root%
- poetry install
# build "flet-desktop" package
- cd packages\flet-desktop
- poetry build
- ps: |
$ErrorActionPreference = "Continue"
Get-ChildItem -Path dist/*-py3-none-any.whl | ForEach-Object {
python $env:APPVEYOR_BUILD_FOLDER\ci\repackage_wheel_with_tag.py $_.FullName "py3-none-win_amd64"
python $env:APPVEYOR_BUILD_FOLDER\ci\repackage_wheel_with_tag.py $_.FullName "py3-none-win32"
Remove-Item $_.FullName
}
$ErrorActionPreference = "Stop"
- cd %APPVEYOR_BUILD_FOLDER%
- dir %flet_sdk_root%\packages\flet-desktop\dist
# publish
- ps: |
if (($env:APPVEYOR_REPO_BRANCH -eq "main" -or $env:APPVEYOR_REPO_TAG_NAME) -and (-not $env:APPVEYOR_PULL_REQUEST_NUMBER)) {
twine upload $env:flet_sdk_root\packages\flet-desktop\dist\*
} elseif (-not $env:APPVEYOR_PULL_REQUEST_NUMBER) {
$wheels = (Get-ChildItem $env:flet_sdk_root/packages/flet-desktop/dist/*.whl | Select-Object -ExpandProperty FullName)
foreach ($wheel in $wheels) {
curl.exe -sF package=@$wheel https://$env:GEMFURY_TOKEN@push.fury.io/flet/
}
}
test: off
artifacts:
- path: client\build\windows\x64\runner\flet-windows.zip
- path: sdk\python\packages\flet-desktop\dist\*.whl
deploy:
provider: GitHub
auth_token: $(GITHUB_TOKEN)
release: $(APPVEYOR_REPO_TAG_NAME)
artifact: flet_windows
on:
APPVEYOR_REPO_TAG: true
# ======================================
# Build Flet Client for macOS
# ======================================
- matrix:
only:
- job_name: Build Flet for macOS
install:
- . ci/common.sh
- HOMEBREW_NO_AUTO_UPDATE=1 brew install cocoapods
- source ci/install_flutter.sh
build_script:
# Flutter macOS client
- pushd client
- flutter build macos --build-name=$APPVEYOR_BUILD_VERSION
- tar -czvf flet-macos.tar.gz -C build/macos/Build/Products/Release Flet.app
- mkdir -p $flet_sdk_root/packages/flet-desktop/src/flet_desktop/app
- cp flet-macos.tar.gz $flet_sdk_root/packages/flet-desktop/src/flet_desktop/app
- popd
# Python package
- patch_python_package_versions
# install poetry env
- cd $flet_sdk_root
- poetry install
# build "flet-desktop" package
- pushd packages/flet-desktop
- poetry build
- sh: |
for file in dist/*-py3-none-any.whl; do
python $root/ci/repackage_wheel_with_tag.py $file "py3-none-macosx_12_0_arm64"
python $root/ci/repackage_wheel_with_tag.py $file "py3-none-macosx_10_14_x86_64"
rm $file
done
- popd
# publish
- publish_to_pypi packages/flet-desktop/dist/*.whl
artifacts:
- path: client/flet-macos.tar.gz
- path: sdk/python/packages/flet-desktop/dist/*.whl
deploy:
provider: GitHub
auth_token: $(GITHUB_TOKEN)
release: $(APPVEYOR_REPO_TAG_NAME)
on:
APPVEYOR_REPO_TAG: true
# ======================================
# Build Flet Client for Linux
# ======================================
- matrix:
only:
- job_group: build_flet_linux
install:
- . ci/common.sh
- sudo apt update --allow-releaseinfo-change
- sudo apt install -y clang libgtk-3-dev
- sh: |
if [[ "$PACKAGE_NAME" == "flet-desktop" ]]; then
sudo apt install -y libmpv-dev mpv 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
fi
- sh: |
if [[ "$ARCH" == "arm64" ]]; then
git clone https://github.com/flutter/flutter.git -b stable "$HOME/flutter"
export PATH="$PATH:$HOME/flutter/bin"
fi
- source ci/install_flutter.sh
build_script:
- pushd client
- sh: |
wheel_tags=(
"py3-none-manylinux_2_17_{arch},py3-none-manylinux2014_{arch}"
"py3-none-musllinux_1_2_{arch}"
)
if [[ "$ARCH" == "amd64" ]]; then
build_arch="x64"
platform_arch="x86_64"
else
build_arch="arm64"
platform_arch="aarch64"
fi
- sh: |
if [[ "$PACKAGE_NAME" == "flet-desktop-light" ]]; then
sed -i '/--FAT_CLIENT_START--/,/--FAT_CLIENT_END--/d' pubspec.yaml
sed -i '/--FAT_CLIENT_START--/,/--FAT_CLIENT_END--/d' lib/main.dart
patch_flet_desktop_package_name "flet-desktop-light"
artifact_suffix="-light"
fi
- flutter build linux --build-name=$APPVEYOR_BUILD_VERSION
- mv build/linux/$build_arch/release/bundle build/linux/$build_arch/release/flet
- tar -czvf flet-linux$artifact_suffix-$ARCH.tar.gz -C build/linux/$build_arch/release flet
- mkdir -p $flet_sdk_root/packages/flet-desktop/src/flet_desktop/app
- cp flet-linux$artifact_suffix-$ARCH.tar.gz $flet_sdk_root/packages/flet-desktop/src/flet_desktop/app/flet-linux-$ARCH.tar.gz
- popd
# Python package
- patch_python_package_versions
# install poetry env
- cd $flet_sdk_root
- poetry install
# build "flet-desktop" package
- pushd packages/flet-desktop
- poetry build
- sh: |
for file in dist/*-py3-none-any.whl; do
for tag in "${wheel_tags[@]}"; do
wheel_tag=$(echo "$tag" | sed "s/{arch}/$platform_arch/g")
python $root/ci/repackage_wheel_with_tag.py $file $wheel_tag
done
rm "$file"
done
- popd
# publish
- publish_to_pypi packages/flet-desktop/dist/*.whl
artifacts:
- path: client/flet-linux-*.tar.gz
- path: sdk/python/packages/flet-desktop/dist/*.whl
deploy:
provider: GitHub
auth_token: $(GITHUB_TOKEN)
release: $(APPVEYOR_REPO_TAG_NAME)
on:
APPVEYOR_REPO_TAG: true
# ======================================
# Build Flet for web
# ======================================
- matrix:
only:
- job_name: Build Flet for web
install:
- . ci/common.sh
- flutter upgrade --force
build_script:
# Flutter Web client
- pushd client
- flutter build web --release
- rm -rf build/web/canvaskit
- cp -R build/web $flet_sdk_root/packages/flet-web/src/flet_web
- popd
- tar -czvf client/build/flet-web.tar.gz -C client/build/web .
# Python package
- patch_python_package_versions
# install poetry env
- cd $flet_sdk_root
- poetry install
# build "flet-web" package
- pushd packages/flet-web
- poetry build
- popd
# publish
- publish_to_pypi packages/flet-web/dist/*.whl
artifacts:
- path: client/build/flet-web.tar.gz
- path: sdk/python/packages/flet-web/dist/*.whl
deploy:
provider: GitHub
auth_token: $(GITHUB_TOKEN)
release: $(APPVEYOR_REPO_TAG_NAME)
on:
APPVEYOR_REPO_TAG: true
######################
# Python Tests #
######################
- matrix:
only:
- job_group: python_tests
install:
- python --version
- cd sdk/python
- python -m ensurepip --upgrade
- pip3 install --upgrade setuptools pip virtualenv
- pip3 install poetry
- poetry install
build: off
test_script:
- poetry run pytest
######################
# Python Build #
######################
- matrix:
only:
- job_group: python_build
install:
- . ci/common.sh
test: off
build_script:
- patch_python_package_versions
# install poetry env
- cd $flet_sdk_root
- poetry install
# build "flet-cli" package
- pushd packages/flet-cli
- poetry build
- popd
# build "flet" package
- pushd packages/flet
- poetry build
- python $root/ci/update-flet-wheel-deps.py dist
- popd
# publish package
- |
publish_to_pypi \
packages/flet-cli/dist/*.whl \
packages/flet/dist/*.whl
artifacts:
- path: sdk/python/packages/flet-cli/dist/*
- path: sdk/python/packages/flet/dist/*