From 20da7eafacd8ab9c7af03b471c23d7f2eeaae287 Mon Sep 17 00:00:00 2001 From: Goooler Date: Fri, 4 Mar 2022 13:31:00 +0800 Subject: [PATCH 1/8] Update README for using with gradle/gradle-build-action (#230) * Update README for using with gradle/gradle-build-action * Code highlighting in README * Add a step in the snippet --- README.md | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 0864cff06..008350d70 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ It is recommended to run this action on a **macOS** VM, e.g. `macos-latest`, `ma A workflow that uses **android-emulator-runner** to run your instrumented tests on **API 29**: -``` +```yml jobs: test: runs-on: macos-latest @@ -43,7 +43,7 @@ jobs: We can also leverage GitHub Actions's build matrix to test across multiple configurations: -``` +```yml jobs: test: runs-on: macos-latest @@ -67,7 +67,7 @@ jobs: If you need specific versions of **NDK** and **CMake** installed: -``` +```yml jobs: test: runs-on: macos-latest @@ -86,11 +86,12 @@ jobs: We can significantly reduce emulator startup time by setting up AVD snapshot caching: -1. add an `actions/cache@v2` step for caching the `avd` -2. add a `reactivecircus/android-emulator-runner@v2` step to generate a clean snapshot - specify `emulator-options` without `no-snapshot` -3. add another `reactivecircus/android-emulator-runner@v2` step to run your tests using existing AVD / snapshot - specify `emulator-options` with `no-snapshot-save` +1. add a `gradle/gradle-build-action@v2` step for caching the Gradle, more details see [#229](https://github.com/ReactiveCircus/android-emulator-runner/issues/229) +2. add an `actions/cache@v2` step for caching the `avd` +3. add a `reactivecircus/android-emulator-runner@v2` step to generate a clean snapshot - specify `emulator-options` without `no-snapshot` +4. add another `reactivecircus/android-emulator-runner@v2` step to run your tests using existing AVD / snapshot - specify `emulator-options` with `no-snapshot-save` -``` +```yml jobs: test: runs-on: macos-latest @@ -102,13 +103,8 @@ jobs: uses: actions/checkout@v2 - name: Gradle cache - uses: actions/cache@v2 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} - + uses: gradle/gradle-build-action@v2 + - name: AVD cache uses: actions/cache@v2 id: avd-cache From a24195edb92a157552c215dca5003d5a78866730 Mon Sep 17 00:00:00 2001 From: Goooler Date: Fri, 4 Mar 2022 13:31:18 +0800 Subject: [PATCH 2/8] Add more .gitignore rules (#231) * Add more .gitignore rules * Update .gitignore --- .gitignore | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.gitignore b/.gitignore index ffdd18cd9..214c07925 100644 --- a/.gitignore +++ b/.gitignore @@ -91,3 +91,13 @@ typings/ # DynamoDB Local files .dynamodb/ + +# Mac +.DS_Store + +# Vscode +.vscode + +# IntelliJ IDEA +.idea +*.iml From aacab61b7225ec69233bec09c4cadb0e72a54aa2 Mon Sep 17 00:00:00 2001 From: Yang Date: Fri, 4 Mar 2022 16:33:10 +1100 Subject: [PATCH 3/8] Update dependencies in test-fixture. --- README.md | 2 +- test-fixture/build.gradle | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 008350d70..e7a4ece9b 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ jobs: We can significantly reduce emulator startup time by setting up AVD snapshot caching: -1. add a `gradle/gradle-build-action@v2` step for caching the Gradle, more details see [#229](https://github.com/ReactiveCircus/android-emulator-runner/issues/229) +1. add a `gradle/gradle-build-action@v2` step for caching Gradle, more details see [#229](https://github.com/ReactiveCircus/android-emulator-runner/issues/229) 2. add an `actions/cache@v2` step for caching the `avd` 3. add a `reactivecircus/android-emulator-runner@v2` step to generate a clean snapshot - specify `emulator-options` without `no-snapshot` 4. add another `reactivecircus/android-emulator-runner@v2` step to run your tests using existing AVD / snapshot - specify `emulator-options` with `no-snapshot-save` diff --git a/test-fixture/build.gradle b/test-fixture/build.gradle index f288a804a..8422a812b 100644 --- a/test-fixture/build.gradle +++ b/test-fixture/build.gradle @@ -1,13 +1,13 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.5.30' + ext.kotlin_version = '1.6.10' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:7.0.1' + classpath 'com.android.tools.build:gradle:7.1.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong From 280a99ecb8f7d13cc68c237aada8604af3184e78 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Apr 2022 00:26:40 +1000 Subject: [PATCH 4/8] Bump minimist from 1.2.5 to 1.2.6 (#237) Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6. - [Release notes](https://github.com/substack/minimist/releases) - [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6) --- updated-dependencies: - dependency-name: minimist dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7018fc8d1..5ea042408 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@actions/core": "^1.6.0", "@actions/exec": "^1.1.0", "@actions/tool-cache": "^1.7.1", - "minimist": "^1.2.5", + "minimist": "^1.2.6", "set-value": "^4.1.0" }, "devDependencies": { @@ -8508,9 +8508,9 @@ } }, "node_modules/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" }, "node_modules/mixin-deep": { "version": "1.3.2", @@ -17432,9 +17432,9 @@ } }, "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" }, "mixin-deep": { "version": "1.3.2", diff --git a/package.json b/package.json index 50471ed8f..26ef20f1e 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "@actions/core": "^1.6.0", "@actions/exec": "^1.1.0", "@actions/tool-cache": "^1.7.1", - "minimist": "^1.2.5", + "minimist": "^1.2.6", "set-value": "^4.1.0" }, "devDependencies": { From 4ea6abdd76a4cb61cde5b218985eb8ab2b070f23 Mon Sep 17 00:00:00 2001 From: Goooler Date: Wed, 6 Apr 2022 22:43:35 +0800 Subject: [PATCH 5/8] Bump GH actions (#240) --- .github/workflows/main.yml | 7 ++++--- .github/workflows/manually.yml | 7 ++++--- README.md | 12 ++++++------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 79b7921a2..1a00bb6fb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,7 +48,7 @@ jobs: steps: - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: validate gradle wrapper uses: gradle/wrapper-validation-action@v1 @@ -61,10 +61,11 @@ jobs: npm test - name: Java 15 - uses: actions/setup-java@v1 + uses: actions/setup-java@v3 with: + distribution: 'zulu' java-version: 15 - - uses: actions/cache@v2 + - uses: actions/cache@v3 id: avd-cache with: path: | diff --git a/.github/workflows/manually.yml b/.github/workflows/manually.yml index 3f7da86be..5b1338f3d 100644 --- a/.github/workflows/manually.yml +++ b/.github/workflows/manually.yml @@ -39,7 +39,7 @@ jobs: steps: - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: validate gradle wrapper uses: gradle/wrapper-validation-action@v1 @@ -52,10 +52,11 @@ jobs: npm test - name: Java 15 - uses: actions/setup-java@v1 + uses: actions/setup-java@v3 with: + distribution: 'zulu' java-version: 15 - - uses: actions/cache@v2 + - uses: actions/cache@v3 with: path: | ~/.gradle/caches diff --git a/README.md b/README.md index e7a4ece9b..838be7ed7 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ jobs: runs-on: macos-latest steps: - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: run tests uses: reactivecircus/android-emulator-runner@v2 @@ -53,7 +53,7 @@ jobs: target: [default, google_apis] steps: - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: run tests uses: reactivecircus/android-emulator-runner@v2 @@ -73,7 +73,7 @@ jobs: runs-on: macos-latest steps: - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: run tests uses: reactivecircus/android-emulator-runner@v2 @@ -87,7 +87,7 @@ jobs: We can significantly reduce emulator startup time by setting up AVD snapshot caching: 1. add a `gradle/gradle-build-action@v2` step for caching Gradle, more details see [#229](https://github.com/ReactiveCircus/android-emulator-runner/issues/229) -2. add an `actions/cache@v2` step for caching the `avd` +2. add an `actions/cache@v3` step for caching the `avd` 3. add a `reactivecircus/android-emulator-runner@v2` step to generate a clean snapshot - specify `emulator-options` without `no-snapshot` 4. add another `reactivecircus/android-emulator-runner@v2` step to run your tests using existing AVD / snapshot - specify `emulator-options` with `no-snapshot-save` @@ -100,13 +100,13 @@ jobs: api-level: [21, 23, 29] steps: - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Gradle cache uses: gradle/gradle-build-action@v2 - name: AVD cache - uses: actions/cache@v2 + uses: actions/cache@v3 id: avd-cache with: path: | From 689ee971a801073b2376fbf3961434353bb0701e Mon Sep 17 00:00:00 2001 From: Yang Date: Sat, 16 Apr 2022 01:29:20 +1000 Subject: [PATCH 6/8] Gradle 7.4.2. --- test-fixture/gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-fixture/gradle/wrapper/gradle-wrapper.properties b/test-fixture/gradle/wrapper/gradle-wrapper.properties index 991c63eac..ab4bea5b5 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-7.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip From cc3dd8cbef727c9379a539440f0a768a48b5d1e4 Mon Sep 17 00:00:00 2001 From: Tim Malseed Date: Tue, 26 Apr 2022 23:36:59 +1000 Subject: [PATCH 7/8] Add option to specify AVD heap size (#245) --- README.md | 1 + action.yml | 2 ++ lib/emulator-manager.js | 5 ++++- lib/main.js | 5 ++++- src/emulator-manager.ts | 5 +++++ src/main.ts | 5 +++++ 6 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 838be7ed7..1ebb922cd 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,7 @@ jobs: | `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). | | `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` | | `sdcard-path-or-size` | Optional | N/A | Path to the SD card image for this AVD or the size of a new SD card image to create for this AVD, in KB or MB, denoted with K or M. - e.g. `path/to/sdcard`, or `1000M`. | | `disk-size` | Optional | N/A | Disk size to use for this AVD. Either in bytes or KB, MB or GB, when denoted with K, M or G. - e.g. `2048M` | | `avd-name` | Optional | `test` | Custom AVD name used for creating the Android Virtual Device. | diff --git a/action.yml b/action.yml index e8b418f65..12ae7a15d 100644 --- a/action.yml +++ b/action.yml @@ -21,6 +21,8 @@ inputs: default: 2 ram-size: description: 'size of RAM to use for this AVD, in KB or MB, denoted with K or M. - e.g. `2048M`' + heap-size: + description: 'size of heap to use for this AVD in MB. - e.g. `512M`' sdcard-path-or-size: description: 'path to the SD card image for this AVD or the size of a new SD card image to create for this AVD, in KB or MB, denoted with K or M. - e.g. `path/to/sdcard`, or `1000M`' disk-size: diff --git a/lib/emulator-manager.js b/lib/emulator-manager.js index 564c812d7..e4be85ea6 100644 --- a/lib/emulator-manager.js +++ b/lib/emulator-manager.js @@ -35,7 +35,7 @@ const EMULATOR_BOOT_TIMEOUT_SECONDS = 600; /** * Creates and launches a new AVD instance with the specified configurations. */ -function launchEmulator(apiLevel, target, arch, profile, cores, ramSize, sdcardPathOrSize, diskSize, avdName, forceAvdCreation, emulatorOptions, disableAnimations, disableSpellChecker, disableLinuxHardwareAcceleration, enableHardwareKeyboard) { +function launchEmulator(apiLevel, target, arch, profile, cores, ramSize, heapSize, sdcardPathOrSize, diskSize, avdName, forceAvdCreation, emulatorOptions, disableAnimations, disableSpellChecker, disableLinuxHardwareAcceleration, enableHardwareKeyboard) { return __awaiter(this, void 0, void 0, function* () { try { console.log(`::group::Launch Emulator`); @@ -53,6 +53,9 @@ function launchEmulator(apiLevel, target, arch, profile, cores, ramSize, sdcardP 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`); } diff --git a/lib/main.js b/lib/main.js index 59e6aca0b..1ac0a0daa 100644 --- a/lib/main.js +++ b/lib/main.js @@ -71,6 +71,9 @@ function run() { // RAM to use for AVD const ramSize = core.getInput('ram-size'); console.log(`RAM size: ${ramSize}`); + // Heap size to use for AVD + const heapSize = core.getInput('heap-size'); + console.log(`Heap size: ${heapSize}`); // SD card path or size used for creating the AVD const sdcardPathOrSize = core.getInput('sdcard-path-or-size'); console.log(`SD card path or size: ${sdcardPathOrSize}`); @@ -149,7 +152,7 @@ function run() { // install SDK yield sdk_installer_1.installAndroidSdk(apiLevel, target, arch, channelId, emulatorBuild, ndkVersion, cmakeVersion); // launch an emulator - yield emulator_manager_1.launchEmulator(apiLevel, target, arch, profile, cores, ramSize, sdcardPathOrSize, diskSize, avdName, forceAvdCreation, emulatorOptions, disableAnimations, disableSpellchecker, disableLinuxHardwareAcceleration, enableHardwareKeyboard); + yield emulator_manager_1.launchEmulator(apiLevel, target, arch, profile, cores, ramSize, heapSize, sdcardPathOrSize, diskSize, avdName, forceAvdCreation, emulatorOptions, disableAnimations, disableSpellchecker, disableLinuxHardwareAcceleration, enableHardwareKeyboard); // 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 6ee896141..ba7490d6e 100644 --- a/src/emulator-manager.ts +++ b/src/emulator-manager.ts @@ -13,6 +13,7 @@ export async function launchEmulator( profile: string, cores: string, ramSize: string, + heapSize: string, sdcardPathOrSize: string, diskSize: string, avdName: string, @@ -44,6 +45,10 @@ export async function launchEmulator( await exec.exec(`sh -c \\"printf 'hw.ramSize=${ramSize}\n' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini`); } + 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`); } diff --git a/src/main.ts b/src/main.ts index 325d1f14e..13fd80281 100644 --- a/src/main.ts +++ b/src/main.ts @@ -61,6 +61,10 @@ async function run() { const ramSize = core.getInput('ram-size'); console.log(`RAM size: ${ramSize}`); + // Heap size to use for AVD + const heapSize = core.getInput('heap-size'); + console.log(`Heap size: ${heapSize}`); + // SD card path or size used for creating the AVD const sdcardPathOrSize = core.getInput('sdcard-path-or-size'); console.log(`SD card path or size: ${sdcardPathOrSize}`); @@ -162,6 +166,7 @@ async function run() { profile, cores, ramSize, + heapSize, sdcardPathOrSize, diskSize, avdName, From f30ff064b175a0b036d3bcecfef8dbe0dddcf15d Mon Sep 17 00:00:00 2001 From: Yang Date: Sat, 30 Apr 2022 23:20:42 +1000 Subject: [PATCH 8/8] Prepare for release 2.24.0. --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9ae475c6..646a708ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## v2.24.0 + +* Add option to specify `heap-size` for the AVD. - [#245](https://github.com/ReactiveCircus/android-emulator-runner/pull/245) @timusus. + ## v2.23.0 * Update build tools to `32.0.0`. - [#212](https://github.com/ReactiveCircus/android-emulator-runner/pull/212)