Skip to content

Commit 4a8a9af

Browse files
committed
Merge branch 'main' into release/v2
* main: Prepare for release 2.11.0. Support running multiple actions sequentially in a single job. Add RxBinding to adopter list. Rename master branch to main.
2 parents b62c970 + a72b5eb commit 4a8a9af

File tree

6 files changed

+67
-42
lines changed

6 files changed

+67
-42
lines changed

.github/workflows/workflow.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ on:
33
pull_request:
44
push:
55
branches:
6-
- master
6+
- main
77
paths-ignore:
88
- '**.md'
99

1010
jobs:
1111
test:
1212
runs-on: ${{ matrix.os }}
13+
env:
14+
JAVA_TOOL_OPTIONS: -Xmx4g
1315
timeout-minutes: 15
1416
strategy:
1517
matrix:
@@ -49,9 +51,6 @@ jobs:
4951
uses: actions/setup-java@v1
5052
with:
5153
java-version: 14
52-
- name: Clean cache
53-
if: matrix.os == 'macos-latest'
54-
run: mv ~/.gradle/caches ~/.gradle/.invalid_caches
5554
- uses: actions/cache@v1
5655
with:
5756
path: ~/.gradle/caches

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## v2.11.0
4+
5+
* Support running multiple instances of the action sequentially in a single job - [#73](https://github.com/ReactiveCircus/android-emulator-runner/issues/73).
6+
37
## v2.10.0
48

59
* Support Android 11 (API 30) system images.

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,16 @@ These are some of the open-source projects using (or used) **Android Emulator Ru
116116

117117
- [coil-kt/coil](https://github.com/coil-kt/coil/blob/master/.github/workflows/)
118118
- [cashapp/sqldelight](https://github.com/cashapp/sqldelight/blob/master/.github/workflows/)
119-
- [square/workflow](https://github.com/square/workflow/blob/master/.github/workflows/)
119+
- [square/workflow](https://github.com/square/workflow/blob/main/.github/workflows/)
120120
- [square/retrofit](https://github.com/square/retrofit/blob/master/.github/workflows/)
121121
- [natario1/CameraView](https://github.com/natario1/CameraView/tree/master/.github/workflows)
122122
- [natario1/Transcoder](https://github.com/natario1/Transcoder/tree/master/.github/workflows)
123-
- [chrisbanes/insetter](https://github.com/chrisbanes/insetter/tree/master/.github/workflows)
124-
- [slackhq/keeper](https://github.com/slackhq/keeper/tree/master/.github/workflows)
123+
- [chrisbanes/insetter](https://github.com/chrisbanes/insetter/tree/main/.github/workflows)
124+
- [slackhq/keeper](https://github.com/slackhq/keeper/tree/main/.github/workflows)
125125
- [android/compose-samples](https://github.com/android/compose-samples/blob/master/.github/workflows/ci.yaml)
126-
- [ReactiveCircus/streamlined](https://github.com/ReactiveCircus/streamlined/tree/master/.github/workflows)
126+
- [ReactiveCircus/streamlined](https://github.com/ReactiveCircus/streamlined/tree/main/.github/workflows)
127127
- [ReactiveCircus/FlowBinding](https://github.com/ReactiveCircus/FlowBinding)
128+
- [JakeWharton/RxBinding](https://github.com/JakeWharton/RxBinding/tree/master/.github/workflows)
128129
- [vinaygaba/Learn-Jetpack-Compose-By-Example](https://github.com/vinaygaba/Learn-Jetpack-Compose-By-Example/)
129130
- [ashishb/adb-enhanced](https://github.com/ashishb/adb-enhanced/tree/master/.github/workflows)
130131
- [vgaidarji/ci-matters](https://github.com/vgaidarji/ci-matters/blob/master/.github/workflows/main.yaml)

RELEASING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Refer to the [recommendeations for versioning and releasing actions](https://git
44

55
## New major release
66

7-
- From `master` branch, run `npm run build && npm test --clean && npm run lint` to make sure `lib/*.js` are up-to-date.
7+
- From `main` branch, run `npm run build && npm test --clean && npm run lint` to make sure `lib/*.js` are up-to-date.
88
- Update `CHANGELOG.md`, push change with "Prepare for release X.Y.Z." (where X.Y.Z is the new version).
99
- Create a new branch e.g. `release/v1`, comment out `node_modules/` in `.gitignore`, commit the change (do not commit yet `node_modules`).
1010
- Run `npm prune --production`.
@@ -17,9 +17,9 @@ Refer to the [recommendeations for versioning and releasing actions](https://git
1717

1818
## New minor / patch release
1919

20-
- From `master` branch, run `npm run build && npm test --clean && npm run lint` to make sure `lib/*.js` are up-to-date.
20+
- From `main` branch, run `npm run build && npm test --clean && npm run lint` to make sure `lib/*.js` are up-to-date.
2121
- Update `CHANGELOG.md`, push change with "Prepare for release X.Y.Z." (where X.Y.Z is the new version).
22-
- Merge from `master` into the release branch e.g. `release/v1`.
22+
- Merge from `main` into the release branch e.g. `release/v1`.
2323
- Run `npm prune --production`.
2424
- Commit merged changes (and the pruned `node_modules`).
2525
- Push to remote.

lib/sdk-installer.js

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
1717
Object.defineProperty(exports, "__esModule", { value: true });
1818
const core = __importStar(require("@actions/core"));
1919
const exec = __importStar(require("@actions/exec"));
20+
const io = __importStar(require("@actions/io"));
21+
const fs = __importStar(require("fs"));
2022
const BUILD_TOOLS_VERSION = '30.0.0';
2123
const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-6514223_latest.zip';
2224
const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-6514223_latest.zip';
@@ -27,31 +29,38 @@ const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/comman
2729
function installAndroidSdk(apiLevel, target, arch, emulatorBuild, ndkVersion, cmakeVersion) {
2830
return __awaiter(this, void 0, void 0, function* () {
2931
const isOnMac = process.platform === 'darwin';
30-
console.log('Installing new cmdline-tools.');
31-
const sdkUrl = isOnMac ? CMDLINE_TOOLS_URL_MAC : CMDLINE_TOOLS_URL_LINUX;
32-
yield exec.exec(`sudo mkdir ${process.env.ANDROID_HOME}/cmdline-tools`);
33-
yield exec.exec(`curl -fo commandlinetools.zip ${sdkUrl}`);
34-
yield exec.exec(`sudo unzip -q commandlinetools.zip -d ${process.env.ANDROID_HOME}/cmdline-tools`);
35-
yield exec.exec(`sudo rm -f commandlinetools.zip`);
36-
// add paths for commandline-tools and platform-tools
37-
core.addPath(`${process.env.ANDROID_HOME}/cmdline-tools/tools:${process.env.ANDROID_HOME}/cmdline-tools/tools/bin:${process.env.ANDROID_HOME}/platform-tools`);
38-
// additional permission and license requirements for Linux
3932
if (!isOnMac) {
4033
yield exec.exec(`sh -c \\"sudo chown $USER:$USER ${process.env.ANDROID_HOME} -R`);
41-
yield exec.exec(`sh -c \\"echo -e '\n84831b9409646a918e30573bab4c9c91346d8abd' > ${process.env.ANDROID_HOME}/licenses/android-sdk-preview-license"`);
34+
}
35+
const cmdlineToolsPath = `${process.env.ANDROID_HOME}/cmdline-tools`;
36+
if (!fs.existsSync(cmdlineToolsPath)) {
37+
console.log('Installing new cmdline-tools.');
38+
const sdkUrl = isOnMac ? CMDLINE_TOOLS_URL_MAC : CMDLINE_TOOLS_URL_LINUX;
39+
yield io.mkdirP(`${process.env.ANDROID_HOME}/cmdline-tools`);
40+
yield exec.exec(`curl -fo commandlinetools.zip ${sdkUrl}`);
41+
yield exec.exec(`unzip -q commandlinetools.zip -d ${cmdlineToolsPath}`);
42+
yield io.rmRF('commandlinetools.zip');
43+
// add paths for commandline-tools and platform-tools
44+
core.addPath(`${cmdlineToolsPath}/tools:${cmdlineToolsPath}/tools/bin:${process.env.ANDROID_HOME}/platform-tools`);
45+
}
46+
// additional permission and license requirements for Linux
47+
const sdkPreviewLicensePath = `${process.env.ANDROID_HOME}/licenses/android-sdk-preview-license`;
48+
if (!isOnMac && !fs.existsSync(sdkPreviewLicensePath)) {
49+
yield exec.exec(`sh -c \\"echo -e '\n84831b9409646a918e30573bab4c9c91346d8abd' > ${sdkPreviewLicensePath}"`);
4250
}
4351
// license required for API 30 system images
44-
if (apiLevel == 30) {
45-
yield exec.exec(`sh -c \\"echo -e '\n859f317696f67ef3d7f30a50a5560e7834b43903' > ${process.env.ANDROID_HOME}/licenses/android-sdk-arm-dbt-license"`);
52+
const sdkArmDbtLicensePath = `${process.env.ANDROID_HOME}/licenses/android-sdk-arm-dbt-license`;
53+
if (apiLevel == 30 && !fs.existsSync(sdkArmDbtLicensePath)) {
54+
yield exec.exec(`sh -c \\"echo -e '\n859f317696f67ef3d7f30a50a5560e7834b43903' > ${sdkArmDbtLicensePath}"`);
4655
}
4756
console.log('Installing latest build tools, platform tools, and platform.');
4857
yield exec.exec(`sh -c \\"sdkmanager --install 'build-tools;${BUILD_TOOLS_VERSION}' platform-tools 'platforms;android-${apiLevel}' > /dev/null"`);
4958
if (emulatorBuild) {
5059
console.log(`Installing emulator build ${emulatorBuild}.`);
5160
yield exec.exec(`curl -fo emulator.zip https://dl.google.com/android/repository/emulator-${isOnMac ? 'darwin' : 'linux'}-${emulatorBuild}.zip`);
52-
yield exec.exec(`sudo rm -rf ${process.env.ANDROID_HOME}/emulator`);
53-
yield exec.exec(`sudo unzip -q emulator.zip -d ${process.env.ANDROID_HOME}`);
54-
yield exec.exec(`sudo rm -f emulator.zip`);
61+
yield io.rmRF(`${process.env.ANDROID_HOME}/emulator`);
62+
yield exec.exec(`unzip -q emulator.zip -d ${process.env.ANDROID_HOME}`);
63+
yield io.rmRF('emulator.zip');
5564
}
5665
else {
5766
console.log('Installing latest emulator.');

src/sdk-installer.ts

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import * as core from '@actions/core';
22
import * as exec from '@actions/exec';
3+
import * as io from '@actions/io';
4+
import * as fs from 'fs';
35

46
const BUILD_TOOLS_VERSION = '30.0.0';
57
const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-6514223_latest.zip';
@@ -11,24 +13,34 @@ const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/comman
1113
*/
1214
export async function installAndroidSdk(apiLevel: number, target: string, arch: string, emulatorBuild?: string, ndkVersion?: string, cmakeVersion?: string): Promise<void> {
1315
const isOnMac = process.platform === 'darwin';
14-
console.log('Installing new cmdline-tools.');
15-
const sdkUrl = isOnMac ? CMDLINE_TOOLS_URL_MAC : CMDLINE_TOOLS_URL_LINUX;
16-
await exec.exec(`sudo mkdir ${process.env.ANDROID_HOME}/cmdline-tools`);
17-
await exec.exec(`curl -fo commandlinetools.zip ${sdkUrl}`);
18-
await exec.exec(`sudo unzip -q commandlinetools.zip -d ${process.env.ANDROID_HOME}/cmdline-tools`);
19-
await exec.exec(`sudo rm -f commandlinetools.zip`);
2016

21-
// add paths for commandline-tools and platform-tools
22-
core.addPath(`${process.env.ANDROID_HOME}/cmdline-tools/tools:${process.env.ANDROID_HOME}/cmdline-tools/tools/bin:${process.env.ANDROID_HOME}/platform-tools`);
23-
24-
// additional permission and license requirements for Linux
2517
if (!isOnMac) {
2618
await exec.exec(`sh -c \\"sudo chown $USER:$USER ${process.env.ANDROID_HOME} -R`);
27-
await exec.exec(`sh -c \\"echo -e '\n84831b9409646a918e30573bab4c9c91346d8abd' > ${process.env.ANDROID_HOME}/licenses/android-sdk-preview-license"`);
2819
}
20+
21+
const cmdlineToolsPath = `${process.env.ANDROID_HOME}/cmdline-tools`;
22+
if (!fs.existsSync(cmdlineToolsPath)) {
23+
console.log('Installing new cmdline-tools.');
24+
const sdkUrl = isOnMac ? CMDLINE_TOOLS_URL_MAC : CMDLINE_TOOLS_URL_LINUX;
25+
await io.mkdirP(`${process.env.ANDROID_HOME}/cmdline-tools`);
26+
await exec.exec(`curl -fo commandlinetools.zip ${sdkUrl}`);
27+
await exec.exec(`unzip -q commandlinetools.zip -d ${cmdlineToolsPath}`);
28+
await io.rmRF('commandlinetools.zip');
29+
30+
// add paths for commandline-tools and platform-tools
31+
core.addPath(`${cmdlineToolsPath}/tools:${cmdlineToolsPath}/tools/bin:${process.env.ANDROID_HOME}/platform-tools`);
32+
}
33+
34+
// additional permission and license requirements for Linux
35+
const sdkPreviewLicensePath = `${process.env.ANDROID_HOME}/licenses/android-sdk-preview-license`;
36+
if (!isOnMac && !fs.existsSync(sdkPreviewLicensePath)) {
37+
await exec.exec(`sh -c \\"echo -e '\n84831b9409646a918e30573bab4c9c91346d8abd' > ${sdkPreviewLicensePath}"`);
38+
}
39+
2940
// license required for API 30 system images
30-
if (apiLevel == 30) {
31-
await exec.exec(`sh -c \\"echo -e '\n859f317696f67ef3d7f30a50a5560e7834b43903' > ${process.env.ANDROID_HOME}/licenses/android-sdk-arm-dbt-license"`);
41+
const sdkArmDbtLicensePath = `${process.env.ANDROID_HOME}/licenses/android-sdk-arm-dbt-license`;
42+
if (apiLevel == 30 && !fs.existsSync(sdkArmDbtLicensePath)) {
43+
await exec.exec(`sh -c \\"echo -e '\n859f317696f67ef3d7f30a50a5560e7834b43903' > ${sdkArmDbtLicensePath}"`);
3244
}
3345

3446
console.log('Installing latest build tools, platform tools, and platform.');
@@ -37,9 +49,9 @@ export async function installAndroidSdk(apiLevel: number, target: string, arch:
3749
if (emulatorBuild) {
3850
console.log(`Installing emulator build ${emulatorBuild}.`);
3951
await exec.exec(`curl -fo emulator.zip https://dl.google.com/android/repository/emulator-${isOnMac ? 'darwin' : 'linux'}-${emulatorBuild}.zip`);
40-
await exec.exec(`sudo rm -rf ${process.env.ANDROID_HOME}/emulator`);
41-
await exec.exec(`sudo unzip -q emulator.zip -d ${process.env.ANDROID_HOME}`);
42-
await exec.exec(`sudo rm -f emulator.zip`);
52+
await io.rmRF(`${process.env.ANDROID_HOME}/emulator`);
53+
await exec.exec(`unzip -q emulator.zip -d ${process.env.ANDROID_HOME}`);
54+
await io.rmRF('emulator.zip');
4355
} else {
4456
console.log('Installing latest emulator.');
4557
await exec.exec(`sh -c \\"sdkmanager --install emulator > /dev/null"`);

0 commit comments

Comments
 (0)