Sync docs2 (#341)

* Run build

* Sync docs
This commit is contained in:
David Finol 2022-02-21 13:19:28 -06:00 committed by GitHub
parent a6ebcb5b75
commit b94200d3d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 142 additions and 92 deletions

View File

@ -2,6 +2,10 @@ name: 'Unity - Builder'
author: Webber Takken <webber@takken.io> author: Webber Takken <webber@takken.io>
description: 'Build Unity projects for different platforms.' description: 'Build Unity projects for different platforms.'
inputs: inputs:
targetPlatform:
required: true
default: ''
description: 'Platform that the build should target.'
unityVersion: unityVersion:
required: false required: false
default: 'auto' default: 'auto'
@ -10,10 +14,6 @@ inputs:
required: false required: false
default: '' default: ''
description: 'Specific docker image that should be used for building the project' description: 'Specific docker image that should be used for building the project'
targetPlatform:
required: false
default: ''
description: 'Platform that the build should target.'
projectPath: projectPath:
required: false required: false
default: '' default: ''
@ -22,18 +22,6 @@ inputs:
required: false required: false
default: '' default: ''
description: 'Name of the build.' description: 'Name of the build.'
postBuildSteps:
required: false
default: ''
description: 'run a post build job in yaml format with the keys image, secrets (name, value object array), command string'
preBuildSteps:
required: false
default: ''
description: 'Run a pre build job after the repository setup but before the build job (in yaml format with the keys image, secrets (name, value object array), command line string)'
customJob:
required: false
default: ''
description: 'Run a custom job instead of the standard build automation for cloud runner (in yaml format with the keys image, secrets (name, value object array), command line string)'
buildsPath: buildsPath:
required: false required: false
default: '' default: ''
@ -42,38 +30,10 @@ inputs:
required: false required: false
default: '' default: ''
description: 'Path to a Namespace.Class.StaticMethod to run to perform the build.' description: 'Path to a Namespace.Class.StaticMethod to run to perform the build.'
cloudRunnerCluster: customParameters:
default: 'local'
required: false required: false
description: 'Either local, k8s or aws can be used to run builds on a remote cluster. Additional parameters must be configured.'
awsStackName:
default: 'game-ci'
required: false
description: 'The Cloud Formation stack name that must be setup before using this option.'
kubeConfig:
default: '' default: ''
required: false description: 'Custom parameters to configure the build.'
description: 'Supply a base64 encoded kubernetes config to run builds on kubernetes and stream logs until completion.'
kubeVolume:
default: ''
required: false
description: 'Supply a Persistent Volume Claim name to use for the Unity build.'
cloudRunnerMemory:
default: '750M'
required: false
description: 'Amount of memory to assign the remote build container'
cloudRunnerCpu:
default: '1.0'
required: false
description: 'Amount of CPU time to assign the remote build container'
kubeVolumeSize:
default: '5Gi'
required: false
description: 'Amount of disc space to assign the Kubernetes Persistent Volume'
githubToken:
default: ''
required: false
description: 'GitHub token for cloning, only needed when kubeconfig is used.'
versioning: versioning:
required: false required: false
default: 'Semantic' default: 'Semantic'
@ -114,14 +74,6 @@ inputs:
required: false required: false
default: '' default: ''
description: 'The android target API level.' description: 'The android target API level.'
customParameters:
required: false
default: ''
description: >
Custom parameters to configure the build.
Parameters must start with a hyphen (-) and may be followed by a value (without hyphen).
Parameters without a value will be considered booleans (with a value of true).
sshAgent: sshAgent:
required: false required: false
default: '' default: ''
@ -129,8 +81,7 @@ inputs:
gitPrivateToken: gitPrivateToken:
required: false required: false
default: '' default: ''
description: > description: 'Github private token to pull from github'
Github private token to pull from github
chownFilesTo: chownFilesTo:
required: false required: false
default: '' default: ''
@ -138,12 +89,51 @@ inputs:
allowDirtyBuild: allowDirtyBuild:
required: false required: false
default: '' default: ''
description: > description: 'Allows the branch of the build to be dirty, and still generate the build.'
Allows the branch of the build to be dirty, and still generate the build. postBuildSteps:
required: false
Note that it is generally bad practice to modify your branch default: ''
in a CI Pipeline. However there are exceptions where this might description: 'run a post build job in yaml format with the keys image, secrets (name, value object array), command string'
be needed. (use with care). preBuildSteps:
required: false
default: ''
description: 'Run a pre build job after the repository setup but before the build job (in yaml format with the keys image, secrets (name, value object array), command line string)'
customJob:
required: false
default: ''
description: 'Run a custom job instead of the standard build automation for cloud runner (in yaml format with the keys image, secrets (name, value object array), command line string)'
awsBaseStackName:
default: 'game-ci'
required: false
description: 'The Cloud Formation stack name that must be setup before using this option.'
cloudRunnerCluster:
default: 'local'
required: false
description: 'Either local, k8s or aws can be used to run builds on a remote cluster. Additional parameters must be configured.'
cloudRunnerCpu:
default: '1.0'
required: false
description: 'Amount of CPU time to assign the remote build container'
cloudRunnerMemory:
default: '750M'
required: false
description: 'Amount of memory to assign the remote build container'
githubToken:
default: ''
required: false
description: 'GitHub token for cloning, only needed when kubeconfig is used.'
kubeConfig:
default: ''
required: false
description: 'Supply a base64 encoded kubernetes config to run builds on kubernetes and stream logs until completion.'
kubeVolume:
default: ''
required: false
description: 'Supply a Persistent Volume Claim name to use for the Unity build.'
kubeVolumeSize:
default: '5Gi'
required: false
description: 'Amount of disc space to assign the Kubernetes Persistent Volume'
outputs: outputs:
volume: volume:
description: 'The Persistent Volume (PV) where the build artifacts have been stored by Kubernetes' description: 'The Persistent Volume (PV) where the build artifacts have been stored by Kubernetes'

BIN
dist/index.js generated vendored

Binary file not shown.

BIN
dist/index.js.map generated vendored

Binary file not shown.

60
dist/xhr-sync-worker.js vendored Normal file
View File

@ -0,0 +1,60 @@
"use strict";
/* eslint-disable no-process-exit */
const util = require("util");
const { JSDOM } = require("../../../..");
const { READY_STATES } = require("./xhr-utils");
const idlUtils = require("../generated/utils");
const tough = require("tough-cookie");
const dom = new JSDOM();
const xhr = new dom.window.XMLHttpRequest();
const xhrImpl = idlUtils.implForWrapper(xhr);
const chunks = [];
process.stdin.on("data", chunk => {
chunks.push(chunk);
});
process.stdin.on("end", () => {
const buffer = Buffer.concat(chunks);
const flag = JSON.parse(buffer.toString());
if (flag.body && flag.body.type === "Buffer" && flag.body.data) {
flag.body = Buffer.from(flag.body.data);
}
if (flag.cookieJar) {
flag.cookieJar = tough.CookieJar.fromJSON(flag.cookieJar);
}
flag.synchronous = false;
Object.assign(xhrImpl.flag, flag);
const { properties } = xhrImpl;
xhrImpl.readyState = READY_STATES.OPENED;
try {
xhr.addEventListener("loadend", () => {
if (properties.error) {
properties.error = properties.error.stack || util.inspect(properties.error);
}
process.stdout.write(JSON.stringify({
responseURL: xhrImpl.responseURL,
status: xhrImpl.status,
statusText: xhrImpl.statusText,
properties
}), () => {
process.exit(0);
});
}, false);
xhr.send(flag.body);
} catch (error) {
properties.error += error.stack || util.inspect(error);
process.stdout.write(JSON.stringify({
responseURL: xhrImpl.responseURL,
status: xhrImpl.status,
statusText: xhrImpl.statusText,
properties
}), () => {
process.exit(0);
});
}
});

View File

@ -69,6 +69,10 @@ class Input {
return Input.getInput('GITHUB_RUN_NUMBER') || '0'; return Input.getInput('GITHUB_RUN_NUMBER') || '0';
} }
static get targetPlatform() {
return Input.getInput('targetPlatform') || Platform.default;
}
static get unityVersion() { static get unityVersion() {
return Input.getInput('unityVersion') || 'auto'; return Input.getInput('unityVersion') || 'auto';
} }
@ -77,10 +81,6 @@ class Input {
return Input.getInput('customImage'); return Input.getInput('customImage');
} }
static get targetPlatform() {
return Input.getInput('targetPlatform') || Platform.default;
}
static get projectPath() { static get projectPath() {
const input = Input.getInput('projectPath'); const input = Input.getInput('projectPath');
const rawProjectPath = input const rawProjectPath = input
@ -104,6 +104,10 @@ class Input {
return Input.getInput('buildMethod') || ''; // processed in docker file return Input.getInput('buildMethod') || ''; // processed in docker file
} }
static get customParameters() {
return Input.getInput('customParameters') || '';
}
static get versioningStrategy() { static get versioningStrategy() {
return Input.getInput('versioning') || 'Semantic'; return Input.getInput('versioning') || 'Semantic';
} }
@ -146,24 +150,10 @@ class Input {
return core.getInput('androidTargetSdkVersion') || ''; return core.getInput('androidTargetSdkVersion') || '';
} }
static get allowDirtyBuild() {
const input = Input.getInput('allowDirtyBuild') || false;
return input === 'true';
}
static get customParameters() {
return Input.getInput('customParameters') || '';
}
static get sshAgent() { static get sshAgent() {
return Input.getInput('sshAgent') || ''; return Input.getInput('sshAgent') || '';
} }
static async githubToken() {
return Input.getInput('githubToken') || (await GithubCliReader.GetGitHubAuthToken()) || '';
}
static async gitPrivateToken() { static async gitPrivateToken() {
return core.getInput('gitPrivateToken') || (await Input.githubToken()); return core.getInput('gitPrivateToken') || (await Input.githubToken());
} }
@ -172,6 +162,12 @@ class Input {
return Input.getInput('chownFilesTo') || ''; return Input.getInput('chownFilesTo') || '';
} }
static get allowDirtyBuild() {
const input = Input.getInput('allowDirtyBuild') || false;
return input === 'true';
}
static get postBuildSteps() { static get postBuildSteps() {
return Input.getInput('postBuildSteps') || ''; return Input.getInput('postBuildSteps') || '';
} }
@ -184,34 +180,38 @@ class Input {
return Input.getInput('customJob') || ''; return Input.getInput('customJob') || '';
} }
static get cloudRunnerCluster() {
return Input.getInput('cloudRunnerCluster') || '';
}
static get awsBaseStackName() { static get awsBaseStackName() {
return Input.getInput('awsBaseStackName') || 'game-ci'; return Input.getInput('awsBaseStackName') || 'game-ci';
} }
static get kubeConfig() { static get cloudRunnerCluster() {
return Input.getInput('kubeConfig') || ''; return Input.getInput('cloudRunnerCluster') || 'local';
}
static get cloudRunnerMemory() {
return Input.getInput('cloudRunnerMemory') || '750M';
} }
static get cloudRunnerCpu() { static get cloudRunnerCpu() {
return Input.getInput('cloudRunnerCpu') || '1.0'; return Input.getInput('cloudRunnerCpu') || '1.0';
} }
static get kubeVolumeSize() { static get cloudRunnerMemory() {
return Input.getInput('kubeVolumeSize') || '5Gi'; return Input.getInput('cloudRunnerMemory') || '750M';
}
static async githubToken() {
return Input.getInput('githubToken') || (await GithubCliReader.GetGitHubAuthToken()) || '';
}
static get kubeConfig() {
return Input.getInput('kubeConfig') || '';
} }
static get kubeVolume() { static get kubeVolume() {
return Input.getInput('kubeVolume') || ''; return Input.getInput('kubeVolume') || '';
} }
static get kubeVolumeSize() {
return Input.getInput('kubeVolumeSize') || '5Gi';
}
public static ToEnvVarFormat(input: string) { public static ToEnvVarFormat(input: string) {
return input return input
.replace(/([A-Z])/g, ' $1') .replace(/([A-Z])/g, ' $1')