Skip to content

Commit

Permalink
Merge branch 'main' into release/v2
Browse files Browse the repository at this point in the history
* main:
  Prepare for release 2.24.0.
  Add option to specify AVD heap size (#245)
  Gradle 7.4.2.
  Bump GH actions (#240)
  Bump minimist from 1.2.5 to 1.2.6 (#237)
  Update dependencies in test-fixture.
  Add more .gitignore rules (#231)
  Update README for using with gradle/gradle-build-action (#230)
  • Loading branch information
ychescale9 committed Apr 30, 2022
2 parents 76c2bf6 + f30ff06 commit e790971
Show file tree
Hide file tree
Showing 19 changed files with 120 additions and 101 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/manually.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,13 @@ typings/

# DynamoDB Local files
.dynamodb/

# Mac
.DS_Store

# Vscode
.vscode

# IntelliJ IDEA
.idea
*.iml
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
35 changes: 16 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ 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
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: run tests
uses: reactivecircus/android-emulator-runner@v2
Expand All @@ -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
Expand All @@ -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
Expand All @@ -67,13 +67,13 @@ jobs:
If you need specific versions of **NDK** and **CMake** installed:
```
```yml
jobs:
test:
runs-on: macos-latest
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: run tests
uses: reactivecircus/android-emulator-runner@v2
Expand All @@ -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 Gradle, more details see [#229](https://github.com/ReactiveCircus/android-emulator-runner/issues/229)
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`

```
```yml
jobs:
test:
runs-on: macos-latest
Expand All @@ -99,18 +100,13 @@ jobs:
api-level: [21, 23, 29]
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- 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
uses: actions/cache@v3
id: avd-cache
with:
path: |
Expand Down Expand Up @@ -148,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. |
Expand Down
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion lib/emulator-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand All @@ -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`);
}
Expand Down
5 changes: 4 additions & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions node_modules/minimist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 22 additions & 57 deletions node_modules/minimist/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion node_modules/minimist/readme.markdown

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions node_modules/minimist/test/proto.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e790971

Please sign in to comment.