Skip to content

Add Android support #265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,35 @@ on:
type: string
description: "CPython release number (ie '3.11.5', note without the 'v' prefix)"

name: "Build Python source and docs artifacts"
name: "Build Python release artifacts"

permissions: {}

# Set from inputs for workflow_dispatch, or set defaults to test push/PR events
env:
GIT_REMOTE: ${{ github.event.inputs.git_remote || 'python' }}
GIT_COMMIT: ${{ github.event.inputs.git_commit || '4f8bb3947cfbc20f970ff9d9531e1132a9e95396' }}
CPYTHON_RELEASE: ${{ github.event.inputs.cpython_release || '3.13.2' }}
GIT_REMOTE: ${{ github.event.inputs.git_remote || 'mhsmith' }}
GIT_COMMIT: ${{ github.event.inputs.git_commit || '7e87375eeff06e03a66209e506ce83c3f70ec57f' }}
CPYTHON_RELEASE: ${{ github.event.inputs.cpython_release || '3.15.0b991' }}

jobs:
verify-input:
runs-on: ubuntu-24.04
timeout-minutes: 5
outputs:
# Needed because env vars are not available in the build-docs check below
cpython_release: ${{ env.CPYTHON_RELEASE }}
build-docs: ${{ steps.select-jobs.outputs.docs }}
build-android: ${{ steps.select-jobs.outputs.android }}
steps:
- name: "Workflow run information"
run: |
echo "git_remote: $GIT_REMOTE"
echo "git_commit: $GIT_COMMIT"
echo "cpython_release: $CPYTHON_RELEASE"

- name: "Checkout python/release-tools"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false

- name: "Checkout ${{ env.GIT_REMOTE }}/cpython"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
Expand All @@ -74,6 +79,19 @@ jobs:
exit 1
fi

- name: "Setup Python"
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: 3.12

- name: "Install dependencies"
run: python -m pip install --no-deps -r requirements.txt

- name: "Select jobs"
id: select-jobs
run: |
./select_jobs.py "$CPYTHON_RELEASE" >> "$GITHUB_OUTPUT"

build-source:
runs-on: ubuntu-24.04
timeout-minutes: 15
Expand Down Expand Up @@ -120,9 +138,7 @@ jobs:
timeout-minutes: 45
needs:
- verify-input

# Docs aren't built for alpha or beta releases.
if: (!(contains(needs.verify-input.outputs.cpython_release, 'a') || contains(needs.verify-input.outputs.cpython_release, 'b')))
if: fromJSON(needs.verify-input.outputs.build-docs)
steps:
- name: "Checkout ${{ env.GIT_REMOTE }}/cpython"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down Expand Up @@ -189,3 +205,38 @@ jobs:

cd ../installation
./bin/python3 -m test -uall

build-android:
name: build-android (${{ matrix.arch }})
needs:
- verify-input
if: fromJSON(needs.verify-input.outputs.build-android)

strategy:
matrix:
include:
- arch: aarch64
runs-on: macos-15
- arch: x86_64
runs-on: ubuntu-24.04

runs-on: ${{ matrix.runs-on }}
timeout-minutes: 60
env:
triplet: ${{ matrix.arch }}-linux-android
steps:
- name: "Checkout ${{ env.GIT_REMOTE }}/cpython"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
repository: "${{ env.GIT_REMOTE }}/cpython"
ref: "v${{ env.CPYTHON_RELEASE }}"

- name: Build and test
run: ./Android/android.py ci "$triplet"

- uses: actions/upload-artifact@v4
with:
name: ${{ env.triplet }}
path: cross-build/${{ env.triplet }}/dist/*
if-no-files-found: error
Loading
Loading