-
Notifications
You must be signed in to change notification settings - Fork 651
308 lines (269 loc) · 9.9 KB
/
flet-build-test.yml
File metadata and controls
308 lines (269 loc) · 9.9 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
name: Flet Build Test
on:
push:
branches-ignore:
- main
paths:
- '.github/workflows/flet-build-test.yml'
- '.fvmrc'
- 'client/**'
- 'sdk/python/packages/**'
- 'packages/flet/**'
- 'sdk/python/examples/apps/flet_build_test/**'
pull_request:
paths:
- '.github/workflows/flet-build-test.yml'
- '.fvmrc'
- 'client/**'
- 'sdk/python/packages/**'
- 'packages/flet/**'
- 'sdk/python/examples/apps/flet_build_test/**'
workflow_dispatch:
inputs:
extra_build_args:
description: "Extra CLI args appended to `flet build` command (ex: --template-ref 0.1.0)"
required: false
default: ""
extra_pack_args:
description: "Extra CLI args appended to `flet pack` command (ex: --icon path/to/icon)"
required: false
default: ""
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.head.ref || github.ref_name }}
cancel-in-progress: true
env:
ROOT: "${{ github.workspace }}"
SDK_PYTHON: "${{ github.workspace }}/sdk/python"
SCRIPTS: "${{ github.workspace }}/.github/scripts"
UV_PYTHON: 3.12
PYTHONUTF8: 1
# https://flet.dev/docs/reference/environment-variables
FLET_CLI_NO_RICH_OUTPUT: 1
# Extra args passed via workflow_dispatch (empty for push/PR)
FLET_BUILD_EXTRA_ARGS: ${{ github.event_name == 'workflow_dispatch' && inputs.extra_build_args || '' }}
FLET_PACK_EXTRA_ARGS: ${{ github.event_name == 'workflow_dispatch' && inputs.extra_pack_args || '' }}
jobs:
build:
name: Build (${{ matrix.name }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
# -------- Desktop --------
- name: linux
runner: ubuntu-latest
build_cmd: "flet build linux"
artifact_name: linux-build-artifact
artifact_path: build/linux
needs_linux_deps: true
- name: macos
runner: macos-26
build_cmd: "flet build macos"
artifact_name: macos-build-artifact
artifact_path: build/macos
needs_linux_deps: false
- name: windows
runner: windows-latest
build_cmd: "flet build windows"
artifact_name: windows-build-artifact
artifact_path: build/windows
needs_linux_deps: false
# -------- Android --------
- name: aab-ubuntu
runner: ubuntu-latest
build_cmd: "flet build aab"
artifact_name: aab-build-ubuntu-artifact
artifact_path: build/aab
needs_linux_deps: false
- name: aab-macos
runner: macos-26
build_cmd: "flet build aab"
artifact_name: aab-build-macos-artifact
artifact_path: build/aab
needs_linux_deps: false
- name: aab-windows
runner: windows-latest
build_cmd: "flet build aab"
artifact_name: aab-build-windows-artifact
artifact_path: build/aab
needs_linux_deps: false
- name: apk-ubuntu
runner: ubuntu-latest
build_cmd: "flet build apk"
artifact_name: apk-build-ubuntu-artifact
artifact_path: build/apk
needs_linux_deps: false
- name: apk-macos
runner: macos-26
build_cmd: "flet build apk"
artifact_name: apk-build-macos-artifact
artifact_path: build/apk
needs_linux_deps: false
- name: apk-windows
runner: windows-latest
build_cmd: "flet build apk"
artifact_name: apk-build-windows-artifact
artifact_path: build/apk
needs_linux_deps: false
# -------- iOS --------
- name: ipa
runner: macos-26
build_cmd: "flet build ipa"
artifact_name: ipa-build-artifact
artifact_path: build/ipa
needs_linux_deps: false
- name: ios-simulator
runner: macos-26
build_cmd: "flet build ios-simulator"
artifact_name: ios-simulator-build-artifact
artifact_path: build/ios-simulator
needs_linux_deps: false
# -------- Web --------
- name: web-ubuntu
runner: ubuntu-latest
build_cmd: "flet build web"
artifact_name: web-build-ubuntu-artifact
artifact_path: build/web
needs_linux_deps: false
- name: web-macos
runner: macos-26
build_cmd: "flet build web"
artifact_name: web-build-macos-artifact
artifact_path: build/web
needs_linux_deps: false
- name: web-windows
runner: windows-latest
build_cmd: "flet build web"
artifact_name: web-build-windows-artifact
artifact_path: build/web
needs_linux_deps: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Setup uv
uses: astral-sh/setup-uv@v6
- name: Patch versions
shell: bash
run: |
source "${SCRIPTS}/update_build_version.sh"
source "${SCRIPTS}/common.sh"
patch_python_package_versions
- name: Install Linux dependencies
if: matrix.needs_linux_deps
shell: bash
run: |
sudo apt update --allow-releaseinfo-change
LINUX_DEPS="$(uv run --project sdk/python/packages/flet python -c 'from flet.utils.linux_deps import linux_dependencies; print(" ".join(linux_dependencies))')"
sudo apt-get install -y --no-install-recommends $LINUX_DEPS
sudo apt-get clean
- name: Setup Flutter
uses: kuhnroyal/flutter-fvm-config-action/setup@v3
with:
path: '.fvmrc'
cache: true
- name: Build app
shell: bash
working-directory: sdk/python/examples/apps/flet_build_test
run: |
echo "FLET_BUILD_EXTRA_ARGS='${FLET_BUILD_EXTRA_ARGS}'"
uv run ${{ matrix.build_cmd }} --yes --verbose --build-number ${{ github.run_number }} $FLET_BUILD_EXTRA_ARGS
- name: Upload Artifact
uses: actions/upload-artifact@v5.0.0
with:
name: ${{ matrix.artifact_name }}
path: sdk/python/examples/apps/flet_build_test/${{ matrix.artifact_path }}
if-no-files-found: error
overwrite: false
pack:
name: Pack (${{ matrix.name }})
runs-on: ${{ matrix.runner }}
env:
FLET_DESKTOP_FLAVOR: full
strategy:
fail-fast: false
matrix:
include:
- name: linux
runner: ubuntu-latest
- name: macos
runner: macos-26
- name: windows
runner: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Setup uv
uses: astral-sh/setup-uv@v6
- name: Setup Flutter
uses: kuhnroyal/flutter-fvm-config-action/setup@v3
with:
path: '.fvmrc'
cache: true
- name: Patch versions
shell: bash
run: |
source "${SCRIPTS}/update_build_version.sh"
source "${SCRIPTS}/common.sh"
patch_python_package_versions
- name: Install Linux dependencies
if: matrix.name == 'linux'
shell: bash
run: |
sudo apt update --allow-releaseinfo-change
LINUX_DEPS="$(uv run --project sdk/python/packages/flet python -c 'from flet.utils.linux_deps import linux_dependencies; print(" ".join(linux_dependencies))')"
sudo apt-get install -y --no-install-recommends $LINUX_DEPS
sudo apt-get clean
- name: Prepare local desktop client archive
shell: bash
run: |
set -euo pipefail
APP_DIR="${SDK_PYTHON}/packages/flet-desktop/src/flet_desktop/app"
mkdir -p "${APP_DIR}"
rm -rf "${APP_DIR:?}"/*
pushd client
case "${{ matrix.name }}" in
linux)
flutter build linux --build-name="$PKG_VER" --build-number="$BUILD_NUM"
rm -rf build/linux/x64/release/flet
mv build/linux/x64/release/bundle build/linux/x64/release/flet
tar -czvf "${APP_DIR}/flet-linux-ubuntu24.04-amd64.tar.gz" -C build/linux/x64/release flet
;;
macos)
flutter build macos --build-name="$PKG_VER" --build-number="$BUILD_NUM"
tar -czvf "${APP_DIR}/flet-macos.tar.gz" -C build/macos/Build/Products/Release Flet.app
;;
windows)
flutter build windows --build-name="$PKG_VER" --build-number="$BUILD_NUM"
RUNNER_DIR="${ROOT}/client/build/windows/x64/runner"
RELEASE_DIR="${RUNNER_DIR}/Release"
cp "${WINDIR}/system32/msvcp140.dll" "$RELEASE_DIR"
cp "${WINDIR}/system32/vcruntime140.dll" "$RELEASE_DIR"
cp "${WINDIR}/system32/vcruntime140_1.dll" "$RELEASE_DIR"
rm -rf "${RUNNER_DIR}/flet"
mv "$RELEASE_DIR" "${RUNNER_DIR}/flet"
pushd "${RUNNER_DIR}"
7z a "${APP_DIR}/flet-windows.zip" "flet"
popd
;;
esac
popd
- name: Pack app
shell: bash
working-directory: sdk/python/examples/apps/flet_build_test
run: |
echo "FLET_PACK_EXTRA_ARGS='${FLET_PACK_EXTRA_ARGS}'"
uv run --with pyinstaller flet pack src/main.py --yes --name flet-pack-test --distpath dist $FLET_PACK_EXTRA_ARGS
- name: Upload Artifact
uses: actions/upload-artifact@v5.0.0
with:
name: ${{ matrix.name }}-pack-artifact
path: sdk/python/examples/apps/flet_build_test/dist
if-no-files-found: error
overwrite: false