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-21 08:50:37 +00:00
|
|
|
coverageOptions,
|
2022-01-11 11:52:29 +00:00
|
|
|
artifactsPath,
|
|
|
|
useHostNetwork,
|
|
|
|
sshAgent,
|
|
|
|
gitPrivateToken,
|
|
|
|
githubToken,
|
|
|
|
checkName,
|
2022-06-24 10:59:01 +00:00
|
|
|
chownFilesTo,
|
2022-01-11 11:52:29 +00:00
|
|
|
} = 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-21 08:50:37 +00:00
|
|
|
coverageOptions,
|
2022-01-11 11:52:29 +00:00
|
|
|
artifactsPath,
|
|
|
|
useHostNetwork,
|
|
|
|
sshAgent,
|
|
|
|
gitPrivateToken,
|
|
|
|
githubToken,
|
2022-04-03 15:59:11 +00:00
|
|
|
runnerTemporaryPath,
|
2022-06-24 10:59:01 +00:00
|
|
|
chownFilesTo,
|
2022-01-11 11:52:29 +00:00
|
|
|
});
|
|
|
|
} finally {
|
|
|
|
await Output.setArtifactsPath(artifactsPath);
|
2022-04-21 08:50:37 +00:00
|
|
|
await Output.setCoveragePath('CodeCoverage');
|
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();
|