bump version for c-s3 #247
Workflow file for this run
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
| name: CI Android | |
| on: | |
| push: | |
| branches-ignore: | |
| - 'main' | |
| - 'docs' | |
| # cancel in-progress builds after a new commit | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| BUILDER_VERSION: v0.9.84 | |
| BUILDER_SOURCE: releases | |
| BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net | |
| PACKAGE_NAME: aws-crt-java | |
| RUN: ${{ github.run_id }}-${{ github.run_number }} | |
| CRT_CI_ROLE: ${{ secrets.CRT_CI_ROLE_ARN }} | |
| AWS_DEFAULT_REGION: us-east-1 | |
| AWS_REGION: us-east-1 | |
| AWS_DEVICE_FARM_REGION: us-west-2 # Device Farm only available in us-west-2 region | |
| permissions: | |
| id-token: write # This is required for requesting the JWT | |
| jobs: | |
| android: | |
| # ubuntu-24.04 comes with Android tooling | |
| name: Android | |
| runs-on: ubuntu-24.04 # latest | |
| steps: | |
| - uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: ${{ env.CRT_CI_ROLE }} | |
| aws-region: ${{ env.AWS_DEFAULT_REGION }} | |
| - name: Checkout Sources | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| # Setup JDK 17 | |
| - name: set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| # Ensure Gradle uses this JDK (important when toolchains are present) | |
| - name: Point Gradle at JDK 17 | |
| run: echo "ORG_GRADLE_JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV | |
| - name: Mirror ANDROID_HOME → ANDROID_SDK_ROOT | |
| run: echo "ANDROID_SDK_ROOT=$ANDROID_HOME" >> "$GITHUB_ENV" | |
| # Install required Android components & accept licenses (NDK r28 + compileSdk 35) | |
| - name: Install Android SDK packages | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| SDKROOT="${ANDROID_SDK_ROOT:-$ANDROID_HOME}" | |
| SDKMANAGER="$SDKROOT/cmdline-tools/latest/bin/sdkmanager" | |
| # Some images have cmdline-tools already; ensure path exists | |
| if [[ ! -x "$SDKMANAGER" ]]; then | |
| echo "cmdline-tools not found; installing…" | |
| mkdir -p "$SDKROOT/cmdline-tools" | |
| curl -sSL -o /tmp/clt.zip https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip | |
| sudo unzip -q /tmp/clt.zip -d "$SDKROOT/cmdline-tools" | |
| sudo mv "$SDKROOT/cmdline-tools/cmdline-tools" "$SDKROOT/cmdline-tools/latest" | |
| SDKMANAGER="$SDKROOT/cmdline-tools/latest/bin/sdkmanager" | |
| fi | |
| echo "Installing platform-tools, Build-Tools 35, platform android-35, NDK r28, and CMake…" | |
| # Avoid 'yes' SIGPIPE killing the step: turn off pipefail just for these lines | |
| set +o pipefail | |
| yes | sudo "$SDKMANAGER" --install \ | |
| "platform-tools" \ | |
| "build-tools;35.0.0" \ | |
| "platforms;android-35" \ | |
| "ndk;28.0.12433566" \ | |
| "cmake;3.22.1" | |
| yes | "$SDKMANAGER" --licenses | |
| set -o pipefail | |
| # Quick sanity prints (non-fatal) | |
| "$SDKROOT/ndk/28.0.12433566/ndk-build" -v >/dev/null 2>&1 || true | |
| "$SDKMANAGER" --list | sed -n '1,80p' || true | |
| # Build and publish locally for the test app to find the SNAPSHOT version | |
| - name: Build ${{ env.PACKAGE_NAME }} | |
| run: | | |
| # Manually set -Xmx (max heap size) to something huge (tested 2g and that works, but why not go bigger). | |
| # Only in CI, gradle daemon runs out of memory during "lintAnalyzeDebug" task, unless you specify it this way. | |
| # You'd think Java's default of 25% RAM (ubuntu24 runner has 12g, so max 4g) would be sufficient, but no. | |
| # You'd think setting -Xmx via gradle.properties would help, but no. | |
| ./gradlew :android:crt:build -Dorg.gradle.jvmargs="-Xmx8g" | |
| ./gradlew -PnewVersion="1.0.0-SNAPSHOT" :android:crt:publishToMavenLocal | |
| # Setup files required by test app for Device Farm testing | |
| - name: Setup Android Test Files | |
| run: | | |
| cd src/test/android/testapp/src/main/assets | |
| python3 -m pip install boto3 | |
| python3 ./android_file_creation.py | |
| - name: Set Android keystore home | |
| run: | | |
| echo "ANDROID_SDK_HOME=$GITHUB_WORKSPACE/.android-home" >> "$GITHUB_ENV" | |
| echo "ANDROID_PREFS_ROOT=$GITHUB_WORKSPACE/.android-home" >> "$GITHUB_ENV" | |
| mkdir -p "$GITHUB_WORKSPACE/.android-home/.android" | |
| - name: Create debug keystore | |
| run: | | |
| keytool -genkeypair \ | |
| -keystore "$ANDROID_SDK_HOME/.android/debug.keystore" \ | |
| -storepass android -keypass android \ | |
| -alias androiddebugkey \ | |
| -dname "CN=Android Debug,O=Android,C=US" \ | |
| -keyalg RSA -keysize 2048 -validity 14000 | |
| - name: Build Test App | |
| run: | | |
| cd src/test/android/testapp | |
| ../../../../gradlew assembledebug | |
| ../../../../gradlew assembleAndroidTest | |
| - name: Device Farm Tests Highly Available | |
| run: | | |
| echo "Running Device Farm Python Script" | |
| python3 ./.github/workflows/run_android_ci.py \ | |
| --run_id ${{ github.run_id }} \ | |
| --run_attempt ${{ github.run_attempt }} \ | |
| --project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/ProjectArn" --query "SecretString" | cut -f5 -d\" | cut -f1 -d'\') \ | |
| --device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/DevicePoolArn" --query "SecretString" | cut -f5 -d\" | cut -f1 -d'\') \ | |
| --device_pool highly_available | |
| - name: Device Farm Tests Android 8.0.0 | |
| run: | | |
| echo "Running Device Farm Python Script" | |
| python3 ./.github/workflows/run_android_ci.py \ | |
| --run_id ${{ github.run_id }} \ | |
| --run_attempt ${{ github.run_attempt }} \ | |
| --project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/ProjectArn" --query "SecretString" | cut -f5 -d\" | cut -f1 -d'\') \ | |
| --device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/DevicePoolArnAndroid8" --query "SecretString" | cut -f5 -d\" | cut -f1 -d'\') \ | |
| --device_pool android_8 |