From b94200d3d45b6c3444ef978465d519069c4ade89 Mon Sep 17 00:00:00 2001 From: David Finol Date: Mon, 21 Feb 2022 13:19:28 -0600 Subject: [PATCH] Sync docs2 (#341) * Run build * Sync docs --- action.yml | 114 ++++++++++++++++++---------------------- dist/index.js | Bin 22916382 -> 22916286 bytes dist/index.js.map | Bin 17683072 -> 17682875 bytes dist/xhr-sync-worker.js | 60 +++++++++++++++++++++ src/model/input.ts | 60 ++++++++++----------- 5 files changed, 142 insertions(+), 92 deletions(-) create mode 100644 dist/xhr-sync-worker.js diff --git a/action.yml b/action.yml index 9db67e8b..d1a94a97 100644 --- a/action.yml +++ b/action.yml @@ -2,6 +2,10 @@ name: 'Unity - Builder' author: Webber Takken description: 'Build Unity projects for different platforms.' inputs: + targetPlatform: + required: true + default: '' + description: 'Platform that the build should target.' unityVersion: required: false default: 'auto' @@ -10,10 +14,6 @@ inputs: required: false default: '' description: 'Specific docker image that should be used for building the project' - targetPlatform: - required: false - default: '' - description: 'Platform that the build should target.' projectPath: required: false default: '' @@ -22,18 +22,6 @@ inputs: required: false default: '' 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: required: false default: '' @@ -42,38 +30,10 @@ inputs: required: false default: '' description: 'Path to a Namespace.Class.StaticMethod to run to perform the build.' - cloudRunnerCluster: - default: 'local' + customParameters: 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: '' - 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.' - 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.' + description: 'Custom parameters to configure the build.' versioning: required: false default: 'Semantic' @@ -114,14 +74,6 @@ inputs: required: false default: '' 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: required: false default: '' @@ -129,8 +81,7 @@ inputs: gitPrivateToken: required: false default: '' - description: > - Github private token to pull from github + description: 'Github private token to pull from github' chownFilesTo: required: false default: '' @@ -138,12 +89,51 @@ inputs: allowDirtyBuild: required: false default: '' - description: > - Allows the branch of the build to be dirty, and still generate the build. - - Note that it is generally bad practice to modify your branch - in a CI Pipeline. However there are exceptions where this might - be needed. (use with care). + description: 'Allows the branch of the build to be dirty, and still generate 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)' + 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: volume: description: 'The Persistent Volume (PV) where the build artifacts have been stored by Kubernetes' diff --git a/dist/index.js b/dist/index.js index fbbe3e0c76652c521738b86f5532732cd5a0dfdc..1c745567aa00260bfcff44720cd8ba4bb4da27c3 100644 GIT binary patch delta 2621 zcmYk+2~<>79LMqV{sV}^GHy8R4C@HN2+kldh>{|rxFNU{in0ufF@OVBW+aMBCW1)$ z&oax@%Cdr}o>``}nO0KS=2B5vsimZqSt<4V4{CAF=X>tG^X{F;n=`ZZ_$BS@$1Z7G zH>YsXsFs17PP@Ceyp)o{FLoX3kBPQLYaPkWY1)AH66^NCE$%syEvB5bmhv2(2LEMy2ejHz*3~J|vv7IrvK4NKALao)gF>gtg&1%T4 zag~@R94v>HD$Ky-m?sb z$%S^DW^|r!ea<< ziaDEiT~Q*r^NNxzBZJGr%AzoiyQ<6>;Cx%T|Kdu!y|ALBx>nXrJT#SzeD10e!2^1f za98JL+-g<))VvG>h$Kx|7p~QJ##NIKoU>GCIhK7K-G23kB(~oo_GeNaX!L9f(|D@Qb)->v%1Ro-`}mSUp42)eC3IsBp(=+MxRWO#TXQIY)NxJdY1~+O3%o%G{h&V#fPpXwd_d0AgD?1j zKLkJ^1VJ!_fB`}w48kD-A|VQlFa)9@25y2_hyxQ0g?LDSVPFOeB*Jh=f@DYmE2P2* zNQ03u3ew?b7!6|}1I9uojDsu~4-+68Cc-3`3{zk#!8TdT4|u*Z|G25nAAWcmOs5!-KFH9)gEq3p@f_ z;Zb-Dw!!1D9d^J@cmke;r(hR64bQ-Ccov?6=b;ta;00)h7vUv%8C2KnbB=M09 zmgptE5%Bs3c4hE{TvtN}?o2$q-4jBt~+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fk*0cgpG)PuG{rQcH~r_a7i^+^SN-Ax@5ORnE4JsXU%EZ*IUp$Ct;xy5~|^(; zQcnj8)_u=a0VemqEwtTBBU_h>?poE)l3fUQ~emxkRS*cZ)Lp_&pHug5thuGusngGGCQ3%6Zhux^v|G23MUgr-+{bzujkRdeF1;b#BxS68 zP)6Q+i%BU#aRC-69-o3qwbyt*bnIMB#hX2mdRz(+` z=j7N4>3TTFz9n53r%UcMy+@8s)rE5SQ{7fhl^a^p{JOO@bGnW(1hBi&NIflCiH_xtCY*2xWexM{cJWc()GSH7uXixs5< zT~fMszmkk{qqSs<(cJoYlTK`6-&_lctkQh-77nb^h=3E3aKVizM58I1p*dRMJj9?S zTH$=eqBY{s25oTx;*o$vc+d_>Xpau)h)zgGXQZGDx*`?b&>d;G5It}a($N#W&>MY_ zfxgH@KU|DU&>sUZ5SL;Q24e^=!{r!?D{v*Q!qpgt;TVCD7=>$aEkBGvhUu7rTQC#1A_uw1gAcdCerNdzpa8Ql8@FQ)?!a8! ziFvpSccT#VQG^93#yz+f3$X}`aUYi8ek?@^9zZD`#4;?$3amsK1gr269>ybh6p!I? zti~EVfpV!?K?-oQS*iMOyHZ{r;tz(Kr=_wYVGz=!w { + 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); + }); + } +}); diff --git a/src/model/input.ts b/src/model/input.ts index 0150d46d..105c5e60 100644 --- a/src/model/input.ts +++ b/src/model/input.ts @@ -69,6 +69,10 @@ class Input { return Input.getInput('GITHUB_RUN_NUMBER') || '0'; } + static get targetPlatform() { + return Input.getInput('targetPlatform') || Platform.default; + } + static get unityVersion() { return Input.getInput('unityVersion') || 'auto'; } @@ -77,10 +81,6 @@ class Input { return Input.getInput('customImage'); } - static get targetPlatform() { - return Input.getInput('targetPlatform') || Platform.default; - } - static get projectPath() { const input = Input.getInput('projectPath'); const rawProjectPath = input @@ -104,6 +104,10 @@ class Input { return Input.getInput('buildMethod') || ''; // processed in docker file } + static get customParameters() { + return Input.getInput('customParameters') || ''; + } + static get versioningStrategy() { return Input.getInput('versioning') || 'Semantic'; } @@ -146,24 +150,10 @@ class Input { 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() { return Input.getInput('sshAgent') || ''; } - static async githubToken() { - return Input.getInput('githubToken') || (await GithubCliReader.GetGitHubAuthToken()) || ''; - } - static async gitPrivateToken() { return core.getInput('gitPrivateToken') || (await Input.githubToken()); } @@ -172,6 +162,12 @@ class Input { return Input.getInput('chownFilesTo') || ''; } + static get allowDirtyBuild() { + const input = Input.getInput('allowDirtyBuild') || false; + + return input === 'true'; + } + static get postBuildSteps() { return Input.getInput('postBuildSteps') || ''; } @@ -184,34 +180,38 @@ class Input { return Input.getInput('customJob') || ''; } - static get cloudRunnerCluster() { - return Input.getInput('cloudRunnerCluster') || ''; - } - static get awsBaseStackName() { return Input.getInput('awsBaseStackName') || 'game-ci'; } - static get kubeConfig() { - return Input.getInput('kubeConfig') || ''; - } - - static get cloudRunnerMemory() { - return Input.getInput('cloudRunnerMemory') || '750M'; + static get cloudRunnerCluster() { + return Input.getInput('cloudRunnerCluster') || 'local'; } static get cloudRunnerCpu() { return Input.getInput('cloudRunnerCpu') || '1.0'; } - static get kubeVolumeSize() { - return Input.getInput('kubeVolumeSize') || '5Gi'; + static get cloudRunnerMemory() { + 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() { return Input.getInput('kubeVolume') || ''; } + static get kubeVolumeSize() { + return Input.getInput('kubeVolumeSize') || '5Gi'; + } + public static ToEnvVarFormat(input: string) { return input .replace(/([A-Z])/g, ' $1')