From 450c4c9f73881d2a8a9ab376c255f9bd03bedf57 Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 15 Jun 2025 02:59:42 +1000 Subject: [PATCH 1/7] Fix outdated information about larger runners billing (#437) Remove incorrect claim that larger runners are free for public repos. Current GitHub documentation states they are not free. Fixes #435 Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Yang --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3496f53a..c0afc828 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This presents a challenge when running emulators on CI especially when running e ## Running hardware accelerated emulators on Linux runners -GitHub's [larger Linux runners support running hardware accelerated emulators](https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/) which is [free for public GitHub repos](https://github.blog/2024-01-17-github-hosted-runners-double-the-power-for-open-source/). It is now recommended to use the **Ubuntu** (`ubuntu-latest`) runners which are 2-3 times faster than the **macOS** ones which are also a lot more expensive. Remember to enable KVM in your workflow before running this action: +GitHub's [larger Linux runners support running hardware accelerated emulators](https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/). It is now recommended to use the **Ubuntu** (`ubuntu-latest`) runners which are 2-3 times faster than the **macOS** ones which are also a lot more expensive. Remember to enable KVM in your workflow before running this action: ``` - name: Enable KVM group perms From 62e6348453e0418429f8bd1665801780787a7af8 Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 15 Jun 2025 03:00:24 +1000 Subject: [PATCH 2/7] Optimize config.ini updates and efficiency improvements report (#436) * Optimize config.ini updates by batching shell executions - Reduce up to 5 separate shell executions to 1 for AVD configuration - Improves performance by eliminating redundant process spawns - Add comprehensive efficiency report documenting all identified improvements - All existing tests pass, no functional changes Co-Authored-By: Yang * Add compiled JS files and remove standalone efficiency report - Include built lib/emulator-manager.js with batched config optimization - Remove EFFICIENCY_REPORT.md as requested - Efficiency report content will be moved to PR description Co-Authored-By: Yang --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Yang --- lib/emulator-manager.js | 35 +++++++++++++++++++++-------------- src/emulator-manager.ts | 37 +++++++++++++++++++++---------------- 2 files changed, 42 insertions(+), 30 deletions(-) diff --git a/lib/emulator-manager.js b/lib/emulator-manager.js index 56a6d119..ab84717f 100644 --- a/lib/emulator-manager.js +++ b/lib/emulator-manager.js @@ -50,20 +50,27 @@ function launchEmulator(systemImageApiLevel, target, arch, profile, cores, ramSi console.log(`Creating AVD.`); yield exec.exec(`sh -c \\"echo no | avdmanager create avd --force -n "${avdName}" --abi '${target}/${arch}' --package 'system-images;android-${systemImageApiLevel};${target};${arch}' ${profileOption} ${sdcardPathOrSizeOption}"`); } - if (cores) { - yield exec.exec(`sh -c \\"printf 'hw.cpu.ncore=${cores}\n' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini`); - } - if (ramSize) { - yield exec.exec(`sh -c \\"printf 'hw.ramSize=${ramSize}\n' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini`); - } - if (heapSize) { - yield exec.exec(`sh -c \\"printf 'hw.heapSize=${heapSize}\n' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini`); - } - if (enableHardwareKeyboard) { - yield exec.exec(`sh -c \\"printf 'hw.keyboard=yes\n' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini`); - } - if (diskSize) { - yield exec.exec(`sh -c \\"printf 'disk.dataPartition.size=${diskSize}\n' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini`); + if (cores || ramSize || heapSize || enableHardwareKeyboard || diskSize) { + const configEntries = []; + if (cores) { + configEntries.push(`hw.cpu.ncore=${cores}`); + } + if (ramSize) { + configEntries.push(`hw.ramSize=${ramSize}`); + } + if (heapSize) { + configEntries.push(`hw.heapSize=${heapSize}`); + } + if (enableHardwareKeyboard) { + configEntries.push('hw.keyboard=yes'); + } + if (diskSize) { + configEntries.push(`disk.dataPartition.size=${diskSize}`); + } + if (configEntries.length > 0) { + const configContent = configEntries.join('\\n') + '\\n'; + yield exec.exec(`sh -c \\"printf '${configContent}' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini"`); + } } // turn off hardware acceleration on Linux if (process.platform === 'linux' && disableLinuxHardwareAcceleration) { diff --git a/src/emulator-manager.ts b/src/emulator-manager.ts index 14684ded..44633319 100644 --- a/src/emulator-manager.ts +++ b/src/emulator-manager.ts @@ -37,24 +37,29 @@ export async function launchEmulator( ); } - if (cores) { - await exec.exec(`sh -c \\"printf 'hw.cpu.ncore=${cores}\n' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini`); - } + if (cores || ramSize || heapSize || enableHardwareKeyboard || diskSize) { + const configEntries: string[] = []; - if (ramSize) { - await exec.exec(`sh -c \\"printf 'hw.ramSize=${ramSize}\n' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini`); - } + if (cores) { + configEntries.push(`hw.cpu.ncore=${cores}`); + } + if (ramSize) { + configEntries.push(`hw.ramSize=${ramSize}`); + } + if (heapSize) { + configEntries.push(`hw.heapSize=${heapSize}`); + } + if (enableHardwareKeyboard) { + configEntries.push('hw.keyboard=yes'); + } + if (diskSize) { + configEntries.push(`disk.dataPartition.size=${diskSize}`); + } - if (heapSize) { - await exec.exec(`sh -c \\"printf 'hw.heapSize=${heapSize}\n' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini`); - } - - if (enableHardwareKeyboard) { - await exec.exec(`sh -c \\"printf 'hw.keyboard=yes\n' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini`); - } - - if (diskSize) { - await exec.exec(`sh -c \\"printf 'disk.dataPartition.size=${diskSize}\n' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini`); + if (configEntries.length > 0) { + const configContent = configEntries.join('\\n') + '\\n'; + await exec.exec(`sh -c \\"printf '${configContent}' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini"`); + } } // turn off hardware acceleration on Linux From f2bf410054295cde7983cd483e674aaa2dacc68c Mon Sep 17 00:00:00 2001 From: munrocket Date: Wed, 25 Jun 2025 18:48:55 +0400 Subject: [PATCH 3/7] Fix `pre-emulator-launch-script` (#439) --- lib/emulator-manager.js | 22 ++++++++++++++---- lib/main.js | 4 +++- src/emulator-manager.ts | 50 ++++++++++++++++++++++++++--------------- src/main.ts | 26 +++++---------------- 4 files changed, 58 insertions(+), 44 deletions(-) diff --git a/lib/emulator-manager.js b/lib/emulator-manager.js index ab84717f..d57b97e9 100644 --- a/lib/emulator-manager.js +++ b/lib/emulator-manager.js @@ -32,16 +32,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.killEmulator = exports.launchEmulator = void 0; +exports.killEmulator = exports.launchEmulator = exports.createAvd = void 0; const exec = __importStar(require("@actions/exec")); const fs = __importStar(require("fs")); /** - * Creates and launches a new AVD instance with the specified configurations. + * Creates a new AVD instance with the specified configurations. */ -function launchEmulator(systemImageApiLevel, target, arch, profile, cores, ramSize, heapSize, sdcardPathOrSize, diskSize, avdName, forceAvdCreation, emulatorBootTimeout, port, emulatorOptions, disableAnimations, disableSpellChecker, disableLinuxHardwareAcceleration, enableHardwareKeyboard) { +function createAvd(arch, avdName, cores, diskSize, enableHardwareKeyboard, forceAvdCreation, heapSize, profile, ramSize, sdcardPathOrSize, systemImageApiLevel, target) { return __awaiter(this, void 0, void 0, function* () { try { - console.log(`::group::Launch Emulator`); + console.log(`::group::Create AVD`); // create a new AVD if AVD directory does not already exist or forceAvdCreation is true const avdPath = `${process.env.ANDROID_AVD_HOME}/${avdName}.avd`; if (!fs.existsSync(avdPath) || forceAvdCreation) { @@ -72,6 +72,20 @@ function launchEmulator(systemImageApiLevel, target, arch, profile, cores, ramSi yield exec.exec(`sh -c \\"printf '${configContent}' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini"`); } } + } + finally { + console.log(`::endgroup::`); + } + }); +} +exports.createAvd = createAvd; +/** + * Launches an existing AVD instance with the specified configurations. + */ +function launchEmulator(avdName, disableAnimations, disableLinuxHardwareAcceleration, disableSpellChecker, emulatorBootTimeout, emulatorOptions, enableHardwareKeyboard, port) { + return __awaiter(this, void 0, void 0, function* () { + try { + console.log(`::group::Launch Emulator`); // turn off hardware acceleration on Linux if (process.platform === 'linux' && disableLinuxHardwareAcceleration) { console.log('Disabling Linux hardware acceleration.'); diff --git a/lib/main.js b/lib/main.js index 9bff6cbd..fd352a44 100644 --- a/lib/main.js +++ b/lib/main.js @@ -184,6 +184,8 @@ function run() { console.log(`::endgroup::`); // install SDK yield (0, sdk_installer_1.installAndroidSdk)(apiLevel, systemImageApiLevel, target, arch, channelId, emulatorBuild, ndkVersion, cmakeVersion); + // create AVD + yield (0, emulator_manager_1.createAvd)(arch, avdName, cores, diskSize, enableHardwareKeyboard, forceAvdCreation, heapSize, profile, ramSize, sdcardPathOrSize, systemImageApiLevel, target); // execute pre emulator launch script if set if (preEmulatorLaunchScripts !== undefined) { console.log(`::group::Run pre emulator launch script`); @@ -202,7 +204,7 @@ function run() { console.log(`::endgroup::`); } // launch an emulator - yield (0, emulator_manager_1.launchEmulator)(systemImageApiLevel, target, arch, profile, cores, ramSize, heapSize, sdcardPathOrSize, diskSize, avdName, forceAvdCreation, emulatorBootTimeout, port, emulatorOptions, disableAnimations, disableSpellchecker, disableLinuxHardwareAcceleration, enableHardwareKeyboard); + yield (0, emulator_manager_1.launchEmulator)(avdName, disableAnimations, disableLinuxHardwareAcceleration, disableSpellchecker, emulatorBootTimeout, emulatorOptions, enableHardwareKeyboard, port); // execute the custom script try { // move to custom working directory if set diff --git a/src/emulator-manager.ts b/src/emulator-manager.ts index 44633319..5a816162 100644 --- a/src/emulator-manager.ts +++ b/src/emulator-manager.ts @@ -2,30 +2,24 @@ import * as exec from '@actions/exec'; import * as fs from 'fs'; /** - * Creates and launches a new AVD instance with the specified configurations. + * Creates a new AVD instance with the specified configurations. */ -export async function launchEmulator( - systemImageApiLevel: string, - target: string, +export async function createAvd( arch: string, - profile: string, - cores: string, - ramSize: string, - heapSize: string, - sdcardPathOrSize: string, - diskSize: string, avdName: string, + cores: string, + diskSize: string, + enableHardwareKeyboard: boolean, forceAvdCreation: boolean, - emulatorBootTimeout: number, - port: number, - emulatorOptions: string, - disableAnimations: boolean, - disableSpellChecker: boolean, - disableLinuxHardwareAcceleration: boolean, - enableHardwareKeyboard: boolean + heapSize: string, + profile: string, + ramSize: string, + sdcardPathOrSize: string, + systemImageApiLevel: string, + target: string ): Promise { try { - console.log(`::group::Launch Emulator`); + console.log(`::group::Create AVD`); // create a new AVD if AVD directory does not already exist or forceAvdCreation is true const avdPath = `${process.env.ANDROID_AVD_HOME}/${avdName}.avd`; if (!fs.existsSync(avdPath) || forceAvdCreation) { @@ -61,6 +55,26 @@ export async function launchEmulator( await exec.exec(`sh -c \\"printf '${configContent}' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini"`); } } + } finally { + console.log(`::endgroup::`); + } +} + +/** + * Launches an existing AVD instance with the specified configurations. + */ +export async function launchEmulator( + avdName: string, + disableAnimations: boolean, + disableLinuxHardwareAcceleration: boolean, + disableSpellChecker: boolean, + emulatorBootTimeout: number, + emulatorOptions: string, + enableHardwareKeyboard: boolean, + port: number +): Promise { + try { + console.log(`::group::Launch Emulator`); // turn off hardware acceleration on Linux if (process.platform === 'linux' && disableLinuxHardwareAcceleration) { diff --git a/src/main.ts b/src/main.ts index 096f00aa..df521a57 100644 --- a/src/main.ts +++ b/src/main.ts @@ -14,7 +14,7 @@ import { checkPort, MIN_PORT, } from './input-validator'; -import { launchEmulator, killEmulator } from './emulator-manager'; +import { createAvd, launchEmulator, killEmulator } from './emulator-manager'; import * as exec from '@actions/exec'; import { parseScript } from './script-parser'; import { getChannelId } from './channel-id-mapper'; @@ -191,6 +191,9 @@ async function run() { // install SDK await installAndroidSdk(apiLevel, systemImageApiLevel, target, arch, channelId, emulatorBuild, ndkVersion, cmakeVersion); + // create AVD + await createAvd(arch, avdName, cores, diskSize, enableHardwareKeyboard, forceAvdCreation, heapSize, profile, ramSize, sdcardPathOrSize, systemImageApiLevel, target); + // execute pre emulator launch script if set if (preEmulatorLaunchScripts !== undefined) { console.log(`::group::Run pre emulator launch script`); @@ -209,26 +212,7 @@ async function run() { } // launch an emulator - await launchEmulator( - systemImageApiLevel, - target, - arch, - profile, - cores, - ramSize, - heapSize, - sdcardPathOrSize, - diskSize, - avdName, - forceAvdCreation, - emulatorBootTimeout, - port, - emulatorOptions, - disableAnimations, - disableSpellchecker, - disableLinuxHardwareAcceleration, - enableHardwareKeyboard - ); + await launchEmulator(avdName, disableAnimations, disableLinuxHardwareAcceleration, disableSpellchecker, emulatorBootTimeout, emulatorOptions, enableHardwareKeyboard, port); // execute the custom script try { From 66283c03190cd3f51c1e1d38ad4206ae99cb5afd Mon Sep 17 00:00:00 2001 From: Mike Hardy Date: Tue, 1 Jul 2025 20:45:42 -0500 Subject: [PATCH 4/7] fix: allow google_apis_ps16k as a valid target (#440) * test: remove target validator test these appear to have too much maintenance burden as they only ever add more over time * fix: allow google_apis_ps16k and google_apis_playstore_ps16k as valid targets Fixes #403 Co-authored-by: Yang * fix: remove target validation entirely, any valid sdkmanager target will work no longer requires code changes here to access new targets --------- Co-authored-by: Yang --- README.md | 2 +- __tests__/input-validator.test.ts | 71 ------------------------------- action.yml | 2 +- lib/input-validator.js | 30 +++++-------- lib/main.js | 4 +- src/input-validator.ts | 24 +++-------- src/main.ts | 6 +-- 7 files changed, 21 insertions(+), 118 deletions(-) diff --git a/README.md b/README.md index c0afc828..0c2b60ad 100644 --- a/README.md +++ b/README.md @@ -206,7 +206,7 @@ jobs: |-|-|-|-| | `api-level` | Required | N/A | API level of the platform and system image - e.g. `23`, `33`, `35-ext15`, `Baklava`. **Minimum API level supported is 15**. | | `system-image-api-level` | Optional | same as `api-level` | API level of the system image - e.g. `34-ext10`, `35-ext15`. | -| `target` | Optional | `default` | Target of the system image - `default`, `google_apis`, `playstore`, `android-wear`, `android-wear-cn`, `android-tv`, `google-tv`, `aosp_atd`, `google_atd`, `android-automotive`, `android-automotive-playstore` or `android-desktop`. Note that `aosp_atd` and `google_atd` currently require the following: `api-level: 30`, `arch: x86` or `arch: arm64-v8` and `channel: canary`. | +| `target` | Optional | `default` | Target of the system image - e.g. `default`, `google_apis`, `google_apis_ps16k`, `google_apis_playstore`, `google_apis_playstore_ps16k`, `android-wear`, `android-wear-cn`, `android-tv`, `google-tv`, `aosp_atd`, `google_atd`, `android-automotive`, `android-automotive-playstore, `android-desktop`. Please run `sdkmanager --list` to see the available targets. | | `arch` | Optional | `x86` | CPU architecture of the system image - `x86`, `x86_64` or `arm64-v8a`. Note that `x86_64` image is only available for API 21+. `arm64-v8a` images require Android 4.2+ and are limited to fewer API levels (e.g. 30). | | `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 device`. | | `cores` | Optional | 2 | Number of cores to use for the emulator (`hw.cpu.ncore` in config.ini). | diff --git a/__tests__/input-validator.test.ts b/__tests__/input-validator.test.ts index 91c40903..06850120 100644 --- a/__tests__/input-validator.test.ts +++ b/__tests__/input-validator.test.ts @@ -1,77 +1,6 @@ import * as validator from '../src/input-validator'; import { MAX_PORT, MIN_PORT } from '../src/input-validator'; -describe('target validator tests', () => { - it('Throws if target is unknown', () => { - const func = () => { - validator.checkTarget('some-target'); - }; - expect(func).toThrowError(`Value for input.target 'some-target' is unknown. Supported options: ${validator.VALID_TARGETS}`); - }); - - it('Validates successfully with valid target', () => { - const func1 = () => { - validator.checkTarget('default'); - }; - expect(func1).not.toThrow(); - - const func2 = () => { - validator.checkTarget('google_apis'); - }; - expect(func2).not.toThrow(); - - const func3 = () => { - validator.checkTarget('aosp_atd'); - }; - expect(func3).not.toThrow(); - - const func4 = () => { - validator.checkTarget('google_atd'); - }; - expect(func4).not.toThrow(); - - const func5 = () => { - validator.checkTarget('google_apis_playstore'); - }; - expect(func5).not.toThrow(); - - const func6 = () => { - validator.checkTarget('android-wear'); - }; - expect(func6).not.toThrow(); - - const func7 = () => { - validator.checkTarget('android-wear-cn'); - }; - expect(func7).not.toThrow(); - - const func8 = () => { - validator.checkTarget('android-tv'); - }; - expect(func8).not.toThrow(); - - const func9 = () => { - validator.checkTarget('google-tv'); - }; - expect(func9).not.toThrow(); - - const func10 = () => { - validator.checkTarget('android-automotive'); - }; - expect(func10).not.toThrow(); - - const func11 = () => { - validator.checkTarget('android-automotive-playstore'); - }; - expect(func11).not.toThrow(); - - const func12 = () => { - validator.checkTarget('android-desktop'); - }; - expect(func12).not.toThrow(); - }); -}); - describe('arch validator tests', () => { it('Throws if arch is unknown', () => { const func = () => { diff --git a/action.yml b/action.yml index 35dcccd6..30a20249 100644 --- a/action.yml +++ b/action.yml @@ -12,7 +12,7 @@ inputs: description: 'API level of the system image - e.g. 34-ext10, 35-ext15. If not set the `api-level` input will be used.' required: false target: - description: 'target of the system image - default, google_apis, google_apis_playstore, aosp_atd, google_atd, android-wear, android-wear-cn, android-tv, google-tv, android-automotive, android-automotive-playstore or android-desktop' + description: 'target of the system image - e.g. default, google_apis, google_apis_ps16k, google_apis_playstore, google_apis_playstore_16k, aosp_atd, google_atd, android-wear, android-wear-cn, android-tv, google-tv, android-automotive, android-automotive-playstore or android-desktop' default: 'default' arch: description: 'CPU architecture of the system image - x86, x86_64 or arm64-v8a' diff --git a/lib/input-validator.js b/lib/input-validator.js index 9960b46b..bcb4443f 100644 --- a/lib/input-validator.js +++ b/lib/input-validator.js @@ -1,31 +1,21 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.checkDiskSize = exports.checkEmulatorBuild = exports.checkEnableHardwareKeyboard = exports.checkDisableLinuxHardwareAcceleration = exports.checkDisableSpellchecker = exports.checkDisableAnimations = exports.checkPort = exports.checkForceAvdCreation = exports.checkChannel = exports.checkArch = exports.checkTarget = exports.MAX_PORT = exports.MIN_PORT = exports.VALID_CHANNELS = exports.VALID_ARCHS = exports.VALID_TARGETS = exports.MIN_API_LEVEL = void 0; +exports.checkDiskSize = exports.checkEmulatorBuild = exports.checkEnableHardwareKeyboard = exports.checkDisableLinuxHardwareAcceleration = exports.checkDisableSpellchecker = exports.checkDisableAnimations = exports.checkPort = exports.checkForceAvdCreation = exports.checkChannel = exports.checkArch = exports.playstoreTargetSubstitution = exports.MAX_PORT = exports.MIN_PORT = exports.VALID_CHANNELS = exports.VALID_ARCHS = exports.MIN_API_LEVEL = void 0; exports.MIN_API_LEVEL = 15; -exports.VALID_TARGETS = [ - 'default', - 'google_apis', - 'aosp_atd', - 'google_atd', - 'google_apis_playstore', - 'android-wear', - 'android-wear-cn', - 'android-tv', - 'google-tv', - 'android-automotive', - 'android-automotive-playstore', - 'android-desktop', -]; exports.VALID_ARCHS = ['x86', 'x86_64', 'arm64-v8a']; exports.VALID_CHANNELS = ['stable', 'beta', 'dev', 'canary']; exports.MIN_PORT = 5554; exports.MAX_PORT = 5584; -function checkTarget(target) { - if (!exports.VALID_TARGETS.includes(target)) { - throw new Error(`Value for input.target '${target}' is unknown. Supported options: ${exports.VALID_TARGETS}.`); - } +function playstoreTargetSubstitution(target) { + // "playstore" is an allowed shorthand for "google_apis_playstore" images + // this is idempotent - return same even if run multiple times on same target + if (target === 'playstore') + return 'google_apis_playstore'; + if (target === 'playstore_ps16k') + return 'google_apis_playstore_ps16k'; + return target; } -exports.checkTarget = checkTarget; +exports.playstoreTargetSubstitution = playstoreTargetSubstitution; function checkArch(arch) { if (!exports.VALID_ARCHS.includes(arch)) { throw new Error(`Value for input.arch '${arch}' is unknown. Supported options: ${exports.VALID_ARCHS}.`); diff --git a/lib/main.js b/lib/main.js index fd352a44..50e7a509 100644 --- a/lib/main.js +++ b/lib/main.js @@ -70,9 +70,7 @@ function run() { } console.log(`System image API level: ${systemImageApiLevel}`); // target of the system image - const targetInput = core.getInput('target'); - const target = targetInput == 'playstore' ? 'google_apis_playstore' : targetInput; - (0, input_validator_1.checkTarget)(target); + const target = (0, input_validator_1.playstoreTargetSubstitution)(core.getInput('target')); console.log(`target: ${target}`); // CPU architecture of the system image const arch = core.getInput('arch'); diff --git a/src/input-validator.ts b/src/input-validator.ts index e8874054..2fd0c623 100644 --- a/src/input-validator.ts +++ b/src/input-validator.ts @@ -1,27 +1,15 @@ export const MIN_API_LEVEL = 15; -export const VALID_TARGETS: Array = [ - 'default', - 'google_apis', - 'aosp_atd', - 'google_atd', - 'google_apis_playstore', - 'android-wear', - 'android-wear-cn', - 'android-tv', - 'google-tv', - 'android-automotive', - 'android-automotive-playstore', - 'android-desktop', -]; export const VALID_ARCHS: Array = ['x86', 'x86_64', 'arm64-v8a']; export const VALID_CHANNELS: Array = ['stable', 'beta', 'dev', 'canary']; export const MIN_PORT = 5554; export const MAX_PORT = 5584; -export function checkTarget(target: string): void { - if (!VALID_TARGETS.includes(target)) { - throw new Error(`Value for input.target '${target}' is unknown. Supported options: ${VALID_TARGETS}.`); - } +export function playstoreTargetSubstitution(target: string): string { + // "playstore" is an allowed shorthand for "google_apis_playstore" images + // this is idempotent - return same even if run multiple times on same target + if (target === 'playstore') return 'google_apis_playstore'; + if (target === 'playstore_ps16k') return 'google_apis_playstore_ps16k'; + return target; } export function checkArch(arch: string): void { diff --git a/src/main.ts b/src/main.ts index df521a57..8562dbcd 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,7 +1,6 @@ import * as core from '@actions/core'; import { installAndroidSdk } from './sdk-installer'; import { - checkTarget, checkArch, checkDisableAnimations, checkEmulatorBuild, @@ -12,6 +11,7 @@ import { checkEnableHardwareKeyboard, checkDiskSize, checkPort, + playstoreTargetSubstitution, MIN_PORT, } from './input-validator'; import { createAvd, launchEmulator, killEmulator } from './emulator-manager'; @@ -52,9 +52,7 @@ async function run() { console.log(`System image API level: ${systemImageApiLevel}`); // target of the system image - const targetInput = core.getInput('target'); - const target = targetInput == 'playstore' ? 'google_apis_playstore' : targetInput; - checkTarget(target); + const target = playstoreTargetSubstitution(core.getInput('target')); console.log(`target: ${target}`); // CPU architecture of the system image From b68ca169d637f9b4902ca0bcd9ff339a105e5518 Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Wed, 9 Jul 2025 12:52:11 +0200 Subject: [PATCH 5/7] README: Fix imbalanced backtick in `Configurations` table (#445) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0c2b60ad..167b6cd6 100644 --- a/README.md +++ b/README.md @@ -206,7 +206,7 @@ jobs: |-|-|-|-| | `api-level` | Required | N/A | API level of the platform and system image - e.g. `23`, `33`, `35-ext15`, `Baklava`. **Minimum API level supported is 15**. | | `system-image-api-level` | Optional | same as `api-level` | API level of the system image - e.g. `34-ext10`, `35-ext15`. | -| `target` | Optional | `default` | Target of the system image - e.g. `default`, `google_apis`, `google_apis_ps16k`, `google_apis_playstore`, `google_apis_playstore_ps16k`, `android-wear`, `android-wear-cn`, `android-tv`, `google-tv`, `aosp_atd`, `google_atd`, `android-automotive`, `android-automotive-playstore, `android-desktop`. Please run `sdkmanager --list` to see the available targets. | +| `target` | Optional | `default` | Target of the system image - e.g. `default`, `google_apis`, `google_apis_ps16k`, `google_apis_playstore`, `google_apis_playstore_ps16k`, `android-wear`, `android-wear-cn`, `android-tv`, `google-tv`, `aosp_atd`, `google_atd`, `android-automotive`, `android-automotive-playstore`, `android-desktop`. Please run `sdkmanager --list` to see the available targets. | | `arch` | Optional | `x86` | CPU architecture of the system image - `x86`, `x86_64` or `arm64-v8a`. Note that `x86_64` image is only available for API 21+. `arm64-v8a` images require Android 4.2+ and are limited to fewer API levels (e.g. 30). | | `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 device`. | | `cores` | Optional | 2 | Number of cores to use for the emulator (`hw.cpu.ncore` in config.ini). | From f9bdb6d84e729f95c25d13a8261fbab082f91ce4 Mon Sep 17 00:00:00 2001 From: Vojtech Novak Date: Thu, 11 Sep 2025 15:07:58 +0200 Subject: [PATCH 6/7] docs: update AVD profile description (#452) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 167b6cd6..7512a75c 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ jobs: api-level: ${{ matrix.api-level }} target: ${{ matrix.target }} arch: x86_64 - profile: Nexus 6 + profile: pixel_7_pro script: ./gradlew connectedCheck ``` @@ -208,7 +208,7 @@ jobs: | `system-image-api-level` | Optional | same as `api-level` | API level of the system image - e.g. `34-ext10`, `35-ext15`. | | `target` | Optional | `default` | Target of the system image - e.g. `default`, `google_apis`, `google_apis_ps16k`, `google_apis_playstore`, `google_apis_playstore_ps16k`, `android-wear`, `android-wear-cn`, `android-tv`, `google-tv`, `aosp_atd`, `google_atd`, `android-automotive`, `android-automotive-playstore`, `android-desktop`. Please run `sdkmanager --list` to see the available targets. | | `arch` | Optional | `x86` | CPU architecture of the system image - `x86`, `x86_64` or `arm64-v8a`. Note that `x86_64` image is only available for API 21+. `arm64-v8a` images require Android 4.2+ and are limited to fewer API levels (e.g. 30). | -| `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 device`. | +| `profile` | Optional | N/A | Hardware profile id used for creating the AVD - e.g. `pixel_7_pro`. For a list of all profiles available, run `avdmanager list device`. | | `cores` | Optional | 2 | Number of cores to use for the emulator (`hw.cpu.ncore` in config.ini). | | `ram-size` | Optional | N/A | Size of RAM to use for this AVD, in KB or MB, denoted with K or M. - e.g. `2048M` | | `heap-size` | Optional | N/A | Heap size to use for this AVD, in KB or MB, denoted with K or M. - e.g. `512M` | From 016d4d097aac9b934d2aec7e97cedaa099e8a3e2 Mon Sep 17 00:00:00 2001 From: Yang Date: Fri, 7 Nov 2025 12:32:15 +1100 Subject: [PATCH 7/7] Prepare for release 2.35.0. --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10e85ecb..9acefecd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,11 @@ ## Unreleased -No changes yet. +## v2.35.0 + +* Optimize config.ini updates and efficiency improvements report (#436). +* Fix `pre-emulator-launch-script` (#439). +* Allow `google_apis_ps16k` as a valid target (#440). ## v2.34.0