Skip to content

Conversation

@mikehardy
Copy link
Member

@mikehardy mikehardy commented Dec 28, 2025

Attempt to use the community NDK install action vs our bespoke scripts

Note that a deep analysis of this earlier indicated it used the github actions/toolkit which automatically handles transient network failures during download with some retries - so if it works at all, it should be as robust or better than our existing

The only difficulty here is we need to transform our definition of the NDK version - which is the full / real version, to what I would consider the "marketing" version

e.g. 29.0.23124 --> r29
or 28.3.5432 --> r28d

the pattern is r<MAJOR><MINORth letter of alphabet> so not too bad

ref: https://github.com/android/ndk/wiki/Unsupported-Downloads

@mikehardy mikehardy closed this Dec 28, 2025
@mikehardy mikehardy reopened this Dec 28, 2025
@mikehardy mikehardy force-pushed the use-community-ndk-action branch 3 times, most recently from 202c1f6 to 415dcf2 Compare December 28, 2025 19:47
@mikehardy mikehardy force-pushed the use-community-ndk-action branch 2 times, most recently from 4e694ae to 4633469 Compare December 28, 2025 20:03
@mikehardy
Copy link
Member Author

mikehardy commented Dec 28, 2025

🤔 quick build on all 3 worked (except an emulator boot issue on ubuntu?) and codeql worked, but release build failed with something that looks unrelated.

This is close but may be something still to tweak, we'll see after re-runs

No space left on device (os error 28)

...on my self-hosted macOS runner. Hmmm, will think on that

@mikehardy mikehardy marked this pull request as draft December 28, 2025 20:51
@mikehardy mikehardy removed the request for review from david-allison December 28, 2025 20:51
@mikehardy
Copy link
Member Author

Not quite ready yet - this isn't installing things the way I thought it was. It is downloading correctly now, but it leaves the original download zip, and an expanded tree from the download zip in the worker temp area

Then the NDK itself seems to be in ANDROID_HOME but has timestamps that make me think it came down a different way - so I'm not sure about this at the moment... and it leads to out-of-storage-space errors with the zip + 2 copies

admin@Manageds-Virtual-Machine ~ % ls -lat $ANDROID_SDK_ROOT 
total 8
drwxr-x---+ 40 admin  staff  1280 Dec 28 20:46 ..
drwxr-xr-x   2 admin  staff    64 Dec 28 20:42 .temp
drwxr-xr-x   3 admin  staff    96 Dec 28 20:42 ndk
-rw-r--r--   1 admin  staff    16 Dec 28 20:42 .knownPackages
drwxr-xr-x  11 admin  staff   352 Nov  7 02:32 .
drwxr-xr-x   3 admin  staff    96 Nov  7 02:29 system-images
drwxr-xr-x  15 admin  staff   480 Nov  1 18:51 platform-tools
drwxr-xr-x   3 admin  staff    96 Nov  1 18:51 platforms
drwxr-xr-x   3 admin  staff    96 Nov  1 18:51 build-tools
drwxr-xr-x   9 admin  staff   288 Nov  1 18:51 licenses
drwxr-xr-x   3 admin  staff    96 Nov  1 18:51 cmdline-tools
admin@Manageds-Virtual-Machine ~ % ls -lat $ANDROID_SDK_ROOT/ndk 
total 0
drwxr-xr-x   3 admin  staff   96 Dec 28 20:42 .
drwxr-xr-x  11 admin  staff  352 Nov  7 02:32 ..
drwxr-xr-x  22 admin  staff  704 Nov  6 22:55 29.0.14206865
admin@Manageds-Virtual-Machine ~ % ls -lat $ANDROID_SDK_ROOT/ndk
total 0
drwxr-xr-x   3 admin  staff   96 Dec 28 20:42 .
drwxr-xr-x  11 admin  staff  352 Nov  7 02:32 ..
drwxr-xr-x  22 admin  staff  704 Nov  6 22:55 29.0.14206865
admin@Manageds-Virtual-Machine ~ % ls -la /Users/admin/actions-runner/_work/_temp/9344a808-6d6b-42ec-b394-47edfbda908b
total 0
drwxr-xr-x   3 admin  staff   96 Dec 28 20:41 .
drwxr-xr-x  24 admin  staff  768 Dec 28 20:44 ..
drwxr-xr-x  21 admin  staff  672 Oct  2 23:27 android-ndk-r29
admin@Manageds-Virtual-Machine ~ % ls -la /Users/admin/actions-runner/_work/_temp/9344a808-6d6b-42ec-b394-47edfbda908b/android-ndk-r29 
total 2648
drwxr-xr-x  21 admin  staff     672 Oct  2 23:27 .
drwxr-xr-x   3 admin  staff      96 Dec 28 20:41 ..
drwxr-xr-x  19 admin  staff     608 Oct  2 22:58 build
-rw-r--r--   1 admin  staff    2022 Oct  2 22:58 CHANGELOG.md

@mikehardy
Copy link
Member Author

mikehardy commented Dec 28, 2025

emulator boot issue may need something like I needed on react-native-firebase to pin the version to a slightly older one, for unknown reasons

invertase/react-native-firebase@20b4cac

note that CodeQL runs on ubuntu which runs out of space, and our purge
script doesn't work there, so liberate space the way we normally do
on ubuntu

also the way we should use the action is to not add it to local cache
(which is creates a copy for no reason, in my opinion) but we should
"link to sdk" which copies it into android home, which is where our
workflows expect to find it
@mikehardy mikehardy force-pushed the use-community-ndk-action branch from 4633469 to d7bd110 Compare December 28, 2025 23:23
@mikehardy mikehardy marked this pull request as ready for review December 29, 2025 00:57
run: |
cargo install toml-cli
ANDROID_NDK_VERSION=$(toml get gradle/libs.versions.toml versions.ndk --raw)
ANDROID_NDK_MAJOR_VERSION=$(echo $ANDROID_NDK_VERSION | cut -f1 -d.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: Is it possible to extract this block to a script. I held myself back from saying when I saw it twice, but 4 times feels like a maintenance burden

Copy link
Member Author

@mikehardy mikehardy Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've gone back and forth on "workflows that use scripts" and "workflows that have everything contained in the workflow"

The scripts way has the obvious benefit of DRY, which is nice, but on balance I'm so used to copy-paste in workflows at this point (almost the whole workflow is copy paste...) that I'm not bothered by DRY in workflows much anymore, so having it all in one spot is currently winning since I end up looking at it more frequently and grooming it more often than I would if it were tucked away separate

it's a slight preference so if you feel strongly, sure as it is obviously repetition, but if you don't feel strongly I'll leave it personally.

Where I definitely use scripts is if I can abstract something needed for devs and ci, but if it's ci-specific....meh

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No strong feelings, let's get this in

https://youtu.be/ussCHoQttyQ

@mikehardy
Copy link
Member Author

Okay - going to treat this as an approve but I want to see the release workflow pass on self-hosted runner first, so I'm going to rerun that until it hits one and I see it pass. Was having a storage issue before that I may have fixed, but may not have.

@mikehardy mikehardy added this pull request to the merge queue Dec 29, 2025
@mikehardy
Copy link
Member Author

worked self-hosted. the action isn't perfect and I may PR some better temp space mgmt to it if the maintainer is open to it, but it appears serviceable. And it's code we don't own, so +1. Going in

Merged via the queue into main with commit 37f3457 Dec 29, 2025
13 checks passed
@mikehardy mikehardy deleted the use-community-ndk-action branch December 29, 2025 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve CI NDK install by using nttld/setup-ndk

3 participants