Updated parameters and added tests
parent
0fb209bbbf
commit
3297ad7442
|
@ -215,14 +215,10 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
enableCodeCoverage:
|
|
||||||
- true
|
|
||||||
unityVersion:
|
unityVersion:
|
||||||
- 2019.2.11f1
|
- 2019.2.11f1
|
||||||
projectPath:
|
projectPath:
|
||||||
- unity-project-with-correct-tests
|
- unity-project-with-correct-tests
|
||||||
coverageAssemblyFilters:
|
|
||||||
- '+MyScripts'
|
|
||||||
testMode:
|
testMode:
|
||||||
- playmode
|
- playmode
|
||||||
- editmode
|
- editmode
|
||||||
|
@ -248,21 +244,20 @@ jobs:
|
||||||
|
|
||||||
# Configure test runner
|
# Configure test runner
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
id: codecovtests
|
id: coveragetests
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
projectPath: ${{ matrix.projectPath }}
|
projectPath: ${{ matrix.projectPath }}
|
||||||
unityVersion: ${{ matrix.unityVersion }}
|
unityVersion: ${{ matrix.unityVersion }}
|
||||||
testMode: ${{ matrix.testMode }}
|
testMode: ${{ matrix.testMode }}
|
||||||
enableCodeCoverage: ${{ matrix.enableCodeCoverage }}
|
coverageParameters: 'enableCyclomaticComplexity;generateHtmlReport;generateBadgeReport;assemblyFilters:+MyScripts'
|
||||||
coverageAssemblyFilters: ${{ matrix.coverageAssemblyFilters }}
|
|
||||||
|
|
||||||
# Upload artifacts
|
# Upload artifacts
|
||||||
- name: Upload code coverage results
|
- name: Upload code coverage results
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: Code coverage results (${{ matrix.testMode }} mode)
|
name: Code coverage results (${{ matrix.testMode }} mode)
|
||||||
path: ${{ steps.codecovtests.outputs.coverageResultsPath }}
|
path: coverage
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
|
|
||||||
testEachModeSequentially:
|
testEachModeSequentially:
|
||||||
|
@ -275,8 +270,6 @@ jobs:
|
||||||
- 2019.2.11f1
|
- 2019.2.11f1
|
||||||
projectPath:
|
projectPath:
|
||||||
- unity-project-with-correct-tests
|
- unity-project-with-correct-tests
|
||||||
enableCodeCoverage:
|
|
||||||
- true
|
|
||||||
steps:
|
steps:
|
||||||
###########################
|
###########################
|
||||||
# Checkout #
|
# Checkout #
|
||||||
|
@ -304,8 +297,7 @@ jobs:
|
||||||
unityVersion: ${{ matrix.unityVersion }}
|
unityVersion: ${{ matrix.unityVersion }}
|
||||||
testMode: editmode
|
testMode: editmode
|
||||||
artifactsPath: artifacts/editmode
|
artifactsPath: artifacts/editmode
|
||||||
enableCodeCoverage: ${{ matrix.enableCodeCoverage }}
|
coverageResultsPath: coverage/editmode
|
||||||
coverageResultsPath: CodeCoverage/editmode
|
|
||||||
|
|
||||||
# Configure second test runner
|
# Configure second test runner
|
||||||
- name: Tests in playmode 📺
|
- name: Tests in playmode 📺
|
||||||
|
@ -315,8 +307,7 @@ jobs:
|
||||||
unityVersion: ${{ matrix.unityVersion }}
|
unityVersion: ${{ matrix.unityVersion }}
|
||||||
testMode: playmode
|
testMode: playmode
|
||||||
artifactsPath: artifacts/playmode
|
artifactsPath: artifacts/playmode
|
||||||
enableCodeCoverage: ${{ matrix.enableCodeCoverage }}
|
coverageResultsPath: coverage/playmode
|
||||||
coverageResultsPath: CodeCoverage/playmode
|
|
||||||
|
|
||||||
# Upload combined artifacts
|
# Upload combined artifacts
|
||||||
- name: Upload combined test results
|
- name: Upload combined test results
|
||||||
|
|
12
action.yml
12
action.yml
|
@ -20,17 +20,13 @@ 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:
|
coverageParameters:
|
||||||
required: false
|
required: false
|
||||||
default: 'false'
|
default: 'enableCyclomaticComplexity;generateHtmlReport;generateBadgeReport'
|
||||||
description: 'Should code coverage results be collected for the test run.'
|
description: 'Optional coverage parameters for the -coverageOptions argument.'
|
||||||
coverageAssemblyFilters:
|
|
||||||
required: false
|
|
||||||
default: ''
|
|
||||||
description: 'Optional coverage assembly filters when collecting code coverage.'
|
|
||||||
coverageResultsPath:
|
coverageResultsPath:
|
||||||
required: false
|
required: false
|
||||||
default: 'CodeCoverage'
|
default: 'coverage'
|
||||||
description: 'Path to write coverage results to when collecting code coverage.'
|
description: 'Path to write coverage results to when collecting code coverage.'
|
||||||
artifactsPath:
|
artifactsPath:
|
||||||
required: false
|
required: false
|
||||||
|
|
|
@ -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, enableCodeCoverage, coverageAssemblyFilters, coverageResultsPath, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, checkName, } = model_1.Input.getFromUser();
|
const { editorVersion, customImage, projectPath, customParameters, testMode, coverageParameters, coverageResultsPath, 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,8 +53,7 @@ function run() {
|
||||||
projectPath,
|
projectPath,
|
||||||
customParameters,
|
customParameters,
|
||||||
testMode,
|
testMode,
|
||||||
enableCodeCoverage,
|
coverageParameters,
|
||||||
coverageAssemblyFilters,
|
|
||||||
coverageResultsPath,
|
coverageResultsPath,
|
||||||
artifactsPath,
|
artifactsPath,
|
||||||
useHostNetwork,
|
useHostNetwork,
|
||||||
|
@ -156,7 +155,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, enableCodeCoverage, coverageAssemblyFilters, coverageResultsPath, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, runnerTemporaryPath, } = parameters;
|
const { actionFolder, editorVersion, workspace, projectPath, customParameters, testMode, coverageParameters, coverageResultsPath, 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);
|
||||||
|
@ -175,8 +174,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 COVERAGE_OPTIONS="${coverageParameters}" \
|
||||||
--env COVERAGE_ASSEMBLY_FILTERS="${coverageAssemblyFilters}" \
|
|
||||||
--env COVERAGE_RESULTS_PATH="${coverageResultsPath}" \
|
--env COVERAGE_RESULTS_PATH="${coverageResultsPath}" \
|
||||||
--env ARTIFACTS_PATH="${artifactsPath}" \
|
--env ARTIFACTS_PATH="${artifactsPath}" \
|
||||||
--env GITHUB_REF \
|
--env GITHUB_REF \
|
||||||
|
@ -392,8 +390,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 rawEnableCodeCoverage = (0, core_1.getInput)('enableCodeCoverage') || 'false';
|
const coverageParameters = (0, core_1.getInput)('coverageParameters') || '';
|
||||||
const coverageAssemblyFilters = (0, core_1.getInput)('coverageAssemblyFilters') || '';
|
|
||||||
const rawCoverageResultsPath = (0, core_1.getInput)('coverageResultsPath') || 'CodeCoverage';
|
const rawCoverageResultsPath = (0, core_1.getInput)('coverageResultsPath') || 'CodeCoverage';
|
||||||
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';
|
||||||
|
@ -405,9 +402,6 @@ 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 (rawEnableCodeCoverage !== 'true' && rawEnableCodeCoverage !== 'false') {
|
|
||||||
throw new Error(`Invalid enableCodeCoverage "${rawEnableCodeCoverage}"`);
|
|
||||||
}
|
|
||||||
if (!this.isValidFolderName(rawCoverageResultsPath)) {
|
if (!this.isValidFolderName(rawCoverageResultsPath)) {
|
||||||
throw new Error(`Invalid coverageResultsPath "${rawCoverageResultsPath}"`);
|
throw new Error(`Invalid coverageResultsPath "${rawCoverageResultsPath}"`);
|
||||||
}
|
}
|
||||||
|
@ -424,7 +418,6 @@ const Input = {
|
||||||
const projectPath = rawProjectPath.replace(/\/$/, '');
|
const projectPath = rawProjectPath.replace(/\/$/, '');
|
||||||
const artifactsPath = rawArtifactsPath.replace(/\/$/, '');
|
const artifactsPath = rawArtifactsPath.replace(/\/$/, '');
|
||||||
const useHostNetwork = rawUseHostNetwork === 'true';
|
const useHostNetwork = rawUseHostNetwork === 'true';
|
||||||
const enableCodeCoverage = rawEnableCodeCoverage === 'true';
|
|
||||||
const coverageResultsPath = rawCoverageResultsPath.replace(/\/$/, '');
|
const coverageResultsPath = rawCoverageResultsPath.replace(/\/$/, '');
|
||||||
const editorVersion = unityVersion === 'auto' ? unity_version_parser_1.default.read(projectPath) : unityVersion;
|
const editorVersion = unityVersion === 'auto' ? unity_version_parser_1.default.read(projectPath) : unityVersion;
|
||||||
// Return sanitised input
|
// Return sanitised input
|
||||||
|
@ -434,8 +427,7 @@ const Input = {
|
||||||
projectPath,
|
projectPath,
|
||||||
customParameters,
|
customParameters,
|
||||||
testMode,
|
testMode,
|
||||||
enableCodeCoverage,
|
coverageParameters,
|
||||||
coverageAssemblyFilters,
|
|
||||||
coverageResultsPath,
|
coverageResultsPath,
|
||||||
artifactsPath,
|
artifactsPath,
|
||||||
useHostNetwork,
|
useHostNetwork,
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -24,9 +24,6 @@ echo "Using custom parameters $CUSTOM_PARAMETERS."
|
||||||
# Set and display the coverage results path
|
# Set and display the coverage results path
|
||||||
#
|
#
|
||||||
|
|
||||||
echo "Using artifacts path \"$COVERAGE_RESULTS_PATH\" to save test coverage results."
|
|
||||||
FULL_COVERAGE_RESULTS_PATH=$GITHUB_WORKSPACE/$COVERAGE_RESULTS_PATH
|
|
||||||
|
|
||||||
# Set the modes for testing
|
# Set the modes for testing
|
||||||
case $TEST_MODE in
|
case $TEST_MODE in
|
||||||
editmode)
|
editmode)
|
||||||
|
@ -44,32 +41,6 @@ case $TEST_MODE in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
#
|
|
||||||
# Build code coverage parameters
|
|
||||||
#
|
|
||||||
CODE_COVERAGE_PARAMETERS=""
|
|
||||||
if [ "$ENABLE_CODE_COVERAGE" = "true" ]; then
|
|
||||||
# Configure code coverage options
|
|
||||||
COVERAGE_OPTIONS=""
|
|
||||||
ASSEMBLY_FILTER_OPTIONS=""
|
|
||||||
|
|
||||||
# Setup assembly filters if provided
|
|
||||||
if [ -n "$COVERAGE_ASSEMBLY_FILTERS" ]; then
|
|
||||||
ASSEMBLY_FILTER_OPTIONS=";assemblyFilters:$COVERAGE_ASSEMBLY_FILTERS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Options to combine both playmode and editmode results
|
|
||||||
if [ "$EDIT_MODE" = "true" ] && [ "$PLAY_MODE" = "true" ]; then
|
|
||||||
COVERAGE_OPTIONS="enableCyclomaticComplexity$ASSEMBLY_FILTER_OPTIONS"
|
|
||||||
else
|
|
||||||
COVERAGE_OPTIONS="enableCyclomaticComplexity;generateHtmlReport;generateBadgeReport$ASSEMBLY_FILTER_OPTIONS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Set parameters for code coverage
|
|
||||||
CODE_COVERAGE_PARAMETERS="-debugCodeOptimization -enableCodeCoverage -coverageOptions $COVERAGE_OPTIONS -coverageResultsPath $FULL_COVERAGE_RESULTS_PATH"
|
|
||||||
fi
|
|
||||||
echo "Using code coverage parameters $CODE_COVERAGE_PARAMETERS."
|
|
||||||
|
|
||||||
# The following tests are 2019 mode (requires Unity 2019.2.11f1 or later)
|
# The following tests are 2019 mode (requires Unity 2019.2.11f1 or later)
|
||||||
# Reference: https://docs.unity3d.com/2019.3/Documentation/Manual/CommandLineArguments.html
|
# Reference: https://docs.unity3d.com/2019.3/Documentation/Manual/CommandLineArguments.html
|
||||||
|
|
||||||
|
@ -115,8 +86,11 @@ if [ "$EDIT_MODE" = "true" ]; then
|
||||||
-runTests \
|
-runTests \
|
||||||
-testPlatform editmode \
|
-testPlatform editmode \
|
||||||
-testResults "$FULL_ARTIFACTS_PATH/editmode-results.xml" \
|
-testResults "$FULL_ARTIFACTS_PATH/editmode-results.xml" \
|
||||||
$CUSTOM_PARAMETERS \
|
-enableCodeCoverage \
|
||||||
$CODE_COVERAGE_PARAMETERS
|
-debugCodeOptimization \
|
||||||
|
-coverageResultsPath "$FULL_COVERAGE_RESULTS_PATH" \
|
||||||
|
-coverageOptions "$COVERAGE_OPTIONS" \
|
||||||
|
$CUSTOM_PARAMETERS
|
||||||
|
|
||||||
# Catch exit code
|
# Catch exit code
|
||||||
EDIT_MODE_EXIT_CODE=$?
|
EDIT_MODE_EXIT_CODE=$?
|
||||||
|
@ -153,8 +127,11 @@ if [ "$PLAY_MODE" = "true" ]; then
|
||||||
-runTests \
|
-runTests \
|
||||||
-testPlatform playmode \
|
-testPlatform playmode \
|
||||||
-testResults "$FULL_ARTIFACTS_PATH/playmode-results.xml" \
|
-testResults "$FULL_ARTIFACTS_PATH/playmode-results.xml" \
|
||||||
$CUSTOM_PARAMETERS \
|
-enableCodeCoverage \
|
||||||
$CODE_COVERAGE_PARAMETERS
|
-debugCodeOptimization \
|
||||||
|
-coverageResultsPath "$FULL_COVERAGE_RESULTS_PATH" \
|
||||||
|
-coverageOptions "$COVERAGE_OPTIONS" \
|
||||||
|
$CUSTOM_PARAMETERS
|
||||||
|
|
||||||
# Catch exit code
|
# Catch exit code
|
||||||
PLAY_MODE_EXIT_CODE=$?
|
PLAY_MODE_EXIT_CODE=$?
|
||||||
|
@ -209,7 +186,7 @@ fi
|
||||||
# Combine test results if needed
|
# Combine test results if needed
|
||||||
#
|
#
|
||||||
COMBINE_EXIT_CODE=0
|
COMBINE_EXIT_CODE=0
|
||||||
if [ "$EDIT_MODE" = "true" ] && [ "$PLAY_MODE" = "true" ] && [ "$ENABLE_CODE_COVERAGE" = "true" ]; then
|
if [ "$EDIT_MODE" = "true" ] && [ "$PLAY_MODE" = "true" ] && [ "$COVERAGE" = "true" ]; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "##############################"
|
echo "##############################"
|
||||||
echo "# Combining Coverage Results #"
|
echo "# Combining Coverage Results #"
|
||||||
|
@ -217,12 +194,11 @@ if [ "$EDIT_MODE" = "true" ] && [ "$PLAY_MODE" = "true" ] && [ "$ENABLE_CODE_COV
|
||||||
echo ""
|
echo ""
|
||||||
unity-editor \
|
unity-editor \
|
||||||
-batchmode \
|
-batchmode \
|
||||||
-debugCodeOptimization \
|
|
||||||
-enableCodeCoverage \
|
|
||||||
-logFile "$FULL_ARTIFACTS_PATH/combine_coverage.log" \
|
|
||||||
-projectPath "$UNITY_PROJECT_PATH" \
|
-projectPath "$UNITY_PROJECT_PATH" \
|
||||||
|
-enableCodeCoverage \
|
||||||
|
-debugCodeOptimization \
|
||||||
-coverageResultsPath "$FULL_COVERAGE_RESULTS_PATH" \
|
-coverageResultsPath "$FULL_COVERAGE_RESULTS_PATH" \
|
||||||
-coverageOptions "generateHtmlReport;generateBadgeReport" \
|
-coverageOptions "$COVERAGE_OPTIONS" \
|
||||||
-quit
|
-quit
|
||||||
|
|
||||||
# Catch exit code
|
# Catch exit code
|
||||||
|
|
|
@ -12,8 +12,7 @@ async function run() {
|
||||||
projectPath,
|
projectPath,
|
||||||
customParameters,
|
customParameters,
|
||||||
testMode,
|
testMode,
|
||||||
enableCodeCoverage,
|
coverageParameters,
|
||||||
coverageAssemblyFilters,
|
|
||||||
coverageResultsPath,
|
coverageResultsPath,
|
||||||
artifactsPath,
|
artifactsPath,
|
||||||
useHostNetwork,
|
useHostNetwork,
|
||||||
|
@ -33,8 +32,7 @@ async function run() {
|
||||||
projectPath,
|
projectPath,
|
||||||
customParameters,
|
customParameters,
|
||||||
testMode,
|
testMode,
|
||||||
enableCodeCoverage,
|
coverageParameters,
|
||||||
coverageAssemblyFilters,
|
|
||||||
coverageResultsPath,
|
coverageResultsPath,
|
||||||
artifactsPath,
|
artifactsPath,
|
||||||
useHostNetwork,
|
useHostNetwork,
|
||||||
|
|
|
@ -11,8 +11,7 @@ const Docker = {
|
||||||
projectPath,
|
projectPath,
|
||||||
customParameters,
|
customParameters,
|
||||||
testMode,
|
testMode,
|
||||||
enableCodeCoverage,
|
coverageParameters,
|
||||||
coverageAssemblyFilters,
|
|
||||||
coverageResultsPath,
|
coverageResultsPath,
|
||||||
artifactsPath,
|
artifactsPath,
|
||||||
useHostNetwork,
|
useHostNetwork,
|
||||||
|
@ -39,8 +38,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 COVERAGE_OPTIONS="${coverageParameters}" \
|
||||||
--env COVERAGE_ASSEMBLY_FILTERS="${coverageAssemblyFilters}" \
|
|
||||||
--env COVERAGE_RESULTS_PATH="${coverageResultsPath}" \
|
--env COVERAGE_RESULTS_PATH="${coverageResultsPath}" \
|
||||||
--env ARTIFACTS_PATH="${artifactsPath}" \
|
--env ARTIFACTS_PATH="${artifactsPath}" \
|
||||||
--env GITHUB_REF \
|
--env GITHUB_REF \
|
||||||
|
|
|
@ -19,8 +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 rawEnableCodeCoverage = getInput('enableCodeCoverage') || 'false';
|
const coverageParameters = getInput('coverageParameters') || '';
|
||||||
const coverageAssemblyFilters = getInput('coverageAssemblyFilters') || '';
|
|
||||||
const rawCoverageResultsPath = getInput('coverageResultsPath') || 'CodeCoverage';
|
const rawCoverageResultsPath = getInput('coverageResultsPath') || 'CodeCoverage';
|
||||||
const rawArtifactsPath = getInput('artifactsPath') || 'artifacts';
|
const rawArtifactsPath = getInput('artifactsPath') || 'artifacts';
|
||||||
const rawUseHostNetwork = getInput('useHostNetwork') || 'false';
|
const rawUseHostNetwork = getInput('useHostNetwork') || 'false';
|
||||||
|
@ -34,10 +33,6 @@ const Input = {
|
||||||
throw new Error(`Invalid testMode ${testMode}`);
|
throw new Error(`Invalid testMode ${testMode}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rawEnableCodeCoverage !== 'true' && rawEnableCodeCoverage !== 'false') {
|
|
||||||
throw new Error(`Invalid enableCodeCoverage "${rawEnableCodeCoverage}"`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.isValidFolderName(rawCoverageResultsPath)) {
|
if (!this.isValidFolderName(rawCoverageResultsPath)) {
|
||||||
throw new Error(`Invalid coverageResultsPath "${rawCoverageResultsPath}"`);
|
throw new Error(`Invalid coverageResultsPath "${rawCoverageResultsPath}"`);
|
||||||
}
|
}
|
||||||
|
@ -58,7 +53,6 @@ const Input = {
|
||||||
const projectPath = rawProjectPath.replace(/\/$/, '');
|
const projectPath = rawProjectPath.replace(/\/$/, '');
|
||||||
const artifactsPath = rawArtifactsPath.replace(/\/$/, '');
|
const artifactsPath = rawArtifactsPath.replace(/\/$/, '');
|
||||||
const useHostNetwork = rawUseHostNetwork === 'true';
|
const useHostNetwork = rawUseHostNetwork === 'true';
|
||||||
const enableCodeCoverage = rawEnableCodeCoverage === 'true';
|
|
||||||
const coverageResultsPath = rawCoverageResultsPath.replace(/\/$/, '');
|
const coverageResultsPath = rawCoverageResultsPath.replace(/\/$/, '');
|
||||||
const editorVersion =
|
const editorVersion =
|
||||||
unityVersion === 'auto' ? UnityVersionParser.read(projectPath) : unityVersion;
|
unityVersion === 'auto' ? UnityVersionParser.read(projectPath) : unityVersion;
|
||||||
|
@ -70,8 +64,7 @@ const Input = {
|
||||||
projectPath,
|
projectPath,
|
||||||
customParameters,
|
customParameters,
|
||||||
testMode,
|
testMode,
|
||||||
enableCodeCoverage,
|
coverageParameters,
|
||||||
coverageAssemblyFilters,
|
|
||||||
coverageResultsPath,
|
coverageResultsPath,
|
||||||
artifactsPath,
|
artifactsPath,
|
||||||
useHostNetwork,
|
useHostNetwork,
|
||||||
|
|
|
@ -9,6 +9,16 @@ describe('Output', () => {
|
||||||
describe('setCoverageResultsPath', () => {
|
describe('setCoverageResultsPath', () => {
|
||||||
it('does not throw', async () => {
|
it('does not throw', async () => {
|
||||||
await expect(Output.setCoverageResultsPath('')).resolves.not.toThrow();
|
await expect(Output.setCoverageResultsPath('')).resolves.not.toThrow();
|
||||||
|
await expect(Output.setCoverageResultsPath('artifacts')).resolves.not.toThrow();
|
||||||
|
await expect(Output.setCoverageResultsPath('coverage')).resolves.not.toThrow();
|
||||||
|
await expect(Output.setCoverageResultsPath('CodeCoverage')).resolves.not.toThrow();
|
||||||
|
await expect(Output.setCoverageResultsPath('./artifacts')).resolves.not.toThrow();
|
||||||
|
await expect(Output.setCoverageResultsPath('./coverage')).resolves.not.toThrow();
|
||||||
|
await expect(Output.setCoverageResultsPath('./CodeCoverage')).resolves.not.toThrow();
|
||||||
|
await expect(Output.setCoverageResultsPath('./artifacts/coverage')).resolves.not.toThrow();
|
||||||
|
await expect(Output.setCoverageResultsPath('./coverage/')).resolves.not.toThrow();
|
||||||
|
await expect(Output.setCoverageResultsPath('./CodeCoverage/')).resolves.not.toThrow();
|
||||||
|
await expect(Output.setCoverageResultsPath('./artifacts/coverage/')).resolves.not.toThrow();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue