mirror of
https://github.com/reactivecircus/android-emulator-runner.git
synced 2026-09-03 19:09:32 +00:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bdf1f83901 | |||
| d3a226f97f | |||
| 4082c705ad | |||
| 5dd12aaed5 | |||
| e53c6d9838 | |||
| cb6efbb995 | |||
| 97f77e3305 | |||
| 128c6a83e1 | |||
| d27f7ec817 | |||
| 1162b6cd2f | |||
| e756009f0d | |||
| 2c5dfd9240 |
@@ -16,9 +16,10 @@ jobs:
|
|||||||
api-level: [21, 23, 29]
|
api-level: [21, 23, 29]
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v2
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
- name: validate gradle wrapper
|
||||||
|
uses: gradle/wrapper-validation-action@v1
|
||||||
|
|
||||||
- name: build, test and lint
|
- name: build, test and lint
|
||||||
run: |
|
run: |
|
||||||
@@ -30,6 +31,11 @@ jobs:
|
|||||||
- name: Prepare test fixture
|
- name: Prepare test fixture
|
||||||
run: cp -a ./test-fixture/* ./
|
run: cp -a ./test-fixture/* ./
|
||||||
|
|
||||||
|
- name: Java 13
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 13
|
||||||
|
|
||||||
- name: run action
|
- name: run action
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -40,5 +46,6 @@ jobs:
|
|||||||
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none
|
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none
|
||||||
disable-animations: true
|
disable-animations: true
|
||||||
script: |
|
script: |
|
||||||
|
echo $GITHUB_REPOSITORY
|
||||||
./gradlew help
|
./gradlew help
|
||||||
./gradlew connectedDebugAndroidTest
|
./gradlew connectedDebugAndroidTest
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## v2.3.2
|
||||||
|
|
||||||
|
* Fixed an issue where environment variables are escaped in script.
|
||||||
|
|
||||||
|
## v2.3.1
|
||||||
|
|
||||||
|
* Bumped Android Build tools to 29.0.3.
|
||||||
|
|
||||||
|
## v2.3.0
|
||||||
|
|
||||||
|
* Added support for running the action with Java 9+ by forcing SDK manager and AVD manager to use Java 8.
|
||||||
|
|
||||||
## v2.2.0
|
## v2.2.0
|
||||||
|
|
||||||
* Fixed an issue where emulator is killed prematurely.
|
* Fixed an issue where emulator is killed prematurely.
|
||||||
|
|||||||
@@ -32,9 +32,7 @@ jobs:
|
|||||||
runs-on: macOS-latest
|
runs-on: macOS-latest
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v2
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: run tests
|
- name: run tests
|
||||||
uses: reactivecircus/android-emulator-runner@v2
|
uses: reactivecircus/android-emulator-runner@v2
|
||||||
@@ -55,9 +53,7 @@ jobs:
|
|||||||
target: [default, google_apis]
|
target: [default, google_apis]
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v2
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: run tests
|
- name: run tests
|
||||||
uses: reactivecircus/android-emulator-runner@v2
|
uses: reactivecircus/android-emulator-runner@v2
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
"use strict";
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const core = __importStar(require("@actions/core"));
|
||||||
|
const exec = __importStar(require("@actions/exec"));
|
||||||
|
/**
|
||||||
|
* Returns the current $JAVA_HOME path.
|
||||||
|
*/
|
||||||
|
function getCurrentJavaHome() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let defaultJavaHome = '';
|
||||||
|
yield exec.exec(`sh -c \\"echo $JAVA_HOME"`, [], {
|
||||||
|
listeners: {
|
||||||
|
stdout: (data) => {
|
||||||
|
defaultJavaHome += data.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return defaultJavaHome.trim();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.getCurrentJavaHome = getCurrentJavaHome;
|
||||||
|
/**
|
||||||
|
* Returns the Java 8 $JAVA_HOME path.
|
||||||
|
*/
|
||||||
|
function getJavaHomeV8() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let javaHomeV8 = '';
|
||||||
|
yield exec.exec(`/usr/libexec/java_home -v 1.8`, [], {
|
||||||
|
listeners: {
|
||||||
|
stdout: (data) => {
|
||||||
|
javaHomeV8 += data.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return javaHomeV8.trim();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.getJavaHomeV8 = getJavaHomeV8;
|
||||||
|
/**
|
||||||
|
* Sets $JAVA_HOME to the specified path.
|
||||||
|
*/
|
||||||
|
function setJavaHome(path) {
|
||||||
|
core.exportVariable('JAVA_HOME', path);
|
||||||
|
}
|
||||||
|
exports.setJavaHome = setJavaHome;
|
||||||
+7
-1
@@ -21,6 +21,7 @@ const input_validator_1 = require("./input-validator");
|
|||||||
const emulator_manager_1 = require("./emulator-manager");
|
const emulator_manager_1 = require("./emulator-manager");
|
||||||
const exec = __importStar(require("@actions/exec"));
|
const exec = __importStar(require("@actions/exec"));
|
||||||
const script_parser_1 = require("./script-parser");
|
const script_parser_1 = require("./script-parser");
|
||||||
|
const java_version_manager_1 = require("./java-version-manager");
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
@@ -66,6 +67,9 @@ function run() {
|
|||||||
scripts.forEach((script) => __awaiter(this, void 0, void 0, function* () {
|
scripts.forEach((script) => __awaiter(this, void 0, void 0, function* () {
|
||||||
console.log(`${script}`);
|
console.log(`${script}`);
|
||||||
}));
|
}));
|
||||||
|
// use Java 8 for sdkmanager and avdmanager
|
||||||
|
const defaultJavaHome = yield java_version_manager_1.getCurrentJavaHome();
|
||||||
|
java_version_manager_1.setJavaHome(yield java_version_manager_1.getJavaHomeV8());
|
||||||
// install SDK
|
// install SDK
|
||||||
yield sdk_installer_1.installAndroidSdk(apiLevel, target, arch, emulatorBuild);
|
yield sdk_installer_1.installAndroidSdk(apiLevel, target, arch, emulatorBuild);
|
||||||
try {
|
try {
|
||||||
@@ -75,10 +79,12 @@ function run() {
|
|||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
|
// use default JAVA_HOME for running custom script
|
||||||
|
java_version_manager_1.setJavaHome(defaultJavaHome);
|
||||||
// execute the custom script
|
// execute the custom script
|
||||||
try {
|
try {
|
||||||
for (const script of scripts) {
|
for (const script of scripts) {
|
||||||
yield exec.exec(`${script}`);
|
yield exec.exec(`sh -c \\"${script}"`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const exec = __importStar(require("@actions/exec"));
|
const exec = __importStar(require("@actions/exec"));
|
||||||
const BUILD_TOOLS_VERSION = '29.0.2';
|
const BUILD_TOOLS_VERSION = '29.0.3';
|
||||||
/**
|
/**
|
||||||
* Installs & updates the Android SDK for the macOS platform, including SDK platform for the chosen API level, latest build tools, platform tools, Android Emulator,
|
* Installs & updates the Android SDK for the macOS platform, including SDK platform for the chosen API level, latest build tools, platform tools, Android Emulator,
|
||||||
* and the system image for the chosen API level, CPU arch, and target.
|
* and the system image for the chosen API level, CPU arch, and target.
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
import * as core from '@actions/core';
|
||||||
|
import * as exec from '@actions/exec';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current $JAVA_HOME path.
|
||||||
|
*/
|
||||||
|
export async function getCurrentJavaHome(): Promise<string> {
|
||||||
|
let defaultJavaHome = '';
|
||||||
|
await exec.exec(`sh -c \\"echo $JAVA_HOME"`, [], {
|
||||||
|
listeners: {
|
||||||
|
stdout: (data: Buffer) => {
|
||||||
|
defaultJavaHome += data.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return defaultJavaHome.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Java 8 $JAVA_HOME path.
|
||||||
|
*/
|
||||||
|
export async function getJavaHomeV8(): Promise<string> {
|
||||||
|
let javaHomeV8 = '';
|
||||||
|
await exec.exec(`/usr/libexec/java_home -v 1.8`, [], {
|
||||||
|
listeners: {
|
||||||
|
stdout: (data: Buffer) => {
|
||||||
|
javaHomeV8 += data.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return javaHomeV8.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets $JAVA_HOME to the specified path.
|
||||||
|
*/
|
||||||
|
export function setJavaHome(path: string) {
|
||||||
|
core.exportVariable('JAVA_HOME', path);
|
||||||
|
}
|
||||||
+9
-1
@@ -4,6 +4,7 @@ import { checkApiLevel, checkTarget, checkArch, checkDisableAnimations, checkEmu
|
|||||||
import { launchEmulator, killEmulator } from './emulator-manager';
|
import { launchEmulator, killEmulator } from './emulator-manager';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
import { parseScript } from './script-parser';
|
import { parseScript } from './script-parser';
|
||||||
|
import { getCurrentJavaHome, getJavaHomeV8, setJavaHome } from './java-version-manager';
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
@@ -58,6 +59,10 @@ async function run() {
|
|||||||
console.log(`${script}`);
|
console.log(`${script}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// use Java 8 for sdkmanager and avdmanager
|
||||||
|
const defaultJavaHome = await getCurrentJavaHome();
|
||||||
|
setJavaHome(await getJavaHomeV8());
|
||||||
|
|
||||||
// install SDK
|
// install SDK
|
||||||
await installAndroidSdk(apiLevel, target, arch, emulatorBuild);
|
await installAndroidSdk(apiLevel, target, arch, emulatorBuild);
|
||||||
|
|
||||||
@@ -68,10 +73,13 @@ async function run() {
|
|||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// use default JAVA_HOME for running custom script
|
||||||
|
setJavaHome(defaultJavaHome);
|
||||||
|
|
||||||
// execute the custom script
|
// execute the custom script
|
||||||
try {
|
try {
|
||||||
for (const script of scripts) {
|
for (const script of scripts) {
|
||||||
await exec.exec(`${script}`);
|
await exec.exec(`sh -c \\"${script}"`);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
|
|
||||||
const BUILD_TOOLS_VERSION = '29.0.2';
|
const BUILD_TOOLS_VERSION = '29.0.3';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installs & updates the Android SDK for the macOS platform, including SDK platform for the chosen API level, latest build tools, platform tools, Android Emulator,
|
* Installs & updates the Android SDK for the macOS platform, including SDK platform for the chosen API level, latest build tools, platform tools, Android Emulator,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ apply plugin: 'kotlin-android-extensions'
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
compileSdkVersion 29
|
||||||
buildToolsVersion "29.0.2"
|
buildToolsVersion "29.0.3"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.example.testapp"
|
applicationId "com.example.testapp"
|
||||||
|
|||||||
+1
-1
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
|
||||||
|
|||||||
Reference in New Issue
Block a user