mirror of
https://github.com/game-ci/unity-test-runner.git
synced 2026-01-28 21:59:06 +08:00
Code Coverage Support (#182)
* Added basic framework for enable code coverage * Added basic coverage results building and combination * fixed ENABLE_CODE_COVERAGE to be `true` or `false` * Added code coverage project to manifest * Updated to add more tests for code coverage build * Updated coverage parameter documentation * Fixed small syntax error * Enabled code coverage flag for code coverage tests * Fixed error in test file build * Updated project run settings * Fixed error when creating combined code coverage results * Updated testing workflows * updated test workflows * Updated parameters and added tests * Updated tests and bash script for running * Updated run_tests.sh script to simplfy some parameters * Updated run_tests to remove incorrect ';' * Updated run_tests script * Fixed small syntax error * Fixed for loop in run_tests.sh * Updated run_tests syntax error for '=' operator * Fixed runTests variable assignment * Fixed parameters for running tests via bash * Corrected bash arguments * Updated test cases in main.yml * Updated parameter names and default values for code coverage * Fixed broken paths for coverage results upload in main.yml * Corrected names of coverage results artifacts
This commit is contained in:
18
dist/index.js
generated
vendored
18
dist/index.js
generated
vendored
@@ -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, coverageOptions, 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,
|
||||
coverageOptions,
|
||||
artifactsPath,
|
||||
useHostNetwork,
|
||||
sshAgent,
|
||||
@@ -63,6 +64,7 @@ function run() {
|
||||
}
|
||||
finally {
|
||||
yield model_1.Output.setArtifactsPath(artifactsPath);
|
||||
yield model_1.Output.setCoveragePath('CodeCoverage');
|
||||
}
|
||||
if (githubToken) {
|
||||
const failedTestCount = yield model_1.ResultsCheck.createCheck(artifactsPath, githubToken, checkName);
|
||||
@@ -152,13 +154,14 @@ 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, coverageOptions, 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);
|
||||
const githubWorkflow = path_1.default.join(runnerTemporaryPath, '_github_workflow');
|
||||
if (!(0, fs_1.existsSync)(githubWorkflow))
|
||||
(0, fs_1.mkdirSync)(githubWorkflow);
|
||||
const testPlatforms = (testMode === 'all' ? ['playmode', 'editmode', 'COMBINE_RESULTS'] : [testMode]).join(';');
|
||||
const command = `docker run \
|
||||
--workdir /github/workspace \
|
||||
--rm \
|
||||
@@ -170,7 +173,9 @@ const Docker = {
|
||||
--env UNITY_VERSION="${editorVersion}" \
|
||||
--env PROJECT_PATH="${projectPath}" \
|
||||
--env CUSTOM_PARAMETERS="${customParameters}" \
|
||||
--env TEST_MODE="${testMode}" \
|
||||
--env TEST_PLATFORMS="${testPlatforms}" \
|
||||
--env COVERAGE_OPTIONS="${coverageOptions}" \
|
||||
--env COVERAGE_RESULTS_PATH="CodeCoverage" \
|
||||
--env ARTIFACTS_PATH="${artifactsPath}" \
|
||||
--env GITHUB_REF \
|
||||
--env GITHUB_SHA \
|
||||
@@ -385,6 +390,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 coverageOptions = (0, core_1.getInput)('coverageOptions') || '';
|
||||
const rawArtifactsPath = (0, core_1.getInput)('artifactsPath') || 'artifacts';
|
||||
const rawUseHostNetwork = (0, core_1.getInput)('useHostNetwork') || 'false';
|
||||
const sshAgent = (0, core_1.getInput)('sshAgent') || '';
|
||||
@@ -416,6 +422,7 @@ const Input = {
|
||||
projectPath,
|
||||
customParameters,
|
||||
testMode,
|
||||
coverageOptions,
|
||||
artifactsPath,
|
||||
useHostNetwork,
|
||||
sshAgent,
|
||||
@@ -471,6 +478,11 @@ const Output = {
|
||||
yield core.setOutput('artifactsPath', artifactsPath);
|
||||
});
|
||||
},
|
||||
setCoveragePath(coveragePath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield core.setOutput('coveragePath', coveragePath);
|
||||
});
|
||||
},
|
||||
};
|
||||
exports["default"] = Output;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user