Skip to content

Commit 2481990

Browse files
authored
Merge pull request #1 from cfms-dev/copilot/modify-appveyor-to-github-actions
Migrate CI from AppVeyor to GitHub Actions with Python 3.14 support
1 parent 324ef8d commit 2481990

File tree

8 files changed

+368
-10
lines changed

8 files changed

+368
-10
lines changed
File renamed without changes.

.github/workflows/build-python.yml

Lines changed: 267 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,267 @@
1+
name: Build Python for Multiple Platforms
2+
3+
on:
4+
push:
5+
branches:
6+
- 'python-3.*'
7+
- 'main'
8+
pull_request:
9+
branches:
10+
- 'python-3.*'
11+
- 'main'
12+
workflow_dispatch:
13+
14+
env:
15+
PYTHON_VERSION: 3.14.0
16+
PYTHON_VERSION_SHORT: 3.14
17+
PYTHON_DIST_RELEASE: 20251007
18+
19+
jobs:
20+
# ======================================
21+
# Build Python for Android
22+
# ======================================
23+
build-android:
24+
name: Build Python for Android
25+
runs-on: ubuntu-latest
26+
permissions:
27+
contents: write # Required for uploading to releases
28+
env:
29+
NDK_VERSION: r27
30+
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
35+
- name: Set up Python
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version: '3.14'
39+
40+
- name: Verify Python version
41+
run: python --version
42+
43+
- name: Build all Python ABIs
44+
run: |
45+
cd android
46+
./build-all.sh ${{ env.PYTHON_VERSION }}
47+
48+
- name: Package support package for mobile-forge
49+
run: |
50+
cd android
51+
mkdir -p dist
52+
tar -czf dist/python-android-mobile-forge-${{ env.PYTHON_VERSION_SHORT }}.tar.gz install support
53+
54+
- name: Package individual ABIs for Flutter
55+
run: |
56+
cd android
57+
./package-for-dart.sh install ${{ env.PYTHON_VERSION }} arm64-v8a
58+
./package-for-dart.sh install ${{ env.PYTHON_VERSION }} x86_64
59+
60+
- name: Upload Android artifacts
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: python-android
64+
path: android/dist/python-android-*.tar.gz
65+
if-no-files-found: error
66+
67+
- name: Deploy to GitHub Release
68+
if: startsWith(github.ref, 'refs/tags/v')
69+
uses: softprops/action-gh-release@v2
70+
with:
71+
files: android/dist/python-android-*.tar.gz
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
75+
# ======================================
76+
# Build Python for iOS and macOS
77+
# ======================================
78+
build-darwin:
79+
name: Build Python for iOS and macOS
80+
runs-on: macos-latest
81+
permissions:
82+
contents: write # Required for uploading to releases
83+
84+
steps:
85+
- name: Checkout code
86+
uses: actions/checkout@v4
87+
88+
- name: Set up Python
89+
uses: actions/setup-python@v5
90+
with:
91+
python-version: '3.14'
92+
93+
- name: Verify Python version
94+
run: python --version
95+
96+
- name: Clone Python-Apple-support
97+
run: |
98+
cd darwin
99+
git clone --branch=${{ env.PYTHON_VERSION_SHORT }} https://github.com/beeware/Python-Apple-support.git
100+
mkdir -p dist
101+
102+
- name: Build Python for iOS
103+
run: |
104+
cd darwin/Python-Apple-support
105+
make iOS
106+
107+
- name: Package iOS for mobile-forge
108+
run: |
109+
cd darwin
110+
tar -czf dist/python-ios-mobile-forge-${{ env.PYTHON_VERSION_SHORT }}.tar.gz \
111+
-C Python-Apple-support install support
112+
113+
- name: Build Python for macOS
114+
run: |
115+
cd darwin/Python-Apple-support
116+
make macOS
117+
118+
- name: Package for Dart - iOS
119+
run: |
120+
cd darwin
121+
./package-ios-for-dart.sh Python-Apple-support ${{ env.PYTHON_VERSION_SHORT }}
122+
123+
- name: Package for Dart - macOS
124+
run: |
125+
cd darwin
126+
./package-macos-for-dart.sh Python-Apple-support ${{ env.PYTHON_VERSION_SHORT }}
127+
128+
- name: Upload Darwin artifacts
129+
uses: actions/upload-artifact@v4
130+
with:
131+
name: python-darwin
132+
path: darwin/dist/python-*.tar.gz
133+
if-no-files-found: error
134+
135+
- name: Deploy to GitHub Release
136+
if: startsWith(github.ref, 'refs/tags/v')
137+
uses: softprops/action-gh-release@v2
138+
with:
139+
files: darwin/dist/python-*.tar.gz
140+
env:
141+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
142+
143+
# ======================================
144+
# Build Python for Linux
145+
# ======================================
146+
build-linux:
147+
name: Build Python for Linux
148+
runs-on: ubuntu-latest
149+
permissions:
150+
contents: write # Required for uploading to releases
151+
152+
steps:
153+
- name: Checkout code
154+
uses: actions/checkout@v4
155+
156+
- name: Set up Python
157+
uses: actions/setup-python@v5
158+
with:
159+
python-version: '3.14'
160+
161+
- name: Verify Python version
162+
run: python --version
163+
164+
- name: Install rsync
165+
run: sudo apt-get update && sudo apt-get install -y rsync
166+
167+
- name: Build Python for Linux x86_64
168+
run: |
169+
cd linux
170+
./package-for-linux.sh x86_64 "_v2"
171+
env:
172+
PYTHON_VERSION: ${{ env.PYTHON_VERSION }}
173+
PYTHON_VERSION_SHORT: ${{ env.PYTHON_VERSION_SHORT }}
174+
PYTHON_DIST_RELEASE: ${{ env.PYTHON_DIST_RELEASE }}
175+
176+
- name: Build Python for Linux aarch64
177+
run: |
178+
cd linux
179+
./package-for-linux.sh aarch64 ""
180+
env:
181+
PYTHON_VERSION: ${{ env.PYTHON_VERSION }}
182+
PYTHON_VERSION_SHORT: ${{ env.PYTHON_VERSION_SHORT }}
183+
PYTHON_DIST_RELEASE: ${{ env.PYTHON_DIST_RELEASE }}
184+
185+
- name: List built archives
186+
run: |
187+
cd linux
188+
ls -lh python-linux-dart-*.tar.gz
189+
190+
- name: Upload Linux artifacts
191+
uses: actions/upload-artifact@v4
192+
with:
193+
name: python-linux
194+
path: linux/python-linux-dart-*.tar.gz
195+
if-no-files-found: error
196+
197+
- name: Deploy to GitHub Release
198+
if: startsWith(github.ref, 'refs/tags/v')
199+
uses: softprops/action-gh-release@v2
200+
with:
201+
files: linux/python-linux-dart-*.tar.gz
202+
env:
203+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
204+
205+
# ======================================
206+
# Build Python for Windows
207+
# ======================================
208+
build-windows:
209+
name: Build Python for Windows
210+
runs-on: windows-latest
211+
permissions:
212+
contents: write # Required for uploading to releases
213+
214+
steps:
215+
- name: Checkout code
216+
uses: actions/checkout@v4
217+
218+
- name: Set up Python
219+
uses: actions/setup-python@v5
220+
with:
221+
python-version: '3.14'
222+
223+
- name: Verify Python version
224+
run: python --version
225+
226+
- name: Download Python installer
227+
run: |
228+
cd windows
229+
INSTALLER_URL="https://www.python.org/ftp/python/${{ env.PYTHON_VERSION }}"
230+
curl -OL "${INSTALLER_URL}/python-${{ env.PYTHON_VERSION }}-amd64.exe"
231+
shell: bash
232+
233+
- name: Install Python
234+
run: |
235+
cd windows
236+
Start-Process -Wait -FilePath "python-${{ env.PYTHON_VERSION }}-amd64.exe" `
237+
-ArgumentList "/quiet", "InstallAllUsers=1", "PrependPath=1", `
238+
"Include_test=0", "TargetDir=C:\hostedtoolcache\windows\Python\3.14.0\x64"
239+
shell: powershell
240+
241+
- name: Verify installation and compile bytecode
242+
run: |
243+
dir C:\hostedtoolcache\windows\Python\3.14.0\x64
244+
C:\hostedtoolcache\windows\Python\3.14.0\x64\python.exe --version
245+
C:\hostedtoolcache\windows\Python\3.14.0\x64\python.exe -m compileall -b C:\hostedtoolcache\windows\Python\3.14.0\x64\Lib
246+
shell: cmd
247+
248+
- name: Create archive
249+
run: |
250+
cd windows
251+
7z a -xr@exclude.txt python-windows-for-dart-${{ env.PYTHON_VERSION_SHORT }}.zip C:\hostedtoolcache\windows\Python\3.14.0\x64*
252+
shell: cmd
253+
254+
- name: Upload Windows artifacts
255+
uses: actions/upload-artifact@v4
256+
with:
257+
name: python-windows
258+
path: windows/python-windows-for-dart-*.zip
259+
if-no-files-found: error
260+
261+
- name: Deploy to GitHub Release
262+
if: startsWith(github.ref, 'refs/tags/v')
263+
uses: softprops/action-gh-release@v2
264+
with:
265+
files: windows/python-windows-for-dart-*.zip
266+
env:
267+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Binaries and executables
2+
actionlint
3+
4+
# Build artifacts
5+
*.tar.gz
6+
*.zip
7+
dist/
8+
build/
9+
install/
10+
support/
11+
12+
# Python
13+
__pycache__/
14+
*.py[cod]
15+
*$py.class
16+
*.so
17+
.Python
18+
19+
# IDEs
20+
.vscode/
21+
.idea/
22+
*.swp
23+
*.swo
24+
*~
25+
26+
# OS
27+
.DS_Store
28+
Thumbs.db

README.md

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,62 @@
11
# python-build
2-
Building Python for Android and iOS
2+
3+
Building Python for Android, iOS, macOS, Linux, and Windows
4+
5+
## Overview
6+
7+
This repository contains build scripts and GitHub Actions workflows for building Python 3.14 for multiple platforms:
8+
- **Android**: All ABIs (arm64-v8a, armeabi-v7a, x86_64, x86)
9+
- **Darwin**: iOS and macOS
10+
- **Linux**: x86_64 and aarch64
11+
- **Windows**: amd64
12+
13+
## Build Status
14+
15+
Builds are automated using GitHub Actions. The workflow is triggered on:
16+
- Pushes to branches matching `python-3.*` or `main`
17+
- Pull requests to branches matching `python-3.*` or `main`
18+
- Manual workflow dispatch
19+
20+
## Build Artifacts
21+
22+
Build artifacts are automatically uploaded for each platform and can be downloaded from:
23+
- GitHub Actions workflow runs (for development builds)
24+
- GitHub Releases (for tagged releases)
25+
26+
### Release Process
27+
28+
To create a release:
29+
1. Tag a commit with the version format: `v3.14` (matching `PYTHON_VERSION_SHORT`)
30+
2. Push the tag to GitHub
31+
3. GitHub Actions will automatically build all platforms and create a release with artifacts
32+
33+
## Platform-Specific Details
34+
35+
### Android
36+
- Uses Android NDK r27
37+
- Builds all standard ABIs
38+
- Creates packages for mobile-forge and Flutter/Dart
39+
40+
### Darwin (iOS/macOS)
41+
- Uses BeeWare's Python-Apple-support
42+
- Builds both iOS and macOS frameworks
43+
- Packages for Flutter/Dart integration
44+
45+
### Linux
46+
- Uses python-build-standalone from Astral
47+
- Builds for x86_64 and aarch64 architectures
48+
- Creates stripped install-only packages
49+
50+
### Windows
51+
- Downloads official Python installer
52+
- Creates custom distribution for Flutter/Dart
53+
- Compiles Python bytecode for distribution
54+
55+
## Migration from AppVeyor
56+
57+
This repository previously used AppVeyor for CI/CD. The migration to GitHub Actions provides:
58+
- Better integration with GitHub
59+
- Faster build times
60+
- More flexible workflow configuration
61+
- Native support for all platforms
62+

android/abi-to-host.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
case ${abi:?} in
2-
armeabi-v7a)
3-
HOST=arm-linux-androideabi
4-
;;
2+
# armeabi-v7a)
3+
# # HOST=arm-linux-androideabi
4+
# HOST=aarch64-linux-android
5+
# ;;
56
arm64-v8a)
67
HOST=aarch64-linux-android
78
;;
8-
x86)
9-
HOST=i686-linux-android
10-
;;
9+
# x86)
10+
# HOST=i686-linux-android
11+
# ;;
1112
x86_64)
1213
HOST=x86_64-linux-android
1314
;;

android/build-all.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
set -eu
33

44
python_version=${1:?}
5-
abis="arm64-v8a armeabi-v7a x86_64 x86"
5+
abis="arm64-v8a x86_64"
6+
# abis="arm64-v8a armeabi-v7a x86_64 x86"
7+
68

79
for abi in $abis; do
810
./build.sh $python_version $abi

0 commit comments

Comments
 (0)