Skip to content

Commit 26ed66e

Browse files
authored
Update Android CI config (#2687)
### Description of changes: Update Android configuration. ### Call-outs: * I stuck with ndkVersion "21.4". We should probably bump to a more recent version soon. * This PR will be needed in order to merge this PR: #2551 ### Testing: Successfully built docker image (on Ubuntu x86 host): ``` ❯ docker build -t ubuntu-24.04:android -f ubuntu-24.04_android/Dockerfile ../ [+] Building 122.8s (11/11) FINISHED docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 2.62kB 0.0s => [internal] load metadata for docker.io/library/ubuntu:24.04 0.1s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/6] FROM docker.io/library/ubuntu:24.04@sha256:590e57acc18d58cd25d00254d4ca989bbfcd7d929ca6b521892c9c904c391f50 0.0s => [internal] load build context 0.0s => => transferring context: 2.21kB 0.0s => CACHED [2/6] RUN set -ex && apt-get update -y && apt-get -y --no-install-recommends upgrade && apt-get -y --no-install-recommends install python3.12 python3.12-venv python3-pip openjdk-17-jdk perl libunwind-d 0.0s => [3/6] COPY linux-x86/ubuntu-24.04_android /tmp/triggerGradleDownloads/ 0.0s => [4/6] RUN cd /tmp/triggerGradleDownloads && echo "JAVA_HOME=$JAVA_HOME" && java -version && echo "PATH=/usr/local/go/bin:/opt/sdk/cmdline-tools/latest/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" && ./ 85.8s => [5/6] COPY dependencies/install_common_dependencies.sh / 0.0s => [6/6] RUN set -ex && /install_common_dependencies.sh && rm install_common_dependencies.sh 32.5s => exporting to image 4.3s => => exporting layers 4.2s => => writing image sha256:56cfb2717f5b3b7d8a8f7360d71aab62bbac70c3356b2600ff143555f80c28a4 0.0s => => naming to docker.io/library/ubuntu-24.04:android 0.0s ``` By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.
1 parent 2294510 commit 26ed66e

File tree

15 files changed

+141
-83
lines changed

15 files changed

+141
-83
lines changed

tests/ci/android/AWSLCAndroidTestRunner/app/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ apply plugin: 'kotlin-android'
33
apply plugin: 'kotlin-android-extensions'
44

55
android {
6-
compileSdkVersion 29
7-
buildToolsVersion "29.0.3"
8-
ndkVersion "21.0.6113669"
6+
compileSdkVersion 30
7+
buildToolsVersion "30.0.3"
8+
ndkVersion "21.4.7075529"
99

1010
def cmake_args = ''
1111
def specific_abis = ''
@@ -51,7 +51,7 @@ android {
5151
defaultConfig {
5252
applicationId "software.amazon.aws.crypto.awslcandroidtestrunner"
5353
minSdkVersion 21
54-
targetSdkVersion 29
54+
targetSdkVersion 30
5555
versionCode 1
5656
versionName "1.0"
5757

@@ -68,7 +68,7 @@ android {
6868
externalNativeBuild {
6969
cmake {
7070
path "src/main/cpp/CMakeLists.txt"
71-
version "3.10.2"
71+
version "3.18.1"
7272
}
7373
}
7474

tests/ci/android/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Android CI for AWS-LC
2-
AWS-LC wants to ensure that our tests and build work correctly on Android. Insipred from the CRT Team's [`AWSCRTAndroidTestRunner`](https://github.com/awslabs/aws-c-common/tree/main/AWSCRTAndroidTestRunner), this mini Android test harness is intended to be used within our Android CI with AWS Device Farm. The tests will include `crypto_test`, `urandom_test` and `ssl_test`, referenced from regular test dimensions. This app can be tested with the docker image at `tests/ci/docker_images/linux-x86/ubuntu-20.04_android`.
2+
AWS-LC wants to ensure that our tests and build work correctly on Android. Insipred from the CRT Team's [`AWSCRTAndroidTestRunner`](https://github.com/awslabs/aws-c-common/tree/main/AWSCRTAndroidTestRunner), this mini Android test harness is intended to be used within our Android CI with AWS Device Farm. The tests will include `crypto_test`, `urandom_test` and `ssl_test`, referenced from regular test dimensions. This app can be tested with the docker image at `tests/ci/docker_images/linux-x86/ubuntu-24.04_android`.
33

44
Our android CI cross-compiles AWS-LC using AWSLCAndroidTestRunner and the NDK toolchains in Codebuild. The current cross-compilation types are `x86_64`,`armeabi-v7a`, `arm64-v8a` for non-FIPS and `arm64-v8a` for FIPS. After cross-compilation is complete, we kick off real time device testing in AWS Device Farm from Codebuild using `tests/ci/kickoff_devicefarm_job.sh`, `boto3`, and the apk artifacts created.
55

66
## Setup
77
The commands below help build the app within our Android CI's docker image. The docker image is only made to support cross-compiling AWS-LC with Android toolchains, building the `AWSLCAndroidTestRunner` apks, and uploading and kicking off the tests in AWS Device Farm. Running and testing on connected Android devices or emulators via `./gradlew cC` isn't configured within the docker image.
88
1. Assuming all the commands are being run from this folder: `cd tests/ci/android`
9-
2. `docker build -t ubuntu-20.04:android ../docker_images/linux-x86/ubuntu-20.04_android/`
9+
2. `docker build -t ubuntu-20.04:android ../docker_images/linux-x86/ubuntu-24.04_android/`
1010
3. Run the docker image from root of aws-lc. The container needs access to aws-lc's source code to build.
1111
```
1212
cd ../../../

tests/ci/cdk/cdk/codebuild/github_ci_android_omnibus.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,39 @@ batch:
1313
privileged-mode: true
1414
compute-type: BUILD_GENERAL1_MEDIUM
1515
# TODO(CryptoAlg-1276): replace |620771051181| and |us-west-2| with corresponding env variables.
16-
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-20.04_android_latest
16+
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-24.04_android_latest
1717
- identifier: ubuntu2004_android_nonfips_static_release
1818
buildspec: ./tests/ci/codebuild/android/run_android_static_release.yml
1919
env:
2020
type: LINUX_CONTAINER
2121
privileged-mode: true
2222
compute-type: BUILD_GENERAL1_MEDIUM
23-
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-20.04_android_latest
23+
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-24.04_android_latest
2424
- identifier: ubuntu2004_android_nonfips_shared_debug
2525
buildspec: ./tests/ci/codebuild/android/run_android_shared_debug.yml
2626
env:
2727
type: LINUX_CONTAINER
2828
privileged-mode: true
2929
compute-type: BUILD_GENERAL1_MEDIUM
30-
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-20.04_android_latest
30+
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-24.04_android_latest
3131
- identifier: ubuntu2004_android_nonfips_shared_release
3232
buildspec: ./tests/ci/codebuild/android/run_android_shared_release.yml
3333
env:
3434
type: LINUX_CONTAINER
3535
privileged-mode: true
3636
compute-type: BUILD_GENERAL1_MEDIUM
37-
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-20.04_android_latest
37+
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-24.04_android_latest
3838
- identifier: ubuntu2004_android_fips_shared_release
3939
buildspec: ./tests/ci/codebuild/android/run_android_fips_shared.yml
4040
env:
4141
type: LINUX_CONTAINER
4242
privileged-mode: true
4343
compute-type: BUILD_GENERAL1_MEDIUM
44-
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-20.04_android_latest
44+
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-24.04_android_latest
4545
- identifier: ubuntu2004_android_fips_static_release
4646
buildspec: ./tests/ci/codebuild/android/run_android_fips_static.yml
4747
env:
4848
type: LINUX_CONTAINER
4949
privileged-mode: true
5050
compute-type: BUILD_GENERAL1_LARGE
51-
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-20.04_android_latest
51+
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-24.04_android_latest

tests/ci/docker_images/linux-x86/build_images.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ docker build -t ubuntu-20.04:clang-7x ubuntu-20.04_clang-7x
2424
docker build -t ubuntu-20.04:clang-8x ubuntu-20.04_clang-8x
2525
docker build -t ubuntu-20.04:clang-9x ubuntu-20.04_clang-9x
2626
docker build -t ubuntu-20.04:clang-10x ubuntu-20.04_clang-10x
27-
docker build -t ubuntu-20.04:android -f ubuntu-20.04_android/Dockerfile ../
2827
docker build -t ubuntu-20.04:clang-7x-bm-framework ubuntu-20.04_clang-7x-bm-framework
2928
docker build -t ubuntu-22.04:base -f ubuntu-22.04_base/Dockerfile ../dependencies
3029
docker build -t ubuntu-22.04:clang-14x-sde ubuntu-22.04_clang-14x-sde
3130
docker build -t ubuntu-22.04:gcc-10x ubuntu-22.04_gcc-10x
3231
docker build -t ubuntu-22.04:gcc-11x ubuntu-22.04_gcc-11x
3332
docker build -t ubuntu-22.04:gcc-12x ubuntu-22.04_gcc-12x
3433
docker build -t ubuntu-22.04:gcc-12x_integration ubuntu-22.04_gcc-12x_integration
34+
docker build -t ubuntu-24.04:base -f ubuntu-24.04_base/Dockerfile ../dependencies
35+
docker build -t ubuntu-24.04:android -f ubuntu-24.04_android/Dockerfile ../
3536
docker build -t amazonlinux-2:base -f amazonlinux-2_base/Dockerfile ../dependencies
3637
docker build -t amazonlinux-2:gcc-7x amazonlinux-2_gcc-7x
3738
docker build -t amazonlinux-2:gcc-7x-intel-sde amazonlinux-2_gcc-7x-intel-sde

tests/ci/docker_images/linux-x86/push_images.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ tag_and_push_img 'ubuntu-20.04:clang-7x' "${ECS_REPO}:ubuntu-20.04_clang-7x"
2424
tag_and_push_img 'ubuntu-20.04:clang-8x' "${ECS_REPO}:ubuntu-20.04_clang-8x"
2525
tag_and_push_img 'ubuntu-20.04:clang-9x' "${ECS_REPO}:ubuntu-20.04_clang-9x"
2626
tag_and_push_img 'ubuntu-20.04:clang-10x' "${ECS_REPO}:ubuntu-20.04_clang-10x"
27-
tag_and_push_img 'ubuntu-20.04:android' "${ECS_REPO}:ubuntu-20.04_android"
27+
tag_and_push_img 'ubuntu-24.04:android' "${ECS_REPO}:ubuntu-24.04_android"
2828
tag_and_push_img 'ubuntu-20.04:clang-7x-bm-framework' "${ECS_REPO}:ubuntu-20.04_clang-7x-bm-framework"
2929
tag_and_push_img 'ubuntu-20.04:clang-10x_formal-verification-saw-x86_64' "${ECS_REPO}:ubuntu-20.04_clang-10x_formal-verification-saw-x86_64"
3030
tag_and_push_img 'ubuntu-20.04:clang-10x_formal-verification-saw-x86_64-aes-gcm' "${ECS_REPO}:ubuntu-20.04_clang-10x_formal-verification-saw-x86_64-aes-gcm"

tests/ci/docker_images/linux-x86/ubuntu-20.04_android/build.gradle

Lines changed: 0 additions & 50 deletions
This file was deleted.

tests/ci/docker_images/linux-x86/ubuntu-20.04_android/Dockerfile renamed to tests/ci/docker_images/linux-x86/ubuntu-24.04_android/Dockerfile

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,40 @@
11
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0 OR ISC
33

4-
FROM ubuntu:20.04
4+
FROM ubuntu:24.04
55

66
SHELL ["/bin/bash", "-c"]
77

88
ENV DEBIAN_FRONTEND=noninteractive
99

1010

11-
ENV ANDROID_SDK_URL commandlinetools-linux-8092744_latest
12-
ENV ANDROID_HOME /opt/sdk
13-
ENV GRADLE_VERSION gradle-5.6.4
11+
ENV ANDROID_SDK_URL=commandlinetools-linux-13114758_latest
12+
ENV ANDROID_HOME=/opt/sdk
13+
ENV ANDROID_SDK_ROOT=/opt/sdk
14+
ENV GRADLE_VERSION=gradle-7.6.4
1415
ENV GOROOT=/usr/local/go
15-
ENV PATH="$GOROOT/bin:$PATH"
16+
ENV PATH="$GOROOT/bin:/opt/sdk/cmdline-tools/latest/bin:$PATH"
1617
# ------------------------------------------------------
1718
# --- Android SDK
1819

1920
RUN set -ex && \
2021
apt-get update -y && \
2122
apt-get -y --no-install-recommends upgrade && \
2223
apt-get -y --no-install-recommends install \
23-
python3.8 \
24-
python3.8-venv \
24+
python3.12 \
25+
python3.12-venv \
2526
python3-pip \
26-
openjdk-8-jdk \
27+
openjdk-17-jdk \
2728
perl \
2829
libunwind-dev \
2930
wget \
3031
unzip && \
32+
# Set Java 17 as default
33+
export JAVA17_ALT=$(update-alternatives --list java | grep java-17 | head -1) && \
34+
update-alternatives --set java $JAVA17_ALT && \
35+
# Set Java 17 for SDK manager compatibility
36+
export JAVA_HOME=$(find /usr/lib/jvm -name "*java-17*" -type d | head -1) && \
37+
export PATH=$JAVA_HOME/bin:$PATH && \
3138
# install android-sdk from url source
3239
mkdir /opt/sdk && \
3340
mkdir /opt/sdk/cmdline-tools && \
@@ -42,17 +49,20 @@ RUN set -ex && \
4249
yes | ./sdkmanager --licenses && \
4350
# Preinstall AWSLCAndroidTestRunner android dependencies, so they don't need to be
4451
# rebuilt for each new gradle build run.
45-
./sdkmanager "ndk;21.0.6113669" \
46-
"build-tools;29.0.3" \
47-
"cmake;3.10.2.4988404" \
48-
"platforms;android-29" && \
52+
./sdkmanager "ndk;28.2.13676358" \
53+
"build-tools;33.0.3" \
54+
"cmake;3.18.1" \
55+
"platforms;android-30" && \
4956
cd /opt && \
5057
wget -q https://services.gradle.org/distributions/${GRADLE_VERSION}-all.zip && \
5158
rm -rf /opt/cmdline-tools-tmp && \
5259
rm -rf /tmp/*
5360
# Preinstall gradle dependencies, so they don't need to be redownloaded in the CI.
54-
COPY linux-x86/ubuntu-20.04_android /tmp/triggerGradleDownloads/
61+
COPY linux-x86/ubuntu-24.04_android /tmp/triggerGradleDownloads/
5562
RUN cd /tmp/triggerGradleDownloads && \
63+
echo "JAVA_HOME=$JAVA_HOME" && \
64+
java -version && \
65+
echo "PATH=$PATH" && \
5666
./gradlew --no-daemon --refresh-dependencies androidDependencies lint && \
5767
rm -rf /tmp/triggerGradleDownloads
5868

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
plugins {
2+
id 'com.android.application' version '7.3.1'
3+
id 'org.jetbrains.kotlin.android' version '1.8.10'
4+
}
5+
6+
allprojects {
7+
repositories {
8+
google()
9+
mavenCentral()
10+
}
11+
}
12+
13+
android {
14+
namespace 'software.amazon.aws.crypto.awslcandroidtestrunner'
15+
compileSdk 32
16+
buildToolsVersion "32.0.0"
17+
ndkVersion "28.2.13676358"
18+
19+
defaultConfig {
20+
minSdkVersion 21
21+
targetSdkVersion 32
22+
23+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
24+
}
25+
}
26+
27+
dependencies {
28+
implementation fileTree(dir: 'libs', include: ['*.jar'])
29+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.10"
30+
implementation 'androidx.appcompat:appcompat:1.1.0'
31+
implementation 'androidx.core:core-ktx:1.2.0'
32+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
33+
androidTestImplementation 'androidx.test:runner:1.5.2'
34+
androidTestImplementation 'androidx.test:core:1.5.0'
35+
}

tests/ci/docker_images/linux-x86/ubuntu-20.04_android/gradle.properties renamed to tests/ci/docker_images/linux-x86/ubuntu-24.04_android/gradle.properties

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# http://www.gradle.org/docs/current/userguide/build_environment.html
77
# Specifies the JVM arguments used for the daemon process.
88
# The setting is particularly useful for tweaking memory settings.
9-
org.gradle.jvmargs=-Xmx1536m
9+
org.gradle.jvmargs=-Xmx2048m -Djava.awt.headless=true
1010
# When configured, Gradle will run in incubating parallel mode.
1111
# This option should only be used with decoupled projects. More details, visit
1212
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
@@ -19,5 +19,4 @@ android.useAndroidX=true
1919
android.enableJetifier=true
2020
# Kotlin code style for this project: "official" or "obsolete":
2121
kotlin.code.style=official
22-
org.gradle.daemon=true
23-
org.gradle.parallel=true
22+
org.gradle.parallel=true
File renamed without changes.

0 commit comments

Comments
 (0)