Added Windows Support (#184)
* Modifying js files to account for win support * Added new powershell scripts to support windows invocation * Fixed undefined error in stack trace logic * Added new func for resolving image tag default * Changed structure of docker.js to match new standardpull/185/head
parent
d95f760d49
commit
e8774f3837
|
@ -0,0 +1,48 @@
|
||||||
|
#
|
||||||
|
# Create directory for license activation
|
||||||
|
#
|
||||||
|
|
||||||
|
$ACTIVATE_LICENSE_PATH = "${env:GITHUB_WORKSPACE}/_activate-license"
|
||||||
|
New-Item -Path "$ACTIVATE_LICENSE_PATH" -ItemType Directory
|
||||||
|
|
||||||
|
#
|
||||||
|
# Run steps
|
||||||
|
#
|
||||||
|
|
||||||
|
& $PSScriptRoot\steps\activate.ps1
|
||||||
|
& $PSScriptRoot\steps\set_gitcredential.ps1
|
||||||
|
& $PSScriptRoot\steps\run_tests.ps1
|
||||||
|
& $PSScriptRoot\steps\return_license.ps1
|
||||||
|
|
||||||
|
#
|
||||||
|
# Remove license activation directory
|
||||||
|
#
|
||||||
|
|
||||||
|
Remove-Item "$ACTIVATE_LICENSE_PATH" -Recurse -Force
|
||||||
|
|
||||||
|
#
|
||||||
|
# Instructions for debugging
|
||||||
|
#
|
||||||
|
|
||||||
|
if ($TEST_RUNNER_EXIT_CODE -gt 0)
|
||||||
|
{
|
||||||
|
Write-Output ""
|
||||||
|
Write-Output "###########################"
|
||||||
|
Write-Output "# Failure #"
|
||||||
|
Write-Output "###########################"
|
||||||
|
Write-Output ""
|
||||||
|
Write-Output "Please note that the exit code is not very descriptive."
|
||||||
|
Write-Output "Most likely it will not help you solve the issue."
|
||||||
|
Write-Output ""
|
||||||
|
Write-Output "To find the reason for failure: please search for errors in the log above."
|
||||||
|
Write-Output ""
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Exit with code from the build step.
|
||||||
|
#
|
||||||
|
|
||||||
|
if ( ($USE_EXIT_CODE -eq "true") -and ($TEST_RUNNER_EXIT_CODE -ne 2) )
|
||||||
|
{
|
||||||
|
exit $TEST_RUNNER_EXIT_CODE
|
||||||
|
}
|
|
@ -95,7 +95,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||||
const Action = {
|
const Action = {
|
||||||
get supportedPlatforms() {
|
get supportedPlatforms() {
|
||||||
return ['linux'];
|
return ['linux', 'win32'];
|
||||||
},
|
},
|
||||||
get isRunningLocally() {
|
get isRunningLocally() {
|
||||||
return process.env.RUNNER_WORKSPACE === undefined;
|
return process.env.RUNNER_WORKSPACE === undefined;
|
||||||
|
@ -154,60 +154,128 @@ 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, coverageOptions, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, runnerTemporaryPath, } = parameters;
|
let runCommand = '';
|
||||||
const githubHome = path_1.default.join(runnerTemporaryPath, '_github_home');
|
switch (process.platform) {
|
||||||
if (!(0, fs_1.existsSync)(githubHome))
|
case 'linux':
|
||||||
(0, fs_1.mkdirSync)(githubHome);
|
runCommand = this.getLinuxCommand(image, parameters);
|
||||||
const githubWorkflow = path_1.default.join(runnerTemporaryPath, '_github_workflow');
|
break;
|
||||||
if (!(0, fs_1.existsSync)(githubWorkflow))
|
case 'win32':
|
||||||
(0, fs_1.mkdirSync)(githubWorkflow);
|
runCommand = this.getWindowsCommand(image, parameters);
|
||||||
const testPlatforms = (testMode === 'all' ? ['playmode', 'editmode', 'COMBINE_RESULTS'] : [testMode]).join(';');
|
break;
|
||||||
const command = `docker run \
|
default:
|
||||||
--workdir /github/workspace \
|
throw new Error(`Operation system, ${process.platform}, is not supported yet.`);
|
||||||
--rm \
|
}
|
||||||
--env UNITY_LICENSE \
|
yield (0, exec_1.exec)(runCommand, undefined, { silent });
|
||||||
--env UNITY_LICENSE_FILE \
|
|
||||||
--env UNITY_EMAIL \
|
|
||||||
--env UNITY_PASSWORD \
|
|
||||||
--env UNITY_SERIAL \
|
|
||||||
--env UNITY_VERSION="${editorVersion}" \
|
|
||||||
--env PROJECT_PATH="${projectPath}" \
|
|
||||||
--env CUSTOM_PARAMETERS="${customParameters}" \
|
|
||||||
--env TEST_PLATFORMS="${testPlatforms}" \
|
|
||||||
--env COVERAGE_OPTIONS="${coverageOptions}" \
|
|
||||||
--env COVERAGE_RESULTS_PATH="CodeCoverage" \
|
|
||||||
--env ARTIFACTS_PATH="${artifactsPath}" \
|
|
||||||
--env GITHUB_REF \
|
|
||||||
--env GITHUB_SHA \
|
|
||||||
--env GITHUB_REPOSITORY \
|
|
||||||
--env GITHUB_ACTOR \
|
|
||||||
--env GITHUB_WORKFLOW \
|
|
||||||
--env GITHUB_HEAD_REF \
|
|
||||||
--env GITHUB_BASE_REF \
|
|
||||||
--env GITHUB_EVENT_NAME \
|
|
||||||
--env GITHUB_WORKSPACE=/github/workspace \
|
|
||||||
--env GITHUB_ACTION \
|
|
||||||
--env GITHUB_EVENT_PATH \
|
|
||||||
--env RUNNER_OS \
|
|
||||||
--env RUNNER_TOOL_CACHE \
|
|
||||||
--env RUNNER_TEMP \
|
|
||||||
--env RUNNER_WORKSPACE \
|
|
||||||
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
|
|
||||||
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
|
|
||||||
--volume "${githubHome}":"/root:z" \
|
|
||||||
--volume "${githubWorkflow}":"/github/workflow:z" \
|
|
||||||
--volume "${workspace}":"/github/workspace:z" \
|
|
||||||
--volume "${actionFolder}/steps":"/steps:z" \
|
|
||||||
--volume "${actionFolder}/entrypoint.sh":"/entrypoint.sh:z" \
|
|
||||||
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
|
|
||||||
${sshAgent ? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro' : ''} \
|
|
||||||
${useHostNetwork ? '--net=host' : ''} \
|
|
||||||
${githubToken ? '--env USE_EXIT_CODE=false' : '--env USE_EXIT_CODE=true'} \
|
|
||||||
${image} \
|
|
||||||
/bin/bash /entrypoint.sh`;
|
|
||||||
yield (0, exec_1.exec)(command, undefined, { silent });
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
getLinuxCommand(image, 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(';');
|
||||||
|
return `docker run \
|
||||||
|
--workdir /github/workspace \
|
||||||
|
--rm \
|
||||||
|
--env UNITY_LICENSE \
|
||||||
|
--env UNITY_LICENSE_FILE \
|
||||||
|
--env UNITY_EMAIL \
|
||||||
|
--env UNITY_PASSWORD \
|
||||||
|
--env UNITY_SERIAL \
|
||||||
|
--env UNITY_VERSION="${editorVersion}" \
|
||||||
|
--env PROJECT_PATH="${projectPath}" \
|
||||||
|
--env CUSTOM_PARAMETERS="${customParameters}" \
|
||||||
|
--env TEST_PLATFORMS="${testPlatforms}" \
|
||||||
|
--env COVERAGE_OPTIONS="${coverageOptions}" \
|
||||||
|
--env COVERAGE_RESULTS_PATH="CodeCoverage" \
|
||||||
|
--env ARTIFACTS_PATH="${artifactsPath}" \
|
||||||
|
--env GITHUB_REF \
|
||||||
|
--env GITHUB_SHA \
|
||||||
|
--env GITHUB_REPOSITORY \
|
||||||
|
--env GITHUB_ACTOR \
|
||||||
|
--env GITHUB_WORKFLOW \
|
||||||
|
--env GITHUB_HEAD_REF \
|
||||||
|
--env GITHUB_BASE_REF \
|
||||||
|
--env GITHUB_EVENT_NAME \
|
||||||
|
--env GITHUB_WORKSPACE="/github/workspace" \
|
||||||
|
--env GITHUB_ACTION \
|
||||||
|
--env GITHUB_EVENT_PATH \
|
||||||
|
--env RUNNER_OS \
|
||||||
|
--env RUNNER_TOOL_CACHE \
|
||||||
|
--env RUNNER_TEMP \
|
||||||
|
--env RUNNER_WORKSPACE \
|
||||||
|
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
|
||||||
|
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
|
||||||
|
--volume "${githubHome}:/root:z" \
|
||||||
|
--volume "${githubWorkflow}:/github/workflow:z" \
|
||||||
|
--volume "${workspace}:/github/workspace:z" \
|
||||||
|
--volume "${actionFolder}/steps:/steps:z" \
|
||||||
|
--volume "${actionFolder}/entrypoint.sh:/entrypoint.sh:z" \
|
||||||
|
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
|
||||||
|
${sshAgent ? `--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro` : ''} \
|
||||||
|
${useHostNetwork ? '--net=host' : ''} \
|
||||||
|
${githubToken ? '--env USE_EXIT_CODE=false' : '--env USE_EXIT_CODE=true'} \
|
||||||
|
${image} \
|
||||||
|
/bin/bash -c /entrypoint.sh`;
|
||||||
|
},
|
||||||
|
getWindowsCommand(image, 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(';');
|
||||||
|
return `docker run \
|
||||||
|
--workdir /github/workspace \
|
||||||
|
--rm \
|
||||||
|
--env UNITY_LICENSE \
|
||||||
|
--env UNITY_LICENSE_FILE \
|
||||||
|
--env UNITY_EMAIL \
|
||||||
|
--env UNITY_PASSWORD \
|
||||||
|
--env UNITY_SERIAL \
|
||||||
|
--env UNITY_VERSION="${editorVersion}" \
|
||||||
|
--env PROJECT_PATH="${projectPath}" \
|
||||||
|
--env CUSTOM_PARAMETERS="${customParameters}" \
|
||||||
|
--env TEST_PLATFORMS="${testPlatforms}" \
|
||||||
|
--env COVERAGE_OPTIONS="${coverageOptions}" \
|
||||||
|
--env COVERAGE_RESULTS_PATH="CodeCoverage" \
|
||||||
|
--env ARTIFACTS_PATH="${artifactsPath}" \
|
||||||
|
--env GITHUB_REF \
|
||||||
|
--env GITHUB_SHA \
|
||||||
|
--env GITHUB_REPOSITORY \
|
||||||
|
--env GITHUB_ACTOR \
|
||||||
|
--env GITHUB_WORKFLOW \
|
||||||
|
--env GITHUB_HEAD_REF \
|
||||||
|
--env GITHUB_BASE_REF \
|
||||||
|
--env GITHUB_EVENT_NAME \
|
||||||
|
--env GITHUB_WORKSPACE="/github/workspace" \
|
||||||
|
--env GITHUB_ACTION \
|
||||||
|
--env GITHUB_EVENT_PATH \
|
||||||
|
--env RUNNER_OS \
|
||||||
|
--env RUNNER_TOOL_CACHE \
|
||||||
|
--env RUNNER_TEMP \
|
||||||
|
--env RUNNER_WORKSPACE \
|
||||||
|
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
|
||||||
|
${sshAgent ? '--env SSH_AUTH_SOCK=c:/ssh-agent' : ''} \
|
||||||
|
--volume "${githubHome}":"c:/root" \
|
||||||
|
--volume "${githubWorkflow}":"c:/github/workflow" \
|
||||||
|
--volume "${workspace}":"c:/github/workspace" \
|
||||||
|
--volume "${actionFolder}/steps":"c:/steps" \
|
||||||
|
--volume "${actionFolder}":"c:/dist" \
|
||||||
|
${sshAgent ? `--volume ${sshAgent}:c:/ssh-agent` : ''} \
|
||||||
|
${sshAgent
|
||||||
|
? `--volume c:/Users/Administrator/.ssh/known_hosts:c:/root/.ssh/known_hosts`
|
||||||
|
: ''} \
|
||||||
|
${useHostNetwork ? '--net=host' : ''} \
|
||||||
|
${githubToken ? '--env USE_EXIT_CODE=false' : '--env USE_EXIT_CODE=true'} \
|
||||||
|
${image} \
|
||||||
|
powershell c:/dist/entrypoint.ps1`;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
exports["default"] = Docker;
|
exports["default"] = Docker;
|
||||||
|
|
||||||
|
@ -226,7 +294,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const platform_1 = __importDefault(__nccwpck_require__(9707));
|
const platform_1 = __importDefault(__nccwpck_require__(9707));
|
||||||
class ImageTag {
|
class ImageTag {
|
||||||
constructor(imageProperties) {
|
constructor(imageProperties) {
|
||||||
const { editorVersion = '2019.2.11f1', targetPlatform = platform_1.default.types.StandaloneLinux64, customImage, } = imageProperties;
|
const { editorVersion = '2019.2.11f1', targetPlatform = ImageTag.getImagePlatformType(process.platform), customImage, } = imageProperties;
|
||||||
if (!ImageTag.versionPattern.test(editorVersion)) {
|
if (!ImageTag.versionPattern.test(editorVersion)) {
|
||||||
throw new Error(`Invalid version "${editorVersion}".`);
|
throw new Error(`Invalid version "${editorVersion}".`);
|
||||||
}
|
}
|
||||||
|
@ -249,7 +317,7 @@ class ImageTag {
|
||||||
generic: '',
|
generic: '',
|
||||||
webgl: 'webgl',
|
webgl: 'webgl',
|
||||||
mac: 'mac-mono',
|
mac: 'mac-mono',
|
||||||
windows: 'windows-mono',
|
windows: 'windows-il2cpp',
|
||||||
linux: 'base',
|
linux: 'base',
|
||||||
linuxIl2cpp: 'linux-il2cpp',
|
linuxIl2cpp: 'linux-il2cpp',
|
||||||
android: 'android',
|
android: 'android',
|
||||||
|
@ -261,8 +329,20 @@ class ImageTag {
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
case 'linux':
|
case 'linux':
|
||||||
return 'ubuntu';
|
return 'ubuntu';
|
||||||
|
case 'win32':
|
||||||
|
return 'windows';
|
||||||
default:
|
default:
|
||||||
throw new Error('The Operating System of this runner is not yet supported.');
|
throw new Error(`The Operating System of this runner, "${platform}", is not yet supported.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static getImagePlatformType(platform) {
|
||||||
|
switch (platform) {
|
||||||
|
case 'linux':
|
||||||
|
return platform_1.default.types.StandaloneLinux64;
|
||||||
|
case 'win32':
|
||||||
|
return platform_1.default.types.StandaloneWindows;
|
||||||
|
default:
|
||||||
|
throw new Error(`The Operating System of this runner, "${platform}", is not yet supported.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static getTargetPlatformSuffix(targetPlatform, editorVersion) {
|
static getTargetPlatformSuffix(targetPlatform, editorVersion) {
|
||||||
|
@ -917,6 +997,10 @@ const ResultsParser = {
|
||||||
return testMeta;
|
return testMeta;
|
||||||
}
|
}
|
||||||
const trace = failure['stack-trace']._cdata;
|
const trace = failure['stack-trace']._cdata;
|
||||||
|
if (trace === undefined) {
|
||||||
|
core.warning(`No cdata in stack trace for test case: ${fullname}`);
|
||||||
|
return testMeta;
|
||||||
|
}
|
||||||
const point = ResultsParser.findAnnotationPoint(trace);
|
const point = ResultsParser.findAnnotationPoint(trace);
|
||||||
if (!point.path || !point.line) {
|
if (!point.path || !point.line) {
|
||||||
core.warning(`Not able to find annotation point for failed test! Test trace: ${trace}`);
|
core.warning(`Not able to find annotation point for failed test! Test trace: ${trace}`);
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,110 @@
|
||||||
|
# Run in ACTIVATE_LICENSE_PATH directory
|
||||||
|
Write-Output "Changing to $ACTIVATE_LICENSE_PATH directory."
|
||||||
|
Push-Location "$ACTIVATE_LICENSE_PATH"
|
||||||
|
|
||||||
|
if ( ($null -ne ${env:UNITY_LICENSE}) -or ($null -ne ${env:UNITY_LICENSE_FILE}) )
|
||||||
|
{
|
||||||
|
#
|
||||||
|
# PERSONAL LICENSE MODE
|
||||||
|
#
|
||||||
|
# This will activate Unity, using a license file
|
||||||
|
#
|
||||||
|
# Note that this is the ONLY WAY for PERSONAL LICENSES in 2020.
|
||||||
|
# * See for more details: https://gitlab.com/gableroux/unity3d-gitlab-ci-example/issues/5#note_72815478
|
||||||
|
#
|
||||||
|
# The license file can be acquired using `game-ci/request-manual-activation-file` action.
|
||||||
|
Write-Output "Requesting activation (personal license)"
|
||||||
|
|
||||||
|
# Set the license file path
|
||||||
|
$FILE_PATH = "$ACTIVATE_LICENSE_PATH\UnityLicenseFile.ulf"
|
||||||
|
|
||||||
|
if ($null -ne ${env:UNITY_LICENSE})
|
||||||
|
{
|
||||||
|
# Copy license file from Github variables
|
||||||
|
Add-Content -Path $FILE_PATH -Value ${env:UNITY_LICENSE}
|
||||||
|
}
|
||||||
|
elseif ($null -ne ${env:UNITY_LICENSE_FILE})
|
||||||
|
{
|
||||||
|
# Copy license file from file system
|
||||||
|
Add-Content -Path $FILE_PATH -Value ${env:UNITY_LICENSE_FILE}
|
||||||
|
}
|
||||||
|
$convert = (Get-Content -Raw $FILE_PATH) -replace "`r`n","`n"
|
||||||
|
[io.file]::WriteAllText($FILE_PATH, $convert)
|
||||||
|
Get-ChildItem -Path $FILE_PATH
|
||||||
|
|
||||||
|
# Activate license
|
||||||
|
$ACTIVATION_OUTPUT = Start-Process -NoNewWindow -Wait -PassThru "C:\Program Files\Unity\Hub\Editor\${env:UNITY_VERSION}\editor\Unity.exe" -ArgumentList "-batchmode -nographics -logFile $ACTIVATE_LICENSE_PATH\activate.log -quit -manualLicenseFile $FILE_PATH"
|
||||||
|
|
||||||
|
# Store the exit code from the verify command
|
||||||
|
$UNITY_EXIT_CODE = $ACTIVATION_OUTPUT.ExitCode
|
||||||
|
|
||||||
|
# The exit code for personal activation is always 1;
|
||||||
|
# Determine whether activation was successful.
|
||||||
|
#
|
||||||
|
# Successful output should include the following:
|
||||||
|
#
|
||||||
|
# "LICENSE SYSTEM [2020120 18:51:20] Next license update check is after 2019-11-25T18:23:38"
|
||||||
|
#
|
||||||
|
$ACTIVATION_SUCCESSFUL = (Get-Content $ACTIVATE_LICENSE_PATH\activate.log | Select-String 'Next license update check is after' | Measure-Object -line | Select-Object -Expand Lines)
|
||||||
|
|
||||||
|
# Set exit code to 0 if activation was successful
|
||||||
|
if ($ACTIVATION_SUCCESSFUL -eq 1)
|
||||||
|
{
|
||||||
|
$UNITY_EXIT_CODE = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove license file
|
||||||
|
Remove-Item -Force $FILE_PATH
|
||||||
|
}
|
||||||
|
elseif ( ($null -ne ${env:UNITY_SERIAL}) -and ($null -ne ${env:UNITY_EMAIL}) -and ($null -ne ${env:UNITY_PASSWORD}) )
|
||||||
|
{
|
||||||
|
#
|
||||||
|
# PROFESSIONAL (SERIAL) LICENSE MODE
|
||||||
|
#
|
||||||
|
# This will activate unity, using the activating process.
|
||||||
|
#
|
||||||
|
# Note: This is the preferred way for PROFESSIONAL LICENSES.
|
||||||
|
#
|
||||||
|
Write-Output "Requesting activation (professional license)"
|
||||||
|
|
||||||
|
# Activate license
|
||||||
|
$ACTIVATION_OUTPUT = Start-Process -NoNewWindow -Wait -PassThru "C:\Program Files\Unity\Hub\Editor\${env:UNITY_VERSION}\editor\Unity.exe" -ArgumentList "-batchmode -nographics -logFile $ACTIVATE_LICENSE_PATH\activate.log -quit -serial ${env:UNITY_SERIAL} -username ${env:UNITY_EMAIL} -password ${env:UNITY_PASSWORD}"
|
||||||
|
|
||||||
|
# Store the exit code from the verify command
|
||||||
|
$UNITY_EXIT_CODE = $ACTIVATION_OUTPUT.ExitCode
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#
|
||||||
|
# NO LICENSE ACTIVATION STRATEGY MATCHED
|
||||||
|
#
|
||||||
|
# This will exit since no activation strategies could be matched.
|
||||||
|
#
|
||||||
|
Write-Output "License activation strategy could not be determined."
|
||||||
|
Write-Output ""
|
||||||
|
Write-Output "Visit https://game.ci/docs/github/getting-started for more"
|
||||||
|
Write-Output "details on how to set up one of the possible activation strategies."
|
||||||
|
|
||||||
|
# Immediately exit as no UNITY_EXIT_CODE can be derived.
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Display information about the result
|
||||||
|
#
|
||||||
|
Get-Content $ACTIVATE_LICENSE_PATH\activate.log
|
||||||
|
if ($UNITY_EXIT_CODE -eq 0)
|
||||||
|
{
|
||||||
|
# Activation was a success
|
||||||
|
Write-Output "Activation complete."
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# Activation failed so exit with the code from the license verification step
|
||||||
|
Write-Output "Unclassified error occured while trying to activate license."
|
||||||
|
Write-Output "Exit code was: $UNITY_EXIT_CODE"
|
||||||
|
exit $UNITY_EXIT_CODE
|
||||||
|
}
|
||||||
|
|
||||||
|
# Return to previous working directory
|
||||||
|
Pop-Location
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Run in ACTIVATE_LICENSE_PATH directory
|
||||||
|
Write-Output "Changing to $ACTIVATE_LICENSE_PATH directory."
|
||||||
|
Push-Location "$ACTIVATE_LICENSE_PATH"
|
||||||
|
|
||||||
|
if ($null -ne ${env:UNITY_SERIAL})
|
||||||
|
{
|
||||||
|
#
|
||||||
|
# PROFESSIONAL (SERIAL) LICENSE MODE
|
||||||
|
#
|
||||||
|
# This will return the license that is currently in use.
|
||||||
|
#
|
||||||
|
$RETURN_OUTPUT = Start-Process -NoNewWindow -Wait -PassThru "C:\Program Files\Unity\Hub\Editor\${env:UNITY_VERSION}\editor\Unity.exe" -ArgumentList "-batchmode -nographics -logFile $FULL_ARTIFACTS_PATH\deactivate.log -quit -returnlicense"
|
||||||
|
|
||||||
|
Get-Content $FULL_ARTIFACTS_PATH\deactivate.log
|
||||||
|
}
|
||||||
|
|
||||||
|
# Return to previous working directory
|
||||||
|
Pop-Location
|
|
@ -0,0 +1,118 @@
|
||||||
|
#
|
||||||
|
# Set and display project path
|
||||||
|
#
|
||||||
|
|
||||||
|
$UNITY_PROJECT_PATH = "${env:GITHUB_WORKSPACE}/${env:PROJECT_PATH}"
|
||||||
|
Write-Output "Using project path $UNITY_PROJECT_PATH"
|
||||||
|
|
||||||
|
#
|
||||||
|
# Set and display the artifacts path
|
||||||
|
#
|
||||||
|
|
||||||
|
Write-Output "Using artifacts path ${env:ARTIFACTS_PATH} to save test results."
|
||||||
|
$FULL_ARTIFACTS_PATH = "${env:GITHUB_WORKSPACE}\${env:ARTIFACTS_PATH}"
|
||||||
|
|
||||||
|
#
|
||||||
|
# Set and display the coverage results path
|
||||||
|
#
|
||||||
|
|
||||||
|
Write-Output "Using coverage results path ${env:COVERAGE_RESULTS_PATH} to save test coverage results."
|
||||||
|
$FULL_COVERAGE_RESULTS_PATH = "${env:GITHUB_WORKSPACE}\${env:COVERAGE_RESULTS_PATH}"
|
||||||
|
|
||||||
|
#
|
||||||
|
# Display custom parameters
|
||||||
|
#
|
||||||
|
|
||||||
|
Write-Output "Using custom parameters ${env:CUSTOM_PARAMETERS}"
|
||||||
|
|
||||||
|
# The following tests are 2019 mode (requires Unity 2019.2.11f1 or later)
|
||||||
|
# Reference: https://docs.unity3d.com/2019.3/Documentation/Manual/CommandLineArguments.html
|
||||||
|
|
||||||
|
#
|
||||||
|
# Display the unity version
|
||||||
|
#
|
||||||
|
|
||||||
|
Write-Output "Using Unity version ${env:UNITY_VERSION} to test."
|
||||||
|
|
||||||
|
#
|
||||||
|
# Overall info
|
||||||
|
#
|
||||||
|
|
||||||
|
Write-Output ""
|
||||||
|
Write-Output "###########################"
|
||||||
|
Write-Output "# Artifacts folder #"
|
||||||
|
Write-Output "###########################"
|
||||||
|
Write-Output ""
|
||||||
|
Write-Output "Creating $FULL_ARTIFACTS_PATH if it does not exist."
|
||||||
|
New-Item -Path "$FULL_ARTIFACTS_PATH" -ItemType Directory
|
||||||
|
|
||||||
|
Write-Output ""
|
||||||
|
Write-Output "###########################"
|
||||||
|
Write-Output "# Project directory #"
|
||||||
|
Write-Output "###########################"
|
||||||
|
Write-Output ""
|
||||||
|
Get-ChildItem -Hidden -Path $UNITY_PROJECT_PATH
|
||||||
|
|
||||||
|
#
|
||||||
|
# Testing for each platform
|
||||||
|
#
|
||||||
|
foreach ( $platform in ${env:TEST_PLATFORMS}.Split(";") )
|
||||||
|
{
|
||||||
|
Write-Output ""
|
||||||
|
Write-Output "###########################"
|
||||||
|
Write-Output "# Testing in $platform #"
|
||||||
|
Write-Output "###########################"
|
||||||
|
Write-Output ""
|
||||||
|
|
||||||
|
if ( $platform -ne "COMBINE_RESULTS" )
|
||||||
|
{
|
||||||
|
$runTests = "-runTests -testPlatform $platform -testResults $FULL_ARTIFACTS_PATH/$platform-results.xml"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$runTests = "-quit"
|
||||||
|
}
|
||||||
|
|
||||||
|
$TEST_OUTPUT = Start-Process -NoNewWindow -Wait -PassThru "C:\Program Files\Unity\Hub\Editor\${env:UNITY_VERSION}\editor\Unity.exe" -ArgumentList "-batchmode -logFile $FULL_ARTIFACTS_PATH\$platform.log -projectPath $UNITY_PROJECT_PATH -coverageResultsPath $FULL_COVERAGE_RESULTS_PATH $runTests -enableCodeCoverage -debugCodeOptimization -coverageOptions ${env:COVERAGE_OPTIONS} ${env:CUSTOM_PARAMETERS}"
|
||||||
|
|
||||||
|
# Catch exit code
|
||||||
|
$TEST_EXIT_CODE = $TEST_OUTPUT.ExitCode
|
||||||
|
|
||||||
|
# Print unity log output
|
||||||
|
Get-Content "$FULL_ARTIFACTS_PATH/$platform.log"
|
||||||
|
|
||||||
|
# Display results
|
||||||
|
if ($TEST_EXIT_CODE -eq 0)
|
||||||
|
{
|
||||||
|
Write-Output "Run succeeded, no failures occurred";
|
||||||
|
}
|
||||||
|
elseif ($TEST_EXIT_CODE -eq 2)
|
||||||
|
{
|
||||||
|
Write-Output "Run succeeded, some tests failed";
|
||||||
|
}
|
||||||
|
elseif ($TEST_EXIT_CODE -eq 3)
|
||||||
|
{
|
||||||
|
Write-Output "Run failure (other failure)";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Write-Output "Unexpected exit code $TEST_EXIT_CODE";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $TEST_EXIT_CODE -ne 0)
|
||||||
|
{
|
||||||
|
$TEST_RUNNER_EXIT_CODE = $TEST_EXIT_CODE
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Output ""
|
||||||
|
Write-Output "###########################"
|
||||||
|
Write-Output "# $platform Results #"
|
||||||
|
Write-Output "###########################"
|
||||||
|
Write-Output ""
|
||||||
|
|
||||||
|
if ($platform -ne "COMBINE_RESULTS")
|
||||||
|
{
|
||||||
|
Get-Content "$FULL_ARTIFACTS_PATH/$platform-results.xml"
|
||||||
|
Get-Content "$FULL_ARTIFACTS_PATH/$platform-results.xml" | Select-String "test-run" | Select-String "Passed"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
if ($null -eq ${env:GIT_PRIVATE_TOKEN})
|
||||||
|
{
|
||||||
|
Write-Output "GIT_PRIVATE_TOKEN unset skipping"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Write-Output "GIT_PRIVATE_TOKEN is set configuring git credentials"
|
||||||
|
|
||||||
|
git config --global credential.helper store
|
||||||
|
git config --global --replace-all url.https://github.com/.insteadOf ssh://git@github.com/
|
||||||
|
git config --global --add url.https://github.com/.insteadOf git@github.com
|
||||||
|
|
||||||
|
git config --global url."https://token:${env:GIT_PRIVATE_TOKEN}@github.com/".insteadOf "https://github.com/"
|
||||||
|
git config --global url."https://ssh:${env:GIT_PRIVATE_TOKEN}@github.com/".insteadOf "ssh://git@github.com/"
|
||||||
|
git config --global url."https://git:${env:GIT_PRIVATE_TOKEN}@github.com/".insteadOf "git@github.com:"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Output "---------- git config --list -------------"
|
||||||
|
git config --list
|
||||||
|
|
||||||
|
Write-Output "---------- git config --list --show-origin -------------"
|
||||||
|
git config --list --show-origin
|
|
@ -4,8 +4,8 @@ import path from 'path';
|
||||||
|
|
||||||
describe('Action', () => {
|
describe('Action', () => {
|
||||||
describe('compatibility check', () => {
|
describe('compatibility check', () => {
|
||||||
it('throws for anything other than linux', () => {
|
it('throws for anything other than linux or windows', () => {
|
||||||
if (process.platform !== 'linux') {
|
if (process.platform !== 'linux' && process.platform !== 'win32') {
|
||||||
expect(() => Action.checkCompatibility()).toThrow();
|
expect(() => Action.checkCompatibility()).toThrow();
|
||||||
} else {
|
} else {
|
||||||
expect(() => Action.checkCompatibility()).not.toThrow();
|
expect(() => Action.checkCompatibility()).not.toThrow();
|
||||||
|
|
|
@ -2,7 +2,7 @@ import path from 'path';
|
||||||
|
|
||||||
const Action = {
|
const Action = {
|
||||||
get supportedPlatforms() {
|
get supportedPlatforms() {
|
||||||
return ['linux'];
|
return ['linux', 'win32'];
|
||||||
},
|
},
|
||||||
|
|
||||||
get isRunningLocally() {
|
get isRunningLocally() {
|
||||||
|
|
|
@ -4,6 +4,21 @@ import path from 'path';
|
||||||
|
|
||||||
const Docker = {
|
const Docker = {
|
||||||
async run(image, parameters, silent = false) {
|
async run(image, parameters, silent = false) {
|
||||||
|
let runCommand = '';
|
||||||
|
switch (process.platform) {
|
||||||
|
case 'linux':
|
||||||
|
runCommand = this.getLinuxCommand(image, parameters);
|
||||||
|
break;
|
||||||
|
case 'win32':
|
||||||
|
runCommand = this.getWindowsCommand(image, parameters);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Error(`Operation system, ${process.platform}, is not supported yet.`);
|
||||||
|
}
|
||||||
|
await exec(runCommand, undefined, { silent });
|
||||||
|
},
|
||||||
|
|
||||||
|
getLinuxCommand(image, parameters): string {
|
||||||
const {
|
const {
|
||||||
actionFolder,
|
actionFolder,
|
||||||
editorVersion,
|
editorVersion,
|
||||||
|
@ -28,51 +43,125 @@ const Docker = {
|
||||||
testMode === 'all' ? ['playmode', 'editmode', 'COMBINE_RESULTS'] : [testMode]
|
testMode === 'all' ? ['playmode', 'editmode', 'COMBINE_RESULTS'] : [testMode]
|
||||||
).join(';');
|
).join(';');
|
||||||
|
|
||||||
const command = `docker run \
|
return `docker run \
|
||||||
--workdir /github/workspace \
|
--workdir /github/workspace \
|
||||||
--rm \
|
--rm \
|
||||||
--env UNITY_LICENSE \
|
--env UNITY_LICENSE \
|
||||||
--env UNITY_LICENSE_FILE \
|
--env UNITY_LICENSE_FILE \
|
||||||
--env UNITY_EMAIL \
|
--env UNITY_EMAIL \
|
||||||
--env UNITY_PASSWORD \
|
--env UNITY_PASSWORD \
|
||||||
--env UNITY_SERIAL \
|
--env UNITY_SERIAL \
|
||||||
--env UNITY_VERSION="${editorVersion}" \
|
--env UNITY_VERSION="${editorVersion}" \
|
||||||
--env PROJECT_PATH="${projectPath}" \
|
--env PROJECT_PATH="${projectPath}" \
|
||||||
--env CUSTOM_PARAMETERS="${customParameters}" \
|
--env CUSTOM_PARAMETERS="${customParameters}" \
|
||||||
--env TEST_PLATFORMS="${testPlatforms}" \
|
--env TEST_PLATFORMS="${testPlatforms}" \
|
||||||
--env COVERAGE_OPTIONS="${coverageOptions}" \
|
--env COVERAGE_OPTIONS="${coverageOptions}" \
|
||||||
--env COVERAGE_RESULTS_PATH="CodeCoverage" \
|
--env COVERAGE_RESULTS_PATH="CodeCoverage" \
|
||||||
--env ARTIFACTS_PATH="${artifactsPath}" \
|
--env ARTIFACTS_PATH="${artifactsPath}" \
|
||||||
--env GITHUB_REF \
|
--env GITHUB_REF \
|
||||||
--env GITHUB_SHA \
|
--env GITHUB_SHA \
|
||||||
--env GITHUB_REPOSITORY \
|
--env GITHUB_REPOSITORY \
|
||||||
--env GITHUB_ACTOR \
|
--env GITHUB_ACTOR \
|
||||||
--env GITHUB_WORKFLOW \
|
--env GITHUB_WORKFLOW \
|
||||||
--env GITHUB_HEAD_REF \
|
--env GITHUB_HEAD_REF \
|
||||||
--env GITHUB_BASE_REF \
|
--env GITHUB_BASE_REF \
|
||||||
--env GITHUB_EVENT_NAME \
|
--env GITHUB_EVENT_NAME \
|
||||||
--env GITHUB_WORKSPACE=/github/workspace \
|
--env GITHUB_WORKSPACE="/github/workspace" \
|
||||||
--env GITHUB_ACTION \
|
--env GITHUB_ACTION \
|
||||||
--env GITHUB_EVENT_PATH \
|
--env GITHUB_EVENT_PATH \
|
||||||
--env RUNNER_OS \
|
--env RUNNER_OS \
|
||||||
--env RUNNER_TOOL_CACHE \
|
--env RUNNER_TOOL_CACHE \
|
||||||
--env RUNNER_TEMP \
|
--env RUNNER_TEMP \
|
||||||
--env RUNNER_WORKSPACE \
|
--env RUNNER_WORKSPACE \
|
||||||
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
|
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
|
||||||
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
|
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
|
||||||
--volume "${githubHome}":"/root:z" \
|
--volume "${githubHome}:/root:z" \
|
||||||
--volume "${githubWorkflow}":"/github/workflow:z" \
|
--volume "${githubWorkflow}:/github/workflow:z" \
|
||||||
--volume "${workspace}":"/github/workspace:z" \
|
--volume "${workspace}:/github/workspace:z" \
|
||||||
--volume "${actionFolder}/steps":"/steps:z" \
|
--volume "${actionFolder}/steps:/steps:z" \
|
||||||
--volume "${actionFolder}/entrypoint.sh":"/entrypoint.sh:z" \
|
--volume "${actionFolder}/entrypoint.sh:/entrypoint.sh:z" \
|
||||||
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
|
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
|
||||||
${sshAgent ? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro' : ''} \
|
${
|
||||||
${useHostNetwork ? '--net=host' : ''} \
|
sshAgent ? `--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro` : ''
|
||||||
${githubToken ? '--env USE_EXIT_CODE=false' : '--env USE_EXIT_CODE=true'} \
|
} \
|
||||||
${image} \
|
${useHostNetwork ? '--net=host' : ''} \
|
||||||
/bin/bash /entrypoint.sh`;
|
${githubToken ? '--env USE_EXIT_CODE=false' : '--env USE_EXIT_CODE=true'} \
|
||||||
|
${image} \
|
||||||
|
/bin/bash -c /entrypoint.sh`;
|
||||||
|
},
|
||||||
|
|
||||||
await exec(command, undefined, { silent });
|
getWindowsCommand(image, parameters): string {
|
||||||
|
const {
|
||||||
|
actionFolder,
|
||||||
|
editorVersion,
|
||||||
|
workspace,
|
||||||
|
projectPath,
|
||||||
|
customParameters,
|
||||||
|
testMode,
|
||||||
|
coverageOptions,
|
||||||
|
artifactsPath,
|
||||||
|
useHostNetwork,
|
||||||
|
sshAgent,
|
||||||
|
gitPrivateToken,
|
||||||
|
githubToken,
|
||||||
|
runnerTemporaryPath,
|
||||||
|
} = parameters;
|
||||||
|
|
||||||
|
const githubHome = path.join(runnerTemporaryPath, '_github_home');
|
||||||
|
if (!existsSync(githubHome)) mkdirSync(githubHome);
|
||||||
|
const githubWorkflow = path.join(runnerTemporaryPath, '_github_workflow');
|
||||||
|
if (!existsSync(githubWorkflow)) mkdirSync(githubWorkflow);
|
||||||
|
const testPlatforms = (
|
||||||
|
testMode === 'all' ? ['playmode', 'editmode', 'COMBINE_RESULTS'] : [testMode]
|
||||||
|
).join(';');
|
||||||
|
|
||||||
|
return `docker run \
|
||||||
|
--workdir /github/workspace \
|
||||||
|
--rm \
|
||||||
|
--env UNITY_LICENSE \
|
||||||
|
--env UNITY_LICENSE_FILE \
|
||||||
|
--env UNITY_EMAIL \
|
||||||
|
--env UNITY_PASSWORD \
|
||||||
|
--env UNITY_SERIAL \
|
||||||
|
--env UNITY_VERSION="${editorVersion}" \
|
||||||
|
--env PROJECT_PATH="${projectPath}" \
|
||||||
|
--env CUSTOM_PARAMETERS="${customParameters}" \
|
||||||
|
--env TEST_PLATFORMS="${testPlatforms}" \
|
||||||
|
--env COVERAGE_OPTIONS="${coverageOptions}" \
|
||||||
|
--env COVERAGE_RESULTS_PATH="CodeCoverage" \
|
||||||
|
--env ARTIFACTS_PATH="${artifactsPath}" \
|
||||||
|
--env GITHUB_REF \
|
||||||
|
--env GITHUB_SHA \
|
||||||
|
--env GITHUB_REPOSITORY \
|
||||||
|
--env GITHUB_ACTOR \
|
||||||
|
--env GITHUB_WORKFLOW \
|
||||||
|
--env GITHUB_HEAD_REF \
|
||||||
|
--env GITHUB_BASE_REF \
|
||||||
|
--env GITHUB_EVENT_NAME \
|
||||||
|
--env GITHUB_WORKSPACE="/github/workspace" \
|
||||||
|
--env GITHUB_ACTION \
|
||||||
|
--env GITHUB_EVENT_PATH \
|
||||||
|
--env RUNNER_OS \
|
||||||
|
--env RUNNER_TOOL_CACHE \
|
||||||
|
--env RUNNER_TEMP \
|
||||||
|
--env RUNNER_WORKSPACE \
|
||||||
|
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
|
||||||
|
${sshAgent ? '--env SSH_AUTH_SOCK=c:/ssh-agent' : ''} \
|
||||||
|
--volume "${githubHome}":"c:/root" \
|
||||||
|
--volume "${githubWorkflow}":"c:/github/workflow" \
|
||||||
|
--volume "${workspace}":"c:/github/workspace" \
|
||||||
|
--volume "${actionFolder}/steps":"c:/steps" \
|
||||||
|
--volume "${actionFolder}":"c:/dist" \
|
||||||
|
${sshAgent ? `--volume ${sshAgent}:c:/ssh-agent` : ''} \
|
||||||
|
${
|
||||||
|
sshAgent
|
||||||
|
? `--volume c:/Users/Administrator/.ssh/known_hosts:c:/root/.ssh/known_hosts`
|
||||||
|
: ''
|
||||||
|
} \
|
||||||
|
${useHostNetwork ? '--net=host' : ''} \
|
||||||
|
${githubToken ? '--env USE_EXIT_CODE=false' : '--env USE_EXIT_CODE=true'} \
|
||||||
|
${image} \
|
||||||
|
powershell c:/dist/entrypoint.ps1`;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class ImageTag {
|
||||||
constructor(imageProperties) {
|
constructor(imageProperties) {
|
||||||
const {
|
const {
|
||||||
editorVersion = '2019.2.11f1',
|
editorVersion = '2019.2.11f1',
|
||||||
targetPlatform = Platform.types.StandaloneLinux64,
|
targetPlatform = ImageTag.getImagePlatformType(process.platform),
|
||||||
customImage,
|
customImage,
|
||||||
} = imageProperties;
|
} = imageProperties;
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class ImageTag {
|
||||||
generic: '',
|
generic: '',
|
||||||
webgl: 'webgl',
|
webgl: 'webgl',
|
||||||
mac: 'mac-mono',
|
mac: 'mac-mono',
|
||||||
windows: 'windows-mono',
|
windows: 'windows-il2cpp',
|
||||||
linux: 'base',
|
linux: 'base',
|
||||||
linuxIl2cpp: 'linux-il2cpp',
|
linuxIl2cpp: 'linux-il2cpp',
|
||||||
android: 'android',
|
android: 'android',
|
||||||
|
@ -56,8 +56,25 @@ class ImageTag {
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
case 'linux':
|
case 'linux':
|
||||||
return 'ubuntu';
|
return 'ubuntu';
|
||||||
|
case 'win32':
|
||||||
|
return 'windows';
|
||||||
default:
|
default:
|
||||||
throw new Error('The Operating System of this runner is not yet supported.');
|
throw new Error(
|
||||||
|
`The Operating System of this runner, "${platform}", is not yet supported.`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static getImagePlatformType(platform) {
|
||||||
|
switch (platform) {
|
||||||
|
case 'linux':
|
||||||
|
return Platform.types.StandaloneLinux64;
|
||||||
|
case 'win32':
|
||||||
|
return Platform.types.StandaloneWindows;
|
||||||
|
default:
|
||||||
|
throw new Error(
|
||||||
|
`The Operating System of this runner, "${platform}", is not yet supported.`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,24 @@ describe('ResultsParser', () => {
|
||||||
expect(result.annotation).toBeUndefined();
|
expect(result.annotation).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('no cdata in stack trace', () => {
|
||||||
|
const result = ResultsParser.convertTestCase('Test Suite', {
|
||||||
|
_attributes: {
|
||||||
|
name: 'Test Name',
|
||||||
|
duration: '3.14',
|
||||||
|
},
|
||||||
|
failure: {
|
||||||
|
message: { _cdata: 'Message CDATA' },
|
||||||
|
'stack-trace': {},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(result.suite).toBe('Test Suite');
|
||||||
|
expect(result.title).toBe('Test Name');
|
||||||
|
expect(result.duration).toBe(3.14);
|
||||||
|
expect(result.annotation).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
test('no annotation path', () => {
|
test('no annotation path', () => {
|
||||||
const result = ResultsParser.convertTestCase('Test Suite', {
|
const result = ResultsParser.convertTestCase('Test Suite', {
|
||||||
_attributes: {
|
_attributes: {
|
||||||
|
|
|
@ -90,6 +90,10 @@ const ResultsParser = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const trace = failure['stack-trace']._cdata;
|
const trace = failure['stack-trace']._cdata;
|
||||||
|
if (trace === undefined) {
|
||||||
|
core.warning(`No cdata in stack trace for test case: ${fullname}`);
|
||||||
|
return testMeta;
|
||||||
|
}
|
||||||
const point = ResultsParser.findAnnotationPoint(trace);
|
const point = ResultsParser.findAnnotationPoint(trace);
|
||||||
if (!point.path || !point.line) {
|
if (!point.path || !point.line) {
|
||||||
core.warning(`Not able to find annotation point for failed test! Test trace: ${trace}`);
|
core.warning(`Not able to find annotation point for failed test! Test trace: ${trace}`);
|
||||||
|
|
Loading…
Reference in New Issue