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) {
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 baseOSSpecificArgs = this.getBaseOSSpecificArgs(process.platform, parameters);
const baseOsSpecificArguments = this.getBaseOsSpecificArguments(process.platform, workspace, unitySerial, runnerTempPath, sshAgent);
const runCommand = `docker run \
--workdir /github/workspace \
--rm \
@ -463,14 +463,22 @@ class Docker {
--env RUNNER_TEMP \
--env RUNNER_WORKSPACE \
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
${baseOSSpecificArgs} \
${baseOsSpecificArguments} \
${image}`;
yield exec_1.exec(runCommand, undefined, { silent });
});
}
static getBaseOSSpecificArgs(baseOS, 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;
switch (baseOS) {
static getBaseOsSpecificArguments(baseOs, workspace, unitySerial, runnerTemporaryPath, sshAgent) {
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':
return `--env UNITY_SERIAL="${unitySerial} \
--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:/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
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 '';
}

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,
} = parameters;
const baseOSSpecificArgs = this.getBaseOSSpecificArgs(process.platform, parameters);
const baseOsSpecificArguments = this.getBaseOsSpecificArguments(
process.platform,
workspace,
unitySerial,
runnerTempPath,
sshAgent,
);
const runCommand = `docker run \
--workdir /github/workspace \
@ -88,40 +94,23 @@ class Docker {
--env RUNNER_TEMP \
--env RUNNER_WORKSPACE \
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
${baseOSSpecificArgs} \
${baseOsSpecificArguments} \
${image}`;
await exec(runCommand, undefined, { silent });
}
static getBaseOSSpecificArgs(baseOS: NodeJS.Platform, parameters): string {
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) {
static getBaseOsSpecificArguments(baseOs, workspace, unitySerial, runnerTemporaryPath, sshAgent): string {
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':
return `--env UNITY_SERIAL="${unitySerial} \
--volume "${workspace}":"c:/github/workspace" \
@ -130,15 +119,6 @@ class Docker {
--volume "C:/Program Files (x86)/Windows Kits":"C:/Program Files (x86)/Windows Kits" \
--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
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 '';
}