Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Introduce emulator variant env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
plastiv committed Mar 13, 2019
1 parent 5fff8c6 commit 335df89
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
28 changes: 14 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ services:

env:
# EMULATOR_API_LEVEL=14 x86 is not published.
- EMULATOR_API_LEVEL=15 EMULATOR_ARCH=x86
- EMULATOR_API_LEVEL=16 EMULATOR_ARCH=x86
- EMULATOR_API_LEVEL=17 EMULATOR_ARCH=x86
- EMULATOR_API_LEVEL=18 EMULATOR_ARCH=x86
- EMULATOR_API_LEVEL=19 EMULATOR_ARCH=x86
- EMULATOR_API_LEVEL=15 EMULATOR_VARIANT=google_apis EMULATOR_ARCH=x86
- EMULATOR_API_LEVEL=16 EMULATOR_VARIANT=google_apis EMULATOR_ARCH=x86
- EMULATOR_API_LEVEL=17 EMULATOR_VARIANT=google_apis EMULATOR_ARCH=x86
- EMULATOR_API_LEVEL=18 EMULATOR_VARIANT=google_apis EMULATOR_ARCH=x86
- EMULATOR_API_LEVEL=19 EMULATOR_VARIANT=google_apis EMULATOR_ARCH=x86
# EMULATOR_API_LEVEL=20 is not published at all.
- EMULATOR_API_LEVEL=21 EMULATOR_ARCH=x86_64
- EMULATOR_API_LEVEL=22 EMULATOR_ARCH=x86_64
- EMULATOR_API_LEVEL=23 EMULATOR_ARCH=x86_64
- EMULATOR_API_LEVEL=24 EMULATOR_ARCH=x86_64
- EMULATOR_API_LEVEL=25 EMULATOR_ARCH=x86_64
- EMULATOR_API_LEVEL=26 EMULATOR_ARCH=x86_64
- EMULATOR_API_LEVEL=27 EMULATOR_ARCH=x86
- EMULATOR_API_LEVEL=28 EMULATOR_ARCH=x86_64
- EMULATOR_API_LEVEL=21 EMULATOR_VARIANT=google_apis EMULATOR_ARCH=x86_64
- EMULATOR_API_LEVEL=22 EMULATOR_VARIANT=google_apis EMULATOR_ARCH=x86_64
- EMULATOR_API_LEVEL=23 EMULATOR_VARIANT=google_apis EMULATOR_ARCH=x86_64
- EMULATOR_API_LEVEL=24 EMULATOR_VARIANT=google_apis EMULATOR_ARCH=x86_64
- EMULATOR_API_LEVEL=25 EMULATOR_VARIANT=google_apis EMULATOR_ARCH=x86_64
- EMULATOR_API_LEVEL=26 EMULATOR_VARIANT=google_apis EMULATOR_ARCH=x86_64
- EMULATOR_API_LEVEL=27 EMULATOR_VARIANT=google_apis EMULATOR_ARCH=x86
- EMULATOR_API_LEVEL=28 EMULATOR_VARIANT=google_apis EMULATOR_ARCH=x86_64

before_install:
- docker info

script:
- docker build --build-arg EMULATOR_API_LEVEL --build-arg EMULATOR_ARCH -t android-emulator-$EMULATOR_API_LEVEL android-emulator/
- docker build --build-arg EMULATOR_API_LEVEL --build-arg EMULATOR_VARIANT --build-arg EMULATOR_ARCH -t android-emulator-$EMULATOR_API_LEVEL android-emulator/
- docker run -it --rm --env EMULATOR_API_LEVEL --volume=$(pwd)/android-emulator:/opt/workspace --entrypoint /opt/workspace/start-emulator.sh android-emulator-$EMULATOR_API_LEVEL
5 changes: 3 additions & 2 deletions android-emulator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ ENV PATH ${ANDROID_SDK_ROOT}/emulator:${ANDROID_SDK_ROOT}/tools/bin:${ANDROID_SD
ARG BUILD_TOOLS_VERSION=28.0.3
ARG PLATFORM_API_LEVEL=28
ARG EMULATOR_API_LEVEL=28
ARG EMULATOR_VARIANT=google_apis
ARG EMULATOR_ARCH=x86_64

# Update AndroidSDK
Expand All @@ -80,14 +81,14 @@ RUN yes 'y' | sdkmanager --licenses >/dev/null \
"emulator" \
"platform-tools" \
"platforms;android-${PLATFORM_API_LEVEL}" \
"system-images;android-${EMULATOR_API_LEVEL};google_apis;${EMULATOR_ARCH}" \
"system-images;android-${EMULATOR_API_LEVEL};${EMULATOR_VARIANT};${EMULATOR_ARCH}" \
"tools" >/dev/null

# Create AVD
RUN yes 'n' | avdmanager --silent create avd \
--name android-emulator-${EMULATOR_API_LEVEL} \
--device "4in WVGA (Nexus S)" \
--package "system-images;android-${EMULATOR_API_LEVEL};google_apis;${EMULATOR_ARCH}"
--package "system-images;android-${EMULATOR_API_LEVEL};${EMULATOR_VARIANT};${EMULATOR_ARCH}"

# GO to workspace
WORKDIR /opt/workspace

0 comments on commit 335df89

Please sign in to comment.