From 53151f5236f519b0378825f611c59229e4bf514c Mon Sep 17 00:00:00 2001 From: Yang Date: Fri, 16 Oct 2020 14:10:25 +1100 Subject: [PATCH] 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 9eae156b..e6316e9c 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 abfb81ab..74552fdd 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 812177ed..8a6e04b9 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 0d4f0ea7..77b3947b 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 38206260..6622061b 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 46e1bb01..478426a2 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 b125ebe6..e925b0a0 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 4bc73b29..5407d95c 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 e5ec345d..9a4e770e 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 98536f01..d88c5ac7 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