Fix camelCase and duplicate variables

pull/305/head
Andrew Kahr 2022-01-24 15:13:06 -08:00
parent 1a72aa18eb
commit b16eb09671
3 changed files with 34 additions and 55 deletions

27
dist/index.js vendored
View File

@ -420,7 +420,7 @@ class Docker {
static run(image, parameters, silent = false) { static run(image, parameters, silent = false) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const { version, workspace, unitySerial, runnerTempPath, platform, projectPath, buildName, buildPath, buildFile, buildMethod, buildVersion, androidVersionCode, androidKeystoreName, androidKeystoreBase64, androidKeystorePass, androidKeyaliasName, androidKeyaliasPass, androidTargetSdkVersion, androidSdkManagerParameters, customParameters, sshAgent, gitPrivateToken, chownFilesTo, } = parameters; const { version, workspace, unitySerial, runnerTempPath, platform, projectPath, buildName, buildPath, buildFile, buildMethod, buildVersion, androidVersionCode, androidKeystoreName, androidKeystoreBase64, androidKeystorePass, androidKeyaliasName, androidKeyaliasPass, androidTargetSdkVersion, androidSdkManagerParameters, customParameters, sshAgent, gitPrivateToken, chownFilesTo, } = parameters;
const baseOSSpecificArgs = this.getBaseOSSpecificArgs(process.platform, parameters); const baseOsSpecificArguments = this.getBaseOsSpecificArguments(process.platform, workspace, unitySerial, runnerTempPath, sshAgent);
const runCommand = `docker run \ const runCommand = `docker run \
--workdir /github/workspace \ --workdir /github/workspace \
--rm \ --rm \
@ -463,14 +463,22 @@ class Docker {
--env RUNNER_TEMP \ --env RUNNER_TEMP \
--env RUNNER_WORKSPACE \ --env RUNNER_WORKSPACE \
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \ --env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
${baseOSSpecificArgs} \ ${baseOsSpecificArguments} \
${image}`; ${image}`;
yield exec_1.exec(runCommand, undefined, { silent }); yield exec_1.exec(runCommand, undefined, { silent });
}); });
} }
static getBaseOSSpecificArgs(baseOS, parameters) { static getBaseOsSpecificArguments(baseOs, workspace, unitySerial, runnerTemporaryPath, sshAgent) {
const { version, workspace, unitySerial, runnerTempPath, platform, projectPath, buildName, buildPath, buildFile, buildMethod, buildVersion, androidVersionCode, androidKeystoreName, androidKeystoreBase64, androidKeystorePass, androidKeyaliasName, androidKeyaliasPass, androidTargetSdkVersion, androidSdkManagerParameters, customParameters, sshAgent, gitPrivateToken, chownFilesTo, } = parameters; switch (baseOs) {
switch (baseOS) { case 'linux':
return `--env UNITY_SERIAL
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
--volume "/var/run/docker.sock":"/var/run/docker.sock" \
--volume "${runnerTemporaryPath}/_github_home":"/root" \
--volume "${runnerTemporaryPath}/_github_workflow":"/github/workflow" \
--volume "${workspace}":"/github/workspace" \
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
${sshAgent ? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro' : ''}`;
case 'win32': case 'win32':
return `--env UNITY_SERIAL="${unitySerial} \ return `--env UNITY_SERIAL="${unitySerial} \
--volume "${workspace}":"c:/github/workspace" \ --volume "${workspace}":"c:/github/workspace" \
@ -479,15 +487,6 @@ class Docker {
--volume "C:/Program Files (x86)/Windows Kits":"C:/Program Files (x86)/Windows Kits" \ --volume "C:/Program Files (x86)/Windows Kits":"C:/Program Files (x86)/Windows Kits" \
--volume "C:/ProgramData/Microsoft/VisualStudio":"C:/ProgramData/Microsoft/VisualStudio"`; --volume "C:/ProgramData/Microsoft/VisualStudio":"C:/ProgramData/Microsoft/VisualStudio"`;
//Note: When upgrading to Server 2022, we will need to move to just "program files" since VS will be 64-bit //Note: When upgrading to Server 2022, we will need to move to just "program files" since VS will be 64-bit
case 'linux':
return `--env UNITY_SERIAL
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
--volume "/var/run/docker.sock":"/var/run/docker.sock" \
--volume "${runnerTempPath}/_github_home":"/root" \
--volume "${runnerTempPath}/_github_workflow":"/github/workflow" \
--volume "${workspace}":"/github/workspace" \
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
${sshAgent ? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro' : ''}`;
} }
return ''; return '';
} }

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -44,7 +44,13 @@ class Docker {
chownFilesTo, chownFilesTo,
} = parameters; } = parameters;
const baseOSSpecificArgs = this.getBaseOSSpecificArgs(process.platform, parameters); const baseOsSpecificArguments = this.getBaseOsSpecificArguments(
process.platform,
workspace,
unitySerial,
runnerTempPath,
sshAgent,
);
const runCommand = `docker run \ const runCommand = `docker run \
--workdir /github/workspace \ --workdir /github/workspace \
@ -88,40 +94,23 @@ class Docker {
--env RUNNER_TEMP \ --env RUNNER_TEMP \
--env RUNNER_WORKSPACE \ --env RUNNER_WORKSPACE \
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \ --env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
${baseOSSpecificArgs} \ ${baseOsSpecificArguments} \
${image}`; ${image}`;
await exec(runCommand, undefined, { silent }); await exec(runCommand, undefined, { silent });
} }
static getBaseOSSpecificArgs(baseOS: NodeJS.Platform, parameters): string { static getBaseOsSpecificArguments(baseOs, workspace, unitySerial, runnerTemporaryPath, sshAgent): string {
const { switch (baseOs) {
version, case 'linux':
workspace, return `--env UNITY_SERIAL
unitySerial, ${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
runnerTempPath, --volume "/var/run/docker.sock":"/var/run/docker.sock" \
platform, --volume "${runnerTemporaryPath}/_github_home":"/root" \
projectPath, --volume "${runnerTemporaryPath}/_github_workflow":"/github/workflow" \
buildName, --volume "${workspace}":"/github/workspace" \
buildPath, ${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
buildFile, ${sshAgent ? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro' : ''}`;
buildMethod,
buildVersion,
androidVersionCode,
androidKeystoreName,
androidKeystoreBase64,
androidKeystorePass,
androidKeyaliasName,
androidKeyaliasPass,
androidTargetSdkVersion,
androidSdkManagerParameters,
customParameters,
sshAgent,
gitPrivateToken,
chownFilesTo,
} = parameters;
switch(baseOS) {
case 'win32': case 'win32':
return `--env UNITY_SERIAL="${unitySerial} \ return `--env UNITY_SERIAL="${unitySerial} \
--volume "${workspace}":"c:/github/workspace" \ --volume "${workspace}":"c:/github/workspace" \
@ -129,16 +118,7 @@ class Docker {
--volume "C:/Program Files (x86)/Microsoft Visual Studio":"C:/Program Files (x86)/Microsoft Visual Studio" \ --volume "C:/Program Files (x86)/Microsoft Visual Studio":"C:/Program Files (x86)/Microsoft Visual Studio" \
--volume "C:/Program Files (x86)/Windows Kits":"C:/Program Files (x86)/Windows Kits" \ --volume "C:/Program Files (x86)/Windows Kits":"C:/Program Files (x86)/Windows Kits" \
--volume "C:/ProgramData/Microsoft/VisualStudio":"C:/ProgramData/Microsoft/VisualStudio"`; --volume "C:/ProgramData/Microsoft/VisualStudio":"C:/ProgramData/Microsoft/VisualStudio"`;
//Note: When upgrading to Server 2022, we will need to move to just "program files" since VS will be 64-bit //Note: When upgrading to Server 2022, we will need to move to just "program files" since VS will be 64-bit
case 'linux':
return `--env UNITY_SERIAL
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
--volume "/var/run/docker.sock":"/var/run/docker.sock" \
--volume "${runnerTempPath}/_github_home":"/root" \
--volume "${runnerTempPath}/_github_workflow":"/github/workflow" \
--volume "${workspace}":"/github/workspace" \
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
${sshAgent ? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro' : ''}`;
} }
return ''; return '';
} }