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