Repository navigation
ci(repo): install the Android NDK before builds and retry a stalled e2e start #3142
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
30167d4
ci(repo): install the Android NDK before builds and retry a stalled e…
xsahil03x e39d1d1
ci(repo): stop a stalled e2e start without a shell between the watchd…
xsahil03x c48ae1d
ci(repo): call sdkmanager by its path on the runner
xsahil03x 6885492
ci(repo): run the watched e2e attempt from the app folder
xsahil03x 03192e9
ci(repo): bound sdkmanager, skip it when installed, and keep a spawn …
xsahil03x 1ae5825
ci(repo): keep the NDK install retries inside the build job's time limit
xsahil03x 3b105a0
ci(repo): keep sdkmanager output for a failed install and tidy the ne…
xsahil03x be581d8
ci(repo): end the e2e startup watch only once the app reports a test
xsahil03x cce365e
ci(repo): end the e2e startup watch when the first test starts
xsahil03x faf130d
Merge branch 'master' into sahil/e2e-ci-ndk-and-stalled-start
xsahil03x 652241b
ci(repo): install the Android NDK in the nightly e2e and distribution…
xsahil03x 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,54 @@ | ||
| name: 'Install Android NDK' | ||
| description: 'Install the NDK and CMake that Flutter plugins build native code with' | ||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Install the NDK and CMake | ||
| shell: bash | ||
| run: | | ||
| # Plugins with native code (e.g. `jni`, used by `path_provider_android`) | ||
| # otherwise make Gradle download these mid-build. Needs Flutter set up. | ||
| # | ||
| # The NDK Flutter sets for plugins (`flutter.ndkVersion`), read from the | ||
| # installed Flutter so an upgrade keeps it in step. | ||
| ndk=$(grep -oP 'ndkVersion: String = "\K[0-9.]+' \ | ||
| "$FLUTTER_ROOT/packages/flutter_tools/gradle/src/main/kotlin/FlutterExtension.kt" || true) | ||
| if [ -z "$ndk" ]; then | ||
| echo "::error::Could not read flutter.ndkVersion from the Flutter SDK" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # The CMake version the Android Gradle Plugin builds native code with. | ||
| cmake=3.22.1 | ||
| # By full path, so the runner's own SDK is the one updated. | ||
| sdkmanager="$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" | ||
| if [ ! -x "$sdkmanager" ]; then | ||
| echo "::error::sdkmanager not found at $sdkmanager" | ||
| exit 1 | ||
| fi | ||
| ndk_dir="$ANDROID_HOME/ndk/$ndk" | ||
| installed() { | ||
| [ -f "$ndk_dir/source.properties" ] && [ -x "$ANDROID_HOME/cmake/$cmake/bin/cmake" ] | ||
| } | ||
|
|
||
| # sdkmanager unpacks the download itself. Gradle's own NDK download can | ||
| # arrive corrupt ("Archive is not a ZIP archive"), and then every retry | ||
| # of the build reuses the broken copy. | ||
| # A stalled sdkmanager fails its attempt instead of holding the job; three | ||
| # 5-minute attempts stay inside the 30-minute build job. | ||
| for attempt in 1 2 3; do | ||
| installed && break | ||
| if [ "$attempt" -gt 1 ]; then | ||
| echo "::warning::Installing NDK $ndk and CMake $cmake failed; retrying (attempt $attempt)" | ||
| rm -rf "$ndk_dir" "$ANDROID_HOME/cmake/$cmake" "$ANDROID_HOME/.temp" | ||
| sleep 15 | ||
| fi | ||
| yes | timeout 300 "$sdkmanager" --install "ndk;$ndk" "cmake;$cmake" > "$RUNNER_TEMP/sdkmanager.log" 2>&1 || true | ||
| done | ||
|
|
||
| if ! installed; then | ||
| tail -n 30 "$RUNNER_TEMP/sdkmanager.log" | ||
| echo "::error::Could not install NDK $ndk and CMake $cmake" | ||
| exit 1 | ||
| fi | ||
| echo "Installed NDK $ndk and CMake $cmake" | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.