forked from flet-dev/python-build
-
Notifications
You must be signed in to change notification settings - Fork 0
269 lines (226 loc) · 8 KB
/
build-python.yml
File metadata and controls
269 lines (226 loc) · 8 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
name: Build Python for Multiple Platforms
on:
push:
# branches:
# - 'python-3.*'
# - 'main'
tags:
- "v*.*"
pull_request:
branches:
- 'python-3.*'
- 'main'
workflow_dispatch:
env:
PYTHON_VERSION: 3.14.2
PYTHON_VERSION_SHORT: 3.14
PYTHON_DIST_RELEASE: 20251209
jobs:
# ======================================
# Build Python for Android
# ======================================
build-android:
name: Build Python for Android
runs-on: ubuntu-latest
permissions:
contents: write # Required for uploading to releases
env:
NDK_VERSION: r27
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION_SHORT }}
- name: Verify Python version
run: python --version
- name: Build all Python ABIs
run: |
cd android
./build-all.sh ${{ env.PYTHON_VERSION }}
- name: Package support package for mobile-forge
run: |
cd android
mkdir -p dist
tar -czf dist/python-android-mobile-forge-${{ env.PYTHON_VERSION_SHORT }}.tar.gz install support
- name: Package individual ABIs for Flutter
run: |
cd android
./package-for-dart.sh install ${{ env.PYTHON_VERSION }} arm64-v8a
./package-for-dart.sh install ${{ env.PYTHON_VERSION }} x86_64
- name: Upload Android artifacts
uses: actions/upload-artifact@v4
with:
name: python-android
path: android/dist/python-android-*.tar.gz
if-no-files-found: error
- name: Deploy to GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: android/dist/python-android-*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ======================================
# Build Python for iOS and macOS
# ======================================
build-darwin:
name: Build Python for iOS and macOS
runs-on: macos-latest
permissions:
contents: write # Required for uploading to releases
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION_SHORT }}
- name: Verify Python version
run: python --version
- name: Clone Python-Apple-support
run: |
cd darwin
git clone --branch=${{ env.PYTHON_VERSION_SHORT }} https://github.com/beeware/Python-Apple-support.git
mkdir -p dist
- name: Build Python for iOS
run: |
cd darwin/Python-Apple-support
make iOS
- name: Package iOS for mobile-forge
run: |
cd darwin
tar -czf dist/python-ios-mobile-forge-${{ env.PYTHON_VERSION_SHORT }}.tar.gz \
-C Python-Apple-support install support
- name: Build Python for macOS
run: |
cd darwin/Python-Apple-support
make macOS
- name: Package for Dart - iOS
run: |
cd darwin
./package-ios-for-dart.sh Python-Apple-support ${{ env.PYTHON_VERSION_SHORT }}
- name: Package for Dart - macOS
run: |
cd darwin
./package-macos-for-dart.sh Python-Apple-support ${{ env.PYTHON_VERSION_SHORT }}
- name: Upload Darwin artifacts
uses: actions/upload-artifact@v4
with:
name: python-darwin
path: darwin/dist/python-*.tar.gz
if-no-files-found: error
- name: Deploy to GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: darwin/dist/python-*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ======================================
# Build Python for Linux
# ======================================
build-linux:
name: Build Python for Linux
runs-on: ubuntu-latest
permissions:
contents: write # Required for uploading to releases
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION_SHORT }}
- name: Verify Python version
run: python --version
- name: Install rsync
run: sudo apt-get update && sudo apt-get install -y rsync
- name: Build Python for Linux x86_64
run: |
cd linux
./package-for-linux.sh x86_64 "_v2"
env:
PYTHON_VERSION: ${{ env.PYTHON_VERSION }}
PYTHON_VERSION_SHORT: ${{ env.PYTHON_VERSION_SHORT }}
PYTHON_DIST_RELEASE: ${{ env.PYTHON_DIST_RELEASE }}
- name: Build Python for Linux aarch64
run: |
cd linux
./package-for-linux.sh aarch64 ""
env:
PYTHON_VERSION: ${{ env.PYTHON_VERSION }}
PYTHON_VERSION_SHORT: ${{ env.PYTHON_VERSION_SHORT }}
PYTHON_DIST_RELEASE: ${{ env.PYTHON_DIST_RELEASE }}
- name: List built archives
run: |
cd linux
ls -lh python-linux-dart-*.tar.gz
- name: Upload Linux artifacts
uses: actions/upload-artifact@v4
with:
name: python-linux
path: linux/python-linux-dart-*.tar.gz
if-no-files-found: error
- name: Deploy to GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: linux/python-linux-dart-*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ======================================
# Build Python for Windows
# ======================================
build-windows:
name: Build Python for Windows
runs-on: windows-latest
permissions:
contents: write # Required for uploading to releases
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION_SHORT }}
- name: Verify Python version
run: python --version
- name: Download Python installer
run: |
cd windows
INSTALLER_URL="https://www.python.org/ftp/python/${{ env.PYTHON_VERSION }}"
curl -OL "${INSTALLER_URL}/python-${{ env.PYTHON_VERSION }}-amd64.exe"
shell: bash
- name: Install Python
run: |
cd windows
Start-Process -Wait -FilePath "python-${{ env.PYTHON_VERSION }}-amd64.exe" `
-ArgumentList "/quiet", "InstallAllUsers=1", "PrependPath=1", `
"Include_test=0", "TargetDir=C:\hostedtoolcache\windows\Python\${{ env.PYTHON_VERSION }}\x64"
shell: powershell
- name: Verify installation and compile bytecode
run: |
dir C:\hostedtoolcache\windows\Python\${{ env.PYTHON_VERSION }}\x64
C:\hostedtoolcache\windows\Python\${{ env.PYTHON_VERSION }}\x64\python.exe --version
C:\hostedtoolcache\windows\Python\${{ env.PYTHON_VERSION }}\x64\python.exe -m compileall -b C:\hostedtoolcache\windows\Python\${{ env.PYTHON_VERSION }}\x64\Lib
shell: cmd
- name: Create archive
run: |
cd windows
7z a -xr@exclude.txt python-windows-for-dart-${{ env.PYTHON_VERSION }}.zip C:\hostedtoolcache\windows\Python\${{ env.PYTHON_VERSION }}\x64\*
shell: cmd
- name: Upload Windows artifacts
uses: actions/upload-artifact@v4
with:
name: python-windows
path: windows/python-windows-for-dart-*.zip
if-no-files-found: error
- name: Deploy to GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: windows/python-windows-for-dart-*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}