Skip to content

Commit ee55b01

Browse files
mhsmithhugovk
andauthored
Add Android support (#265)
Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent 45edac5 commit ee55b01

File tree

7 files changed

+311
-104
lines changed

7 files changed

+311
-104
lines changed

.github/workflows/source-and-docs-release.yml renamed to .github/workflows/build-release.yml

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ on:
3535
type: string
3636
description: "CPython release number (ie '3.11.5', note without the 'v' prefix)"
3737

38-
name: "Build Python source and docs artifacts"
38+
name: "Build release artifacts"
3939

4040
permissions: {}
4141

@@ -50,15 +50,20 @@ jobs:
5050
runs-on: ubuntu-24.04
5151
timeout-minutes: 5
5252
outputs:
53-
# Needed because env vars are not available in the build-docs check below
54-
cpython_release: ${{ env.CPYTHON_RELEASE }}
53+
build-docs: ${{ steps.select-jobs.outputs.docs }}
54+
build-android: ${{ steps.select-jobs.outputs.android }}
5555
steps:
5656
- name: "Workflow run information"
5757
run: |
5858
echo "git_remote: $GIT_REMOTE"
5959
echo "git_commit: $GIT_COMMIT"
6060
echo "cpython_release: $CPYTHON_RELEASE"
6161
62+
- name: "Checkout python/release-tools"
63+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
64+
with:
65+
persist-credentials: false
66+
6267
- name: "Checkout ${{ env.GIT_REMOTE }}/cpython"
6368
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6469
with:
@@ -74,6 +79,16 @@ jobs:
7479
exit 1
7580
fi
7681
82+
- name: "Setup Python"
83+
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
84+
with:
85+
python-version: 3.12
86+
87+
- name: "Select jobs"
88+
id: select-jobs
89+
run: |
90+
./select_jobs.py "$CPYTHON_RELEASE" | tee -a "$GITHUB_OUTPUT"
91+
7792
build-source:
7893
runs-on: ubuntu-24.04
7994
timeout-minutes: 15
@@ -120,9 +135,7 @@ jobs:
120135
timeout-minutes: 45
121136
needs:
122137
- verify-input
123-
124-
# Docs aren't built for alpha or beta releases.
125-
if: (!(contains(needs.verify-input.outputs.cpython_release, 'a') || contains(needs.verify-input.outputs.cpython_release, 'b')))
138+
if: fromJSON(needs.verify-input.outputs.build-docs)
126139
steps:
127140
- name: "Checkout ${{ env.GIT_REMOTE }}/cpython"
128141
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -189,3 +202,38 @@ jobs:
189202
190203
cd ../installation
191204
./bin/python3 -m test -uall
205+
206+
build-android:
207+
name: build-android (${{ matrix.arch }})
208+
needs:
209+
- verify-input
210+
if: fromJSON(needs.verify-input.outputs.build-android)
211+
212+
strategy:
213+
matrix:
214+
include:
215+
- arch: aarch64
216+
runs-on: macos-15
217+
- arch: x86_64
218+
runs-on: ubuntu-24.04
219+
220+
runs-on: ${{ matrix.runs-on }}
221+
timeout-minutes: 60
222+
env:
223+
triplet: ${{ matrix.arch }}-linux-android
224+
steps:
225+
- name: "Checkout ${{ env.GIT_REMOTE }}/cpython"
226+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
227+
with:
228+
persist-credentials: false
229+
repository: "${{ env.GIT_REMOTE }}/cpython"
230+
ref: "v${{ env.CPYTHON_RELEASE }}"
231+
232+
- name: Build and test
233+
run: ./Android/android.py ci "$triplet"
234+
235+
- uses: actions/upload-artifact@v4
236+
with:
237+
name: ${{ env.triplet }}
238+
path: cross-build/${{ env.triplet }}/dist/*
239+
if-no-files-found: error

0 commit comments

Comments
 (0)