mirror of
https://github.com/reactivecircus/android-emulator-runner.git
synced 2026-09-05 11:39:31 +00:00
Single line script.
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
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 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); }
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
+9
-6
@@ -1,9 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
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 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); }
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -54,16 +55,18 @@ function run() {
|
|||||||
const disableAnimations = disableAnimationsInput === 'true';
|
const disableAnimations = disableAnimationsInput === 'true';
|
||||||
console.log(`disable animations: ${disableAnimations}`);
|
console.log(`disable animations: ${disableAnimations}`);
|
||||||
// custom scrpt to run
|
// custom scrpt to run
|
||||||
const scriptInput = core.getInput('script', { required: true });
|
const script = core.getInput('script', { required: true });
|
||||||
const commands = scriptInput.split(/\r?\n/);
|
|
||||||
// install SDK
|
// install SDK
|
||||||
yield sdk_installer_1.installAndroidSdk(apiLevel, target, arch);
|
yield sdk_installer_1.installAndroidSdk(apiLevel, target, arch);
|
||||||
// launch an emulator
|
// launch an emulator
|
||||||
yield emulator_manager_1.launchEmulator(apiLevel, target, arch, profile, headless, disableAnimations);
|
yield emulator_manager_1.launchEmulator(apiLevel, target, arch, profile, headless, disableAnimations);
|
||||||
// execute the custom script
|
// execute the custom script
|
||||||
commands.forEach((command) => __awaiter(this, void 0, void 0, function* () {
|
try {
|
||||||
yield exec.exec(`${command}`);
|
yield exec.exec(`${script}`);
|
||||||
}));
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.error(error.message);
|
||||||
|
}
|
||||||
// finally kill the emulator
|
// finally kill the emulator
|
||||||
yield emulator_manager_1.killEmulator();
|
yield emulator_manager_1.killEmulator();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
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 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); }
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
+6
-5
@@ -44,8 +44,7 @@ async function run() {
|
|||||||
console.log(`disable animations: ${disableAnimations}`);
|
console.log(`disable animations: ${disableAnimations}`);
|
||||||
|
|
||||||
// custom scrpt to run
|
// custom scrpt to run
|
||||||
const scriptInput = core.getInput('script', { required: true });
|
const script = core.getInput('script', { required: true });
|
||||||
const commands = scriptInput.split(/\r?\n/);
|
|
||||||
|
|
||||||
// install SDK
|
// install SDK
|
||||||
await installAndroidSdk(apiLevel, target, arch);
|
await installAndroidSdk(apiLevel, target, arch);
|
||||||
@@ -54,9 +53,11 @@ async function run() {
|
|||||||
await launchEmulator(apiLevel, target, arch, profile, headless, disableAnimations);
|
await launchEmulator(apiLevel, target, arch, profile, headless, disableAnimations);
|
||||||
|
|
||||||
// execute the custom script
|
// execute the custom script
|
||||||
commands.forEach(async command => {
|
try {
|
||||||
await exec.exec(`${command}`);
|
await exec.exec(`${script}`);
|
||||||
});
|
} catch (error) {
|
||||||
|
console.error(error.message);
|
||||||
|
}
|
||||||
|
|
||||||
// finally kill the emulator
|
// finally kill the emulator
|
||||||
await killEmulator();
|
await killEmulator();
|
||||||
|
|||||||
Reference in New Issue
Block a user