Skip to content

Commit

Permalink
Adding ability to install auxiliary apps
Browse files Browse the repository at this point in the history
  • Loading branch information
nhachicha committed Dec 22, 2023
1 parent fd197b4 commit 07c1de7
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 1 deletion.
29 changes: 29 additions & 0 deletions lib/schedule-run.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,34 @@ exports.scheduleRun = async function (params) {
}
}

if (params.auxiliaryApps) {
try {
core.info("Uploading auxiliary app(s)");
params.configuration = { auxiliaryApps: [] };
const appsToInstall = [];
if (typeof params.auxiliaryApps === "string") {
appsToInstall.push(params.auxiliaryApps);

} else if (typeof params.auxiliaryApps === "object" && params.auxiliaryApps !== null && Array.isArray(params.auxiliaryApps)) {
appsToInstall = params.auxiliaryApps;
} else {
throw("Illegal argument " + params.auxiliaryApps)
}

for (const auxApp of appsToInstall) {
var app = await file_upload.uploadFile({
projectArn: params.projectArn,
remote_src: params.remote_src,
type: params.appType,
file: auxApp
});
params.configuration.auxiliaryApps.push(app.upload.arn);
}
} catch (err) {
throw("Unable to publish auxiliary app file " + params.auxiliaryApps + ", " + err);
}
}

if (params.testSpecFile) {
if (params.test_spec) {
core.info(`Using inline test_spec. Writing it to ${params.testSpecFile}`);
Expand Down Expand Up @@ -123,6 +151,7 @@ exports.scheduleRun = async function (params) {

var run_params = {
appArn: params.appArn,
configuration: params.configuration,
name: name,
devicePoolArn: params.devicePoolArn,
projectArn: params.projectArn,
Expand Down
5 changes: 4 additions & 1 deletion test-application/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ inputs:
app_file:
description: 'Full path to a file to upload and use as app'
required: false
app_auxiliary_files:
description: 'Full path to an auxiliary files to upload'
required: false
app_type:
description: 'Type of the app file'
required: false
Expand Down Expand Up @@ -80,4 +83,4 @@ outputs:
description: 'The status of the newly created upload'
runs:
using: 'node16'
main: 'dist/index.js'
main: 'dist/index.js'
30 changes: 30 additions & 0 deletions test-application/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,34 @@ exports.scheduleRun = async function (params) {
}
}

if (params.auxiliaryApps) {
try {
core.info("Uploading auxiliary app(s)");
params.configuration = { auxiliaryApps: [] };
const appsToInstall = [];
if (typeof params.auxiliaryApps === "string") {
appsToInstall.push(params.auxiliaryApps);

} else if (typeof params.auxiliaryApps === "object" && params.auxiliaryApps !== null && Array.isArray(params.auxiliaryApps)) {
appsToInstall = params.auxiliaryApps;
} else {
throw("Illegal argument " + params.auxiliaryApps)
}

for (const auxApp of appsToInstall) {
var app = await file_upload.uploadFile({
projectArn: params.projectArn,
remote_src: params.remote_src,
type: params.appType,
file: auxApp
});
params.configuration.auxiliaryApps.push(app.upload.arn);
}
} catch (err) {
throw("Unable to publish auxiliary app file " + params.auxiliaryApps + ", " + err);
}
}

if (params.testSpecFile) {
if (params.test_spec) {
core.info(`Using inline test_spec. Writing it to ${params.testSpecFile}`);
Expand Down Expand Up @@ -370,6 +398,7 @@ exports.scheduleRun = async function (params) {

var run_params = {
appArn: params.appArn,
configuration: params.configuration,
name: name,
devicePoolArn: params.devicePoolArn,
projectArn: params.projectArn,
Expand Down Expand Up @@ -52255,6 +52284,7 @@ params.name = core.getInput('name');

params.appArn = core.getInput('app_arn');
params.appFile = core.getInput('app_file');
params.auxiliaryApps = core.getInput('app_auxiliary_files');
params.appType = core.getInput('app_type');

params.timeout = core.getInput('timeout');
Expand Down
1 change: 1 addition & 0 deletions test-application/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ params.name = core.getInput('name');

params.appArn = core.getInput('app_arn');
params.appFile = core.getInput('app_file');
params.auxiliaryApps = core.getInput('app_auxiliary_files');
params.appType = core.getInput('app_type');

params.timeout = core.getInput('timeout');
Expand Down

0 comments on commit 07c1de7

Please sign in to comment.