From fd240e46a6f30cec94d5d81db81b7a8026f05538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Nieto=20Rodr=C3=ADguez?= Date: Wed, 14 Oct 2020 14:40:42 +0200 Subject: [PATCH 1/3] Fix README.md typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f7035beaa..abfb81ab8 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ A GitHub Action for installing, configuring and running hardware-accelerated And The old ARM-based emulators were slow and are no longer supported by Google. The modern Intel Atom (x86 and x86_64) emulators require hardware acceleration (HAXM on Mac & Windows, QEMU on Linux) from the host to run fast. This presents a challenge on CI as to be able to run hardware accelerated emulators within a docker container, **KVM** must be supported by the host VM which isn't the case for cloud-based CI providers due to infrastructural limits. If you want to learn more about this, here's an article I wrote: [Running Android Instrumented Tests on CI](https://dev.to/ychescale9/running-android-emulators-on-ci-from-bitrise-io-to-github-actions-3j76). -The **masOS** VM provided by **GitHub Actions** has **HAXM** installed so we are able to create a new AVD instance, launch an emulator with hardware acceleration, and run our Android +The **macOS** VM provided by **GitHub Actions** has **HAXM** installed so we are able to create a new AVD instance, launch an emulator with hardware acceleration, and run our Android tests directly on the VM. This action automates the process by doing the following: From 53151f5236f519b0378825f611c59229e4bf514c Mon Sep 17 00:00:00 2001 From: Yang Date: Fri, 16 Oct 2020 14:10:25 +1100 Subject: [PATCH 2/3] Add support for using google_apis_playstore system images. --- .github/workflows/workflow.yml | 4 ++++ README.md | 6 +++--- __tests__/input-validator.test.ts | 5 +++++ action.yml | 2 +- lib/input-validator.js | 2 +- lib/main.js | 3 ++- src/input-validator.ts | 2 +- src/main.ts | 3 ++- test-fixture/gradle.properties | 1 + test-fixture/gradle/wrapper/gradle-wrapper.properties | 2 +- 10 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 9eae156ba..e6316e9cf 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -33,6 +33,10 @@ jobs: - os: macos-latest api-level: 30 target: google_apis + - os: macos-latest + api-level: 24 + target: playstore + steps: - name: checkout uses: actions/checkout@v2 diff --git a/README.md b/README.md index abfb81ab8..74552fdd6 100644 --- a/README.md +++ b/README.md @@ -86,10 +86,10 @@ jobs: ## Configurations -| | **Required** | **Default** | **Description** | -|----------------------|--------------|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **Input** | **Required** | **Default** | **Description** | +|-|-|-|-| | `api-level` | Required | N/A | API level of the platform system image - e.g. 23 for Android Marshmallow, 29 for Android 10. **Minimum API level supported is 15**. | -| `target` | Optional | `default` | Target of the system image - `default` or `google_apis`. | +| `target` | Optional | `default` | Target of the system image - `default`, `google_apis` or `playstore`. | | `arch` | Optional | `x86` | CPU architecture of the system image - `x86` or `x86_64`. Note that `x86_64` image is only available for API 21+. | | `profile` | Optional | N/A | Hardware profile used for creating the AVD - e.g. `Nexus 6`. For a list of all profiles available, run `avdmanager list` and refer to the results under "Available Android Virtual Devices". | | `avd-name` | Optional | `test` | Custom AVD name used for creating the Android Virtual Device. | diff --git a/__tests__/input-validator.test.ts b/__tests__/input-validator.test.ts index 812177edc..8a6e04b97 100644 --- a/__tests__/input-validator.test.ts +++ b/__tests__/input-validator.test.ts @@ -53,6 +53,11 @@ describe('target validator tests', () => { validator.checkTarget('google_apis'); }; expect(func2).not.toThrow(); + + const func3 = () => { + validator.checkTarget('google_apis'); + }; + expect(func3).not.toThrow(); }); }); diff --git a/action.yml b/action.yml index 0d4f0ea75..77b3947be 100644 --- a/action.yml +++ b/action.yml @@ -9,7 +9,7 @@ inputs: description: 'API level of the platform and system image - e.g. 23 for Android Marshmallow, 29 for Android 10' required: true target: - description: 'target of the system image - default or google_apis' + description: 'target of the system image - default, google_apis or playstore' default: 'default' arch: description: 'CPU architecture of the system image - x86 or x86_64' diff --git a/lib/input-validator.js b/lib/input-validator.js index 38206260d..6622061bf 100644 --- a/lib/input-validator.js +++ b/lib/input-validator.js @@ -2,7 +2,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.checkEmulatorBuild = exports.checkDisableAnimations = exports.checkArch = exports.checkTarget = exports.checkApiLevel = exports.VALID_ARCHS = exports.VALID_TARGETS = exports.MIN_API_LEVEL = void 0; exports.MIN_API_LEVEL = 15; -exports.VALID_TARGETS = ['default', 'google_apis']; +exports.VALID_TARGETS = ['default', 'google_apis', 'google_apis_playstore']; exports.VALID_ARCHS = ['x86', 'x86_64']; function checkApiLevel(apiLevel) { if (isNaN(Number(apiLevel)) || !Number.isInteger(Number(apiLevel))) { diff --git a/lib/main.js b/lib/main.js index 46e1bb013..478426a27 100644 --- a/lib/main.js +++ b/lib/main.js @@ -52,7 +52,8 @@ function run() { const apiLevel = Number(apiLevelInput); console.log(`API level: ${apiLevel}`); // target of the system image - const target = core.getInput('target'); + const targetInput = core.getInput('target'); + const target = targetInput == 'playstore' ? 'google_apis_playstore' : targetInput; input_validator_1.checkTarget(target); console.log(`target: ${target}`); // CPU architecture of the system image diff --git a/src/input-validator.ts b/src/input-validator.ts index b125ebe64..e925b0a0a 100644 --- a/src/input-validator.ts +++ b/src/input-validator.ts @@ -1,5 +1,5 @@ export const MIN_API_LEVEL = 15; -export const VALID_TARGETS: Array = ['default', 'google_apis']; +export const VALID_TARGETS: Array = ['default', 'google_apis', 'google_apis_playstore']; export const VALID_ARCHS: Array = ['x86', 'x86_64']; export function checkApiLevel(apiLevel: string): void { diff --git a/src/main.ts b/src/main.ts index 4bc73b29d..5407d95c0 100644 --- a/src/main.ts +++ b/src/main.ts @@ -25,7 +25,8 @@ async function run() { console.log(`API level: ${apiLevel}`); // target of the system image - const target = core.getInput('target'); + const targetInput = core.getInput('target'); + const target = targetInput == 'playstore' ? 'google_apis_playstore' : targetInput; checkTarget(target); console.log(`target: ${target}`); diff --git a/test-fixture/gradle.properties b/test-fixture/gradle.properties index e5ec345da..9a4e770ea 100644 --- a/test-fixture/gradle.properties +++ b/test-fixture/gradle.properties @@ -1,6 +1,7 @@ org.gradle.parallel=true org.gradle.configureondemand=true org.gradle.caching=true +org.gradle.vfs.watch=true # Enable Kotlin incremental compilation kotlin.incremental=true diff --git a/test-fixture/gradle/wrapper/gradle-wrapper.properties b/test-fixture/gradle/wrapper/gradle-wrapper.properties index 98536f016..d88c5ac79 100644 --- a/test-fixture/gradle/wrapper/gradle-wrapper.properties +++ b/test-fixture/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-rc-1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip From 15da0b2f148b833219e7173e04e17d440b501703 Mon Sep 17 00:00:00 2001 From: Yang Date: Fri, 16 Oct 2020 14:39:02 +1100 Subject: [PATCH 3/3] Prepare for release 2.12.0. --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd820a88b..361d61b3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Change Log +## v2.12.0 + +Added support for using the `playstore` system images: + +``` +- name: run tests + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: 30 + target: playstore + arch: x86 + script: ./gradlew connectedCheck +``` + ## v2.11.1 * Update SDK command-line tools to `2.1`.