Generate test coverage
parent
920c3b6d23
commit
7bf7583106
|
@ -20,6 +20,10 @@ inputs:
|
|||
required: false
|
||||
default: 'all'
|
||||
description: 'The type of tests to be run by the test runner.'
|
||||
coverageReport:
|
||||
required: false
|
||||
default: false
|
||||
description: 'Whether to generate a coverage report.'
|
||||
artifactsPath:
|
||||
required: false
|
||||
default: 'artifacts'
|
||||
|
|
|
@ -14,6 +14,12 @@ echo "Using project path \"$UNITY_PROJECT_PATH\"."
|
|||
echo "Using artifacts path \"$ARTIFACTS_PATH\" to save test results."
|
||||
FULL_ARTIFACTS_PATH=$GITHUB_WORKSPACE/$ARTIFACTS_PATH
|
||||
|
||||
COVERAGE=""
|
||||
if [ "$GENERATE_COVERAGE_REPORT" == "true" ]; then
|
||||
echo "Generating code coverage report."
|
||||
COVERAGE="-enableCodeCoverage"
|
||||
fi
|
||||
|
||||
#
|
||||
# Display custom parameters
|
||||
#
|
||||
|
@ -81,6 +87,8 @@ if [ "$EDIT_MODE" = "true" ]; then
|
|||
-runTests \
|
||||
-testPlatform editmode \
|
||||
-testResults "$FULL_ARTIFACTS_PATH/editmode-results.xml" \
|
||||
-coverageResultsPath "$FULL_ARTIFACTS_PATH" \
|
||||
$COVERAGE \
|
||||
$CUSTOM_PARAMETERS
|
||||
|
||||
# Catch exit code
|
||||
|
@ -118,6 +126,8 @@ if [ "$PLAY_MODE" = "true" ]; then
|
|||
-runTests \
|
||||
-testPlatform playmode \
|
||||
-testResults "$FULL_ARTIFACTS_PATH/playmode-results.xml" \
|
||||
-coverageResultsPath "$FULL_ARTIFACTS_PATH" \
|
||||
$COVERAGE \
|
||||
$CUSTOM_PARAMETERS
|
||||
|
||||
# Catch exit code
|
||||
|
|
|
@ -12,6 +12,7 @@ async function run() {
|
|||
projectPath,
|
||||
customParameters,
|
||||
testMode,
|
||||
generateCoverageReport,
|
||||
artifactsPath,
|
||||
useHostNetwork,
|
||||
sshAgent,
|
||||
|
@ -33,6 +34,7 @@ async function run() {
|
|||
projectPath,
|
||||
customParameters,
|
||||
testMode,
|
||||
generateCoverageReport,
|
||||
artifactsPath,
|
||||
useHostNetwork,
|
||||
sshAgent,
|
||||
|
|
|
@ -26,6 +26,7 @@ const Docker = {
|
|||
projectPath,
|
||||
customParameters,
|
||||
testMode,
|
||||
generateCoverageReport,
|
||||
artifactsPath,
|
||||
useHostNetwork,
|
||||
sshAgent,
|
||||
|
@ -51,6 +52,7 @@ const Docker = {
|
|||
--env PROJECT_PATH="${projectPath}" \
|
||||
--env CUSTOM_PARAMETERS="${customParameters}" \
|
||||
--env TEST_MODE="${testMode}" \
|
||||
--env GENERATE_COVERAGE_REPORT="${generateCoverageReport}" \
|
||||
--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 coverageReport = getInput('coverageReport') || '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 (coverageReport !== 'true' && coverageReport !== 'false') {
|
||||
throw new Error(`Invalid coverageReport "${coverageReport}"`);
|
||||
}
|
||||
|
||||
if (!this.isValidFolderName(rawProjectPath)) {
|
||||
throw new Error(`Invalid projectPath "${rawProjectPath}"`);
|
||||
}
|
||||
|
@ -44,6 +49,7 @@ const Input = {
|
|||
}
|
||||
|
||||
// Sanitise input
|
||||
const generateCoverageReport = coverageReport === 'true';
|
||||
const projectPath = rawProjectPath.replace(/\/$/, '');
|
||||
const artifactsPath = rawArtifactsPath.replace(/\/$/, '');
|
||||
const useHostNetwork = rawUseHostNetwork === 'true';
|
||||
|
@ -57,6 +63,7 @@ const Input = {
|
|||
projectPath,
|
||||
customParameters,
|
||||
testMode,
|
||||
generateCoverageReport,
|
||||
artifactsPath,
|
||||
useHostNetwork,
|
||||
sshAgent,
|
||||
|
|
Loading…
Reference in New Issue