2022-01-11 11:52:29 +00:00
|
|
|
import * as core from '@actions/core';
|
|
|
|
import { Action, Docker, ImageTag, Input, Output, ResultsCheck } from './model';
|
|
|
|
|
|
|
|
async function run() {
|
|
|
|
try {
|
|
|
|
Action.checkCompatibility();
|
|
|
|
|
2022-04-03 10:14:39 +00:00
|
|
|
const { workspace, actionFolder } = Action;
|
2022-01-11 11:52:29 +00:00
|
|
|
const {
|
2022-04-03 15:59:11 +00:00
|
|
|
editorVersion,
|
2022-01-11 11:52:29 +00:00
|
|
|
customImage,
|
|
|
|
projectPath,
|
|
|
|
customParameters,
|
|
|
|
testMode,
|
2022-04-18 23:57:08 +00:00
|
|
|
coverageParameters,
|
2022-04-17 03:17:14 +00:00
|
|
|
coverageResultsPath,
|
2022-01-11 11:52:29 +00:00
|
|
|
artifactsPath,
|
|
|
|
useHostNetwork,
|
|
|
|
sshAgent,
|
|
|
|
gitPrivateToken,
|
|
|
|
githubToken,
|
|
|
|
checkName,
|
|
|
|
} = Input.getFromUser();
|
2022-04-03 15:59:11 +00:00
|
|
|
const baseImage = new ImageTag({ editorVersion, customImage });
|
|
|
|
const runnerTemporaryPath = process.env.RUNNER_TEMP;
|
2022-01-11 11:52:29 +00:00
|
|
|
|
|
|
|
try {
|
2022-04-03 10:14:39 +00:00
|
|
|
await Docker.run(baseImage, {
|
|
|
|
actionFolder,
|
2022-04-03 15:59:11 +00:00
|
|
|
editorVersion,
|
2022-01-11 11:52:29 +00:00
|
|
|
workspace,
|
|
|
|
projectPath,
|
|
|
|
customParameters,
|
|
|
|
testMode,
|
2022-04-18 23:57:08 +00:00
|
|
|
coverageParameters,
|
2022-04-17 03:17:14 +00:00
|
|
|
coverageResultsPath,
|
2022-01-11 11:52:29 +00:00
|
|
|
artifactsPath,
|
|
|
|
useHostNetwork,
|
|
|
|
sshAgent,
|
|
|
|
gitPrivateToken,
|
|
|
|
githubToken,
|
2022-04-03 15:59:11 +00:00
|
|
|
runnerTemporaryPath,
|
2022-01-11 11:52:29 +00:00
|
|
|
});
|
|
|
|
} finally {
|
|
|
|
await Output.setArtifactsPath(artifactsPath);
|
2022-04-17 18:01:24 +00:00
|
|
|
await Output.setCoverageResultsPath(coverageResultsPath);
|
2022-01-11 11:52:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (githubToken) {
|
|
|
|
const failedTestCount = await ResultsCheck.createCheck(artifactsPath, githubToken, checkName);
|
|
|
|
if (failedTestCount >= 1) {
|
|
|
|
core.setFailed(`Test(s) Failed! Check '${checkName}' for details.`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (error: any) {
|
|
|
|
core.setFailed(error.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
run();
|