-
Notifications
You must be signed in to change notification settings - Fork 708
Fix the Android CI workflow by adding a post-install step the configure the SDK #3424
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
marcprux
wants to merge
7
commits into
apple:main
Choose a base branch
from
swift-android-sdk:main
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.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ee8fbc9
Add post-install phase for Android to install_swift_sdk.sh
marcprux 7932b35
Fixup install_swift_sdk.sh for shell link check
marcprux d99b7dd
Fix location of SDK install script
marcprux 1636b5d
Fix script syntax
marcprux 987b251
Fix script location
marcprux cb85a53
Cleanup NDK install section of script
marcprux eea2e71
Move to android_ndk_version to header and allow it to be parameterize…
marcprux 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ version="${INSTALL_SWIFT_VERSION:=""}" | |
| arch="${INSTALL_SWIFT_ARCH:="aarch64"}" | ||
| os_image="${INSTALL_SWIFT_OS_IMAGE:="ubuntu22.04"}" | ||
| sdk="${INSTALL_SWIFT_SDK:="static-sdk"}" | ||
| android_ndk_version="${INSTALL_ANDROID_NDK:="r27d"}" | ||
|
|
||
| if [[ ! ( -n "$branch" && -z "$version" ) && ! ( -z "$branch" && -n "$version") ]]; then | ||
| fatal "Exactly one of build or version must be defined." | ||
|
|
@@ -127,3 +128,20 @@ swift --version | |
|
|
||
| log "Installing Swift SDK" | ||
| swift sdk install "$sdk_path" | ||
|
|
||
| log "Swift SDK Post-install" | ||
| if [[ "$sdk" == "android-sdk" ]]; then | ||
| # guess some common places where the swift-sdks folder lives | ||
| cd ~/Library/org.swift.swiftpm || cd ~/.config/swiftpm || cd ~/.local/swiftpm || cd ~/.swiftpm || cd /root/.swiftpm || exit 1 | ||
|
|
||
| # download and link the NDK | ||
| android_ndk_url="https://dl.google.com/android/repository/android-ndk-${android_ndk_version}-$(uname -s).zip" | ||
| log "Android Native Development Kit URL: ${android_ndk_url}" | ||
| "$CURL_BIN" -fsSL -o ndk.zip --retry 3 "${android_ndk_url}" | ||
| unzip -q ndk.zip | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we parametrize this like we do with e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose also the use of |
||
| rm ndk.zip | ||
| export ANDROID_NDK_HOME="${PWD}/android-ndk-${android_ndk_version}" | ||
| bundledir=$(find . -type d -maxdepth 2 -name '*android*.artifactbundle' | head -n 1) | ||
| "${bundledir}"/swift-android/scripts/setup-android-sdk.sh | ||
| cd - || exit | ||
| fi | ||
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.
Is there no way we can know this ahead of time? We control the whole system here from a blank VM.
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.
If we do need to exit here can we use
fataland explain what the issue is?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.
Do we actually need the
cdhere can we just refer to things using longer paths?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.
We change directories so that the NDK is downloaded adjacent to the artifactbundle, otherwise it is in the current folder, which seems like it might cause confusion and clutter.
The path search is unfortunately because the swiftpm configuration folder varies based on OS and configuration. I observed that for the swift-nio test run that it was
/root/.swiftpm/swift-sdks, but I'm not sure if that will always be the case.Note that we could do this and it would just work, plus it would allow us to avoid needing to change directories:
That's pretty gnarly, but let me know if you think it is preferable and I will implement it.