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