-
Notifications
You must be signed in to change notification settings - Fork 660
193 lines (171 loc) · 6.54 KB
/
Copy pathflet-build-test.yml
File metadata and controls
193 lines (171 loc) · 6.54 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
name: Flet Build Test
on:
push:
branches-ignore:
- main
paths:
- '.github/workflows/flet-build-test.yml'
- '.github/workflows/flet-build-test-matrix.yml'
- '.fvmrc'
- 'client/**'
- 'sdk/python/packages/**'
- 'packages/flet/**'
- 'sdk/python/examples/apps/flet_build_test/**'
pull_request:
paths:
- '.github/workflows/flet-build-test.yml'
- '.github/workflows/flet-build-test-matrix.yml'
- '.fvmrc'
- 'client/**'
- 'sdk/python/packages/**'
- 'packages/flet/**'
- 'sdk/python/examples/apps/flet_build_test/**'
workflow_dispatch:
inputs:
python_version:
description: "Bundled Python version to test"
type: choice
required: true
default: all
options:
- all
- "3.12"
- "3.13"
- "3.14"
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_PACK_EXTRA_ARGS: ${{ github.event_name == 'workflow_dispatch' && inputs.extra_pack_args || '' }}
jobs:
# The build matrix is split into one reusable-workflow call per supported
# bundled CPython release. This makes the Actions UI group jobs by Python
# version (each call renders as its own "Matrix: build" card) and lets
# `workflow_dispatch` target a single version via the `python_version`
# input. push/pull_request runs always fire all three.
build-3-12:
if: github.event_name != 'workflow_dispatch' || inputs.python_version == 'all' || inputs.python_version == '3.12'
name: Python 3.12
uses: ./.github/workflows/flet-build-test-matrix.yml
with:
python_version: "3.12"
extra_build_args: ${{ github.event_name == 'workflow_dispatch' && inputs.extra_build_args || '' }}
build-3-13:
if: github.event_name != 'workflow_dispatch' || inputs.python_version == 'all' || inputs.python_version == '3.13'
name: Python 3.13
uses: ./.github/workflows/flet-build-test-matrix.yml
with:
python_version: "3.13"
extra_build_args: ${{ github.event_name == 'workflow_dispatch' && inputs.extra_build_args || '' }}
build-3-14:
if: github.event_name != 'workflow_dispatch' || inputs.python_version == 'all' || inputs.python_version == '3.14'
name: Python 3.14
uses: ./.github/workflows/flet-build-test-matrix.yml
with:
python_version: "3.14"
extra_build_args: ${{ github.event_name == 'workflow_dispatch' && inputs.extra_build_args || '' }}
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-2025-vs2026
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
- name: Setup uv
uses: astral-sh/setup-uv@v8.2.0
- 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-cli flet --version --json | jq -r '.linux_dependencies | join(" ")')"
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@v7
with:
name: ${{ matrix.name }}-pack-artifact
path: sdk/python/examples/apps/flet_build_test/dist
if-no-files-found: error
overwrite: false