Added basic framework for enable code coverage
parent
ec4f39253f
commit
d6f31010f5
|
@ -78,6 +78,9 @@ jobs:
|
||||||
- unity-project-with-correct-tests
|
- unity-project-with-correct-tests
|
||||||
unityVersion:
|
unityVersion:
|
||||||
- 2019.2.11f1
|
- 2019.2.11f1
|
||||||
|
enableCodeCovearge:
|
||||||
|
- true
|
||||||
|
- false
|
||||||
steps:
|
steps:
|
||||||
###########################
|
###########################
|
||||||
# Checkout #
|
# Checkout #
|
||||||
|
@ -104,6 +107,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
projectPath: ${{ matrix.projectPath }}
|
projectPath: ${{ matrix.projectPath }}
|
||||||
unityVersion: ${{ matrix.unityVersion }}
|
unityVersion: ${{ matrix.unityVersion }}
|
||||||
|
enableCodeCovearge: ${{ matrix.enableCodeCovearge }}
|
||||||
testMode: all
|
testMode: all
|
||||||
# Test implicit artifactsPath, by not setting it
|
# Test implicit artifactsPath, by not setting it
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,10 @@ inputs:
|
||||||
required: false
|
required: false
|
||||||
default: 'all'
|
default: 'all'
|
||||||
description: 'The type of tests to be run by the test runner.'
|
description: 'The type of tests to be run by the test runner.'
|
||||||
|
enableCodeCoverage:
|
||||||
|
required: false
|
||||||
|
default: 'false'
|
||||||
|
description: 'Should code coverage results be collected for the test run.'
|
||||||
artifactsPath:
|
artifactsPath:
|
||||||
required: false
|
required: false
|
||||||
default: 'artifacts'
|
default: 'artifacts'
|
||||||
|
|
|
@ -42,7 +42,7 @@ function run() {
|
||||||
try {
|
try {
|
||||||
model_1.Action.checkCompatibility();
|
model_1.Action.checkCompatibility();
|
||||||
const { workspace, actionFolder } = model_1.Action;
|
const { workspace, actionFolder } = model_1.Action;
|
||||||
const { editorVersion, customImage, projectPath, customParameters, testMode, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, checkName, } = model_1.Input.getFromUser();
|
const { editorVersion, customImage, projectPath, customParameters, testMode, enableCodeCoverage, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, checkName, } = model_1.Input.getFromUser();
|
||||||
const baseImage = new model_1.ImageTag({ editorVersion, customImage });
|
const baseImage = new model_1.ImageTag({ editorVersion, customImage });
|
||||||
const runnerTemporaryPath = process.env.RUNNER_TEMP;
|
const runnerTemporaryPath = process.env.RUNNER_TEMP;
|
||||||
try {
|
try {
|
||||||
|
@ -53,6 +53,7 @@ function run() {
|
||||||
projectPath,
|
projectPath,
|
||||||
customParameters,
|
customParameters,
|
||||||
testMode,
|
testMode,
|
||||||
|
enableCodeCoverage,
|
||||||
artifactsPath,
|
artifactsPath,
|
||||||
useHostNetwork,
|
useHostNetwork,
|
||||||
sshAgent,
|
sshAgent,
|
||||||
|
@ -152,7 +153,7 @@ const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||||
const Docker = {
|
const Docker = {
|
||||||
run(image, parameters, silent = false) {
|
run(image, parameters, silent = false) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const { actionFolder, editorVersion, workspace, projectPath, customParameters, testMode, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, runnerTemporaryPath, } = parameters;
|
const { actionFolder, editorVersion, workspace, projectPath, customParameters, testMode, enableCodeCoverage, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, runnerTemporaryPath, } = parameters;
|
||||||
const githubHome = path_1.default.join(runnerTemporaryPath, '_github_home');
|
const githubHome = path_1.default.join(runnerTemporaryPath, '_github_home');
|
||||||
if (!(0, fs_1.existsSync)(githubHome))
|
if (!(0, fs_1.existsSync)(githubHome))
|
||||||
(0, fs_1.mkdirSync)(githubHome);
|
(0, fs_1.mkdirSync)(githubHome);
|
||||||
|
@ -171,6 +172,7 @@ const Docker = {
|
||||||
--env PROJECT_PATH="${projectPath}" \
|
--env PROJECT_PATH="${projectPath}" \
|
||||||
--env CUSTOM_PARAMETERS="${customParameters}" \
|
--env CUSTOM_PARAMETERS="${customParameters}" \
|
||||||
--env TEST_MODE="${testMode}" \
|
--env TEST_MODE="${testMode}" \
|
||||||
|
--env ENABLE_CODE_COVERAGE="${enableCodeCoverage}" \
|
||||||
--env ARTIFACTS_PATH="${artifactsPath}" \
|
--env ARTIFACTS_PATH="${artifactsPath}" \
|
||||||
--env GITHUB_REF \
|
--env GITHUB_REF \
|
||||||
--env GITHUB_SHA \
|
--env GITHUB_SHA \
|
||||||
|
@ -385,6 +387,7 @@ const Input = {
|
||||||
const rawProjectPath = (0, core_1.getInput)('projectPath') || '.';
|
const rawProjectPath = (0, core_1.getInput)('projectPath') || '.';
|
||||||
const customParameters = (0, core_1.getInput)('customParameters') || '';
|
const customParameters = (0, core_1.getInput)('customParameters') || '';
|
||||||
const testMode = ((0, core_1.getInput)('testMode') || 'all').toLowerCase();
|
const testMode = ((0, core_1.getInput)('testMode') || 'all').toLowerCase();
|
||||||
|
const enableCodeCoverage = (0, core_1.getInput)('enableCodeCoverage') || 'false';
|
||||||
const rawArtifactsPath = (0, core_1.getInput)('artifactsPath') || 'artifacts';
|
const rawArtifactsPath = (0, core_1.getInput)('artifactsPath') || 'artifacts';
|
||||||
const rawUseHostNetwork = (0, core_1.getInput)('useHostNetwork') || 'false';
|
const rawUseHostNetwork = (0, core_1.getInput)('useHostNetwork') || 'false';
|
||||||
const sshAgent = (0, core_1.getInput)('sshAgent') || '';
|
const sshAgent = (0, core_1.getInput)('sshAgent') || '';
|
||||||
|
@ -395,6 +398,9 @@ const Input = {
|
||||||
if (!this.testModes.includes(testMode)) {
|
if (!this.testModes.includes(testMode)) {
|
||||||
throw new Error(`Invalid testMode ${testMode}`);
|
throw new Error(`Invalid testMode ${testMode}`);
|
||||||
}
|
}
|
||||||
|
if (enableCodeCoverage !== 'true' && enableCodeCoverage !== 'false') {
|
||||||
|
throw new Error(`Invalid enableCodeCoverage "${enableCodeCoverage}"`);
|
||||||
|
}
|
||||||
if (!this.isValidFolderName(rawProjectPath)) {
|
if (!this.isValidFolderName(rawProjectPath)) {
|
||||||
throw new Error(`Invalid projectPath "${rawProjectPath}"`);
|
throw new Error(`Invalid projectPath "${rawProjectPath}"`);
|
||||||
}
|
}
|
||||||
|
@ -416,6 +422,7 @@ const Input = {
|
||||||
projectPath,
|
projectPath,
|
||||||
customParameters,
|
customParameters,
|
||||||
testMode,
|
testMode,
|
||||||
|
enableCodeCoverage,
|
||||||
artifactsPath,
|
artifactsPath,
|
||||||
useHostNetwork,
|
useHostNetwork,
|
||||||
sshAgent,
|
sshAgent,
|
||||||
|
|
|
@ -12,6 +12,7 @@ async function run() {
|
||||||
projectPath,
|
projectPath,
|
||||||
customParameters,
|
customParameters,
|
||||||
testMode,
|
testMode,
|
||||||
|
enableCodeCoverage,
|
||||||
artifactsPath,
|
artifactsPath,
|
||||||
useHostNetwork,
|
useHostNetwork,
|
||||||
sshAgent,
|
sshAgent,
|
||||||
|
@ -30,6 +31,7 @@ async function run() {
|
||||||
projectPath,
|
projectPath,
|
||||||
customParameters,
|
customParameters,
|
||||||
testMode,
|
testMode,
|
||||||
|
enableCodeCoverage,
|
||||||
artifactsPath,
|
artifactsPath,
|
||||||
useHostNetwork,
|
useHostNetwork,
|
||||||
sshAgent,
|
sshAgent,
|
||||||
|
|
|
@ -11,6 +11,7 @@ const Docker = {
|
||||||
projectPath,
|
projectPath,
|
||||||
customParameters,
|
customParameters,
|
||||||
testMode,
|
testMode,
|
||||||
|
enableCodeCoverage,
|
||||||
artifactsPath,
|
artifactsPath,
|
||||||
useHostNetwork,
|
useHostNetwork,
|
||||||
sshAgent,
|
sshAgent,
|
||||||
|
@ -36,6 +37,7 @@ const Docker = {
|
||||||
--env PROJECT_PATH="${projectPath}" \
|
--env PROJECT_PATH="${projectPath}" \
|
||||||
--env CUSTOM_PARAMETERS="${customParameters}" \
|
--env CUSTOM_PARAMETERS="${customParameters}" \
|
||||||
--env TEST_MODE="${testMode}" \
|
--env TEST_MODE="${testMode}" \
|
||||||
|
--env ENABLE_CODE_COVERAGE="${enableCodeCoverage}" \
|
||||||
--env ARTIFACTS_PATH="${artifactsPath}" \
|
--env ARTIFACTS_PATH="${artifactsPath}" \
|
||||||
--env GITHUB_REF \
|
--env GITHUB_REF \
|
||||||
--env GITHUB_SHA \
|
--env GITHUB_SHA \
|
||||||
|
|
|
@ -19,6 +19,7 @@ const Input = {
|
||||||
const rawProjectPath = getInput('projectPath') || '.';
|
const rawProjectPath = getInput('projectPath') || '.';
|
||||||
const customParameters = getInput('customParameters') || '';
|
const customParameters = getInput('customParameters') || '';
|
||||||
const testMode = (getInput('testMode') || 'all').toLowerCase();
|
const testMode = (getInput('testMode') || 'all').toLowerCase();
|
||||||
|
const enableCodeCoverage = getInput('enableCodeCoverage') || 'false';
|
||||||
const rawArtifactsPath = getInput('artifactsPath') || 'artifacts';
|
const rawArtifactsPath = getInput('artifactsPath') || 'artifacts';
|
||||||
const rawUseHostNetwork = getInput('useHostNetwork') || 'false';
|
const rawUseHostNetwork = getInput('useHostNetwork') || 'false';
|
||||||
const sshAgent = getInput('sshAgent') || '';
|
const sshAgent = getInput('sshAgent') || '';
|
||||||
|
@ -31,6 +32,10 @@ const Input = {
|
||||||
throw new Error(`Invalid testMode ${testMode}`);
|
throw new Error(`Invalid testMode ${testMode}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (enableCodeCoverage !== 'true' && enableCodeCoverage !== 'false') {
|
||||||
|
throw new Error(`Invalid enableCodeCoverage "${enableCodeCoverage}"`);
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.isValidFolderName(rawProjectPath)) {
|
if (!this.isValidFolderName(rawProjectPath)) {
|
||||||
throw new Error(`Invalid projectPath "${rawProjectPath}"`);
|
throw new Error(`Invalid projectPath "${rawProjectPath}"`);
|
||||||
}
|
}
|
||||||
|
@ -57,6 +62,7 @@ const Input = {
|
||||||
projectPath,
|
projectPath,
|
||||||
customParameters,
|
customParameters,
|
||||||
testMode,
|
testMode,
|
||||||
|
enableCodeCoverage,
|
||||||
artifactsPath,
|
artifactsPath,
|
||||||
useHostNetwork,
|
useHostNetwork,
|
||||||
sshAgent,
|
sshAgent,
|
||||||
|
|
Loading…
Reference in New Issue