-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
gh-137242: Add Android CI job #137186
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
Open
mhsmith
wants to merge
18
commits into
python:main
Choose a base branch
from
mhsmith:android-ci
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+134
−23
Open
gh-137242: Add Android CI job #137186
Changes from 7 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
97ffb3e
Add Android CI job
mhsmith bd7b642
Add `shell` to each step of the composite action
mhsmith 1d8dc2f
Use single quotes
mhsmith 51ee923
Use different artifact names in each matrix job
mhsmith 0d1b6d1
Use similar arguments to `--fast-ci`
mhsmith 67c7af3
Suppress `make install` output by default
mhsmith 16f1230
Strip debug information from release package by default
mhsmith 563ca5a
Apply suggestions from code review
mhsmith bd876f4
Convert action into a single step with group markers
mhsmith 6b9184c
Update zizmor
mhsmith 55b91f7
Fix syntax
mhsmith 56bed39
Cosmetic fixes
mhsmith f7f9f44
Update to NDK version 27.3.13750724
mhsmith 4807047
Revert "Update zizmor"
mhsmith b3daf4b
Convert action into an `android.py ci` command
mhsmith c9700e4
Use `sudo` when updating udev rules
mhsmith e8e2a9e
Adjust matrix generation
mhsmith 7e87375
Fix whitespace
mhsmith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# This is coded as an action rather than a workflow so the release-tools | ||
# repository can load it from a dynamically-chosen commit. Cross-repository | ||
# workflow calls must have a Git reference hard-coded in the calling workflow, | ||
# but actions can be run dynamically from the runner's filesystem. | ||
|
||
name: Build and test (Android) | ||
description: Build and test (Android) | ||
|
||
inputs: | ||
triplet: | ||
description: Host triplet | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
# Build Python, and package it into a release artifact. | ||
- shell: bash | ||
run: ./Android/android.py build ${{ inputs.triplet }} | ||
- shell: bash | ||
run: ./Android/android.py package ${{ inputs.triplet }} | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ inputs.triplet }} | ||
path: cross-build/${{ inputs.triplet }}/dist/* | ||
if-no-files-found: error | ||
|
||
# Currently, GitHub Actions can only run the Android emulator on Linux, so | ||
# all the remaining steps are conditional on that. | ||
|
||
# (https://github.blog/changelog/2024-04-02-github-actions-hardware-accelerated-android-virtualization-now-available/). | ||
- name: Enable KVM for Android emulator | ||
if: runner.os == 'Linux' | ||
shell: bash | ||
run: | | ||
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ | ||
| sudo tee /etc/udev/rules.d/99-kvm4all.rules | ||
sudo udevadm control --reload-rules | ||
sudo udevadm trigger --name-match=kvm | ||
|
||
- name: Unpack release artifact | ||
if: runner.os == 'Linux' | ||
shell: bash | ||
run: | | ||
mkdir $RUNNER_TEMP/android | ||
tar -C $RUNNER_TEMP/android -xf cross-build/${{ inputs.triplet }}/dist/* | ||
|
||
- name: Tests | ||
if: runner.os == 'Linux' | ||
shell: bash | ||
# Arguments are similar to --fast-ci, but in single-process mode. | ||
run: | | ||
$RUNNER_TEMP/android/android.py test --managed maxVersion -v -- \ | ||
--single-process --fail-env-changed --rerun --slowest --verbose3 \ | ||
-u "all,-cpu" --timeout=600 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense; but it also raises an eyebrow because this is something that no other platform has needed. I presume this is because no other platform that is generating binary artefacts is doing so with the tooling in
release-tools
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@webknjaz, do you have any thougts here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a look, thanks for tagging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mhsmith so I've tried to understand the context and this justtification didn't make sense to me.
It is perfectly possible to call reusable workflows from other repositories (in fact, this is what I'm building my
reusable-tox.yml
ecosystem on).My understanding is that this is meant to be used in https://github.com/python/release-tools/blob/698deaf2ebff433a6ab9d4b5ded97a40fce109a1/.github/workflows/source-and-docs-release.yml, right?
In any case, I've been moving away from composite actions in favor of reusable workflows. This is because composite actions (or any actions for that matter) are represented as a single step in job runs. And it's rather difficult to inspect what actions are doing. So from the troubleshooting perspective, I'd strongly advise against composite actions.
It is important to make every step visible and transparent. And if you follow the practice I established with reusable workflows as modules in here, this is definitely possible.
I started with in-repo "modules" two years ago because I was solving the problem of making it possible to collect all the job statuses in a single check (for branch protection). This wasn't because it's somehow impossible to host them externally. This was just not something necessary for that purpose.
@encukou I've actually been meaning to ask if there's any workflows that are being duplicated in the python org. If yes, it'd make sense to host them in a shared repository. This could be a
.github
repo or even thatrelease-tools
one (although, I don't know if it makes semantic sense). This is a separate question, though.That said, if you've faced any confusion or need help adapting this to be a reusable workflow, just let me know where you're stuck. I can help you navigate this or just rewrite it for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now,
release-tools
only creates source zips and docs artifacts. See https://github.com/python/release-tools/actions/runs/16450411678 for 3.14 RC2.The Windows artifacts are built in Azure Pipelines, here's RC2. And Ned builds the macOS artifacts. (
release-tools
later takes these Windows and macOS artifacts and signs and uploads them.)We're hoping to build the macOS artifacts using CI in the near future, so what we decide here may help inform how to do that to :)
Yes, see https://github.com/python/release-tools/pull/265/files#diff-4d14704b6b88fb06db888f96c03a8e9b3a5e07a4ee566d97d4111b2c05210e84R220.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I'd like to see is CI in this repo to check Android builds okay, so we don't get caught ought on release day because we only build in
release-tools
.This happened in 3.14 RC1 with the plaintext docs, which had broken back in April or so, but RC1 is the first prerelease to build docs and we hadn't caught it here.
One deciding factor for whether we have stuff over here (via composite actions or something else) might be how much difference there'll be between different versions (3.14, 3.15, etc). If a lot, we might not want it all in
release-tools
and would benefit from versioning things in branches over here.On the other hand, the docs build is also versioned in branches here,
release-tools
CI calls amake dist
command in this repo.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's more or less the way I've been trying to suggest.