chore: rewrite more imports to deno style
parent
8966e493f5
commit
b62407866b
|
|
@ -16,6 +16,9 @@
|
||||||
"es6": true,
|
"es6": true,
|
||||||
"jest/globals": true
|
"jest/globals": true
|
||||||
},
|
},
|
||||||
|
"globals": {
|
||||||
|
"Deno": true
|
||||||
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
// Error out for code formatting errors
|
// Error out for code formatting errors
|
||||||
"prettier/prettier": "error",
|
"prettier/prettier": "error",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
|
"lib": ["deno.window"],
|
||||||
|
"strict": true
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"files": {
|
||||||
|
"include": ["src/"],
|
||||||
|
"exclude": []
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"tags": ["recommended"],
|
||||||
|
"include": ["ban-untagged-todo"],
|
||||||
|
"exclude": ["no-unused-vars"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"fmt": {
|
||||||
|
"files": {
|
||||||
|
"include": ["src/"],
|
||||||
|
"exclude": []
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"useTabs": false,
|
||||||
|
"lineWidth": 120,
|
||||||
|
"indentWidth": 2,
|
||||||
|
"singleQuote": true,
|
||||||
|
"proseWrap": "preserve"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
deno.ts
3
deno.ts
|
|
@ -1,3 +0,0 @@
|
||||||
// These are the packages from Deno that replace the ones from Node.
|
|
||||||
import * as fs from 'https://deno.land/std@0.142.0/node/fs/promises.ts';
|
|
||||||
import * as path from 'https://deno.land/std@0.141.0/path/mod.ts';
|
|
||||||
|
|
@ -46,7 +46,6 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@arkweid/lefthook": "^0.7.7",
|
"@arkweid/lefthook": "^0.7.7",
|
||||||
"@types/jest": "^27.4.1",
|
"@types/jest": "^27.4.1",
|
||||||
"@types/node": "^17.0.23",
|
|
||||||
"@types/semver": "^7.3.9",
|
"@types/semver": "^7.3.9",
|
||||||
"@typescript-eslint/parser": "4.8.1",
|
"@typescript-eslint/parser": "4.8.1",
|
||||||
"@vercel/ncc": "^0.33.3",
|
"@vercel/ncc": "^0.33.3",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
// These are the packages from Deno that replace the ones from Node.
|
||||||
|
import * as fs from 'https://deno.land/std@0.142.0/node/fs/promises.ts';
|
||||||
|
import * as fsSync from 'https://deno.land/std@0.142.0/node/fs/mod.ts';
|
||||||
|
import * as path from 'https://deno.land/std@0.142.0/path/mod.ts';
|
||||||
|
import * as core from 'https://deno.land/x/deno_actions_core/mod.ts';
|
||||||
|
import { v4 as uuid } from 'https://deno.land/std@0.142.0/uuid/mod.ts';
|
||||||
|
import * as assert from 'https://deno.land/std@0.142.0/testing/mod.ts';
|
||||||
|
import * as YAML from 'https://deno.land/x/yaml@v2.1.1/mod.ts';
|
||||||
|
import * as aws from 'https://deno.land/x/aws_sdk@v3.32.0-1/mod.ts';
|
||||||
|
import * as k8s from 'https://deno.land/x/kubernetes_client/mod.ts';
|
||||||
|
import * as nanoid from 'https://deno.land/x/nanoid/mod.ts';
|
||||||
|
|
||||||
|
const exec = () => {
|
||||||
|
throw new Error('exec is not implemented'); // @actions/exec'
|
||||||
|
};
|
||||||
|
|
||||||
|
const getUnityChangeSet = () => {
|
||||||
|
throw new Error('getUnityChangeSet is not implemented'); // unity-changeset'
|
||||||
|
};
|
||||||
|
|
||||||
|
const __filename = path.fromFileUrl(import.meta.url);
|
||||||
|
const __dirname = path.dirname(path.fromFileUrl(import.meta.url));
|
||||||
|
|
||||||
|
export { fs, fsSync, path, core, exec, uuid, assert, YAML, __filename, __dirname, getUnityChangeSet, aws, k8s, nanoid };
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
import * as asserts from 'https://deno.land/std@0.142.0/testing/mod.ts';
|
||||||
|
|
||||||
|
// Dev dependencies also include all prod dependencies.
|
||||||
|
export * from './dependencies.ts';
|
||||||
|
|
||||||
|
export { asserts };
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import { stat } from 'https://deno.land/std@0.142.0/node/fs/promises/mod.ts';
|
import { fs } from '../dependencies.ts';
|
||||||
|
|
||||||
describe('Integrity tests', () => {
|
describe('Integrity tests', () => {
|
||||||
describe('package-lock.json', () => {
|
describe('package-lock.json', () => {
|
||||||
it('does not exist', async () => {
|
it('does not exist', async () => {
|
||||||
await expect(stat(`${process.cwd()}/package-lock.json`)).rejects.toThrowError();
|
await expect(fs.stat(`${process.cwd()}/package-lock.json`)).rejects.toThrowError();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import * as path from 'https://deno.land/std@0.141.0/path/mod.ts';
|
import { fs, path } from '../dependencies.ts';
|
||||||
import fs from '../../../node_modules/fs';
|
|
||||||
import Action from './action.ts';
|
import Action from './action.ts';
|
||||||
|
|
||||||
describe('Action', () => {
|
describe('Action', () => {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import * as path from 'https://deno.land/std@0.141.0/path/mod.ts';
|
import { path, __dirname } from '../dependencies.ts';
|
||||||
|
|
||||||
class Action {
|
class Action {
|
||||||
static get supportedPlatforms() {
|
static get supportedPlatforms() {
|
||||||
|
|
@ -6,11 +6,11 @@ class Action {
|
||||||
}
|
}
|
||||||
|
|
||||||
static get isRunningLocally() {
|
static get isRunningLocally() {
|
||||||
return process.env.RUNNER_WORKSPACE === undefined;
|
return Deno.env.get('RUNNER_WORKSPACE') === undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
static get isRunningFromSource() {
|
static get isRunningFromSource() {
|
||||||
return path.basename(__dirname) === "model";
|
return path.basename(__dirname) === 'model';
|
||||||
}
|
}
|
||||||
|
|
||||||
static get canonicalName() {
|
static get canonicalName() {
|
||||||
|
|
@ -30,7 +30,7 @@ class Action {
|
||||||
}
|
}
|
||||||
|
|
||||||
static get workspace() {
|
static get workspace() {
|
||||||
return process.env.GITHUB_WORKSPACE;
|
return Deno.env.get('GITHUB_WORKSPACE');
|
||||||
}
|
}
|
||||||
|
|
||||||
static checkCompatibility() {
|
static checkCompatibility() {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import Platform from './platform.ts';
|
||||||
// Todo - Don't use process.env directly, that's what the input model class is for.
|
// Todo - Don't use process.env directly, that's what the input model class is for.
|
||||||
const testLicense =
|
const testLicense =
|
||||||
'<?xml version="1.0" encoding="UTF-8"?><root>\n <License id="Terms">\n <MachineBindings>\n <Binding Key="1" Value="576562626572264761624c65526f7578"/>\n <Binding Key="2" Value="576562626572264761624c65526f7578"/>\n </MachineBindings>\n <MachineID Value="D7nTUnjNAmtsUMcnoyrqkgIbYdM="/>\n <SerialHash Value="2033b8ac3e6faa3742ca9f0bfae44d18f2a96b80"/>\n <Features>\n <Feature Value="33"/>\n <Feature Value="1"/>\n <Feature Value="12"/>\n <Feature Value="2"/>\n <Feature Value="24"/>\n <Feature Value="3"/>\n <Feature Value="36"/>\n <Feature Value="17"/>\n <Feature Value="19"/>\n <Feature Value="62"/>\n </Features>\n <DeveloperData Value="AQAAAEY0LUJHUlgtWEQ0RS1aQ1dWLUM1SlctR0RIQg=="/>\n <SerialMasked Value="F4-BGRX-XD4E-ZCWV-C5JW-XXXX"/>\n <StartDate Value="2021-02-08T00:00:00"/>\n <UpdateDate Value="2021-02-09T00:34:57"/>\n <InitialActivationDate Value="2021-02-08T00:34:56"/>\n <LicenseVersion Value="6.x"/>\n <ClientProvidedVersion Value="2018.4.30f1"/>\n <AlwaysOnline Value="false"/>\n <Entitlements>\n <Entitlement Ns="unity_editor" Tag="UnityPersonal" Type="EDITOR" ValidTo="9999-12-31T00:00:00"/>\n <Entitlement Ns="unity_editor" Tag="DarkSkin" Type="EDITOR_FEATURE" ValidTo="9999-12-31T00:00:00"/>\n </Entitlements>\n </License>\n<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"/><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/><Reference URI="#Terms"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><DigestValue>m0Db8UK+ktnOLJBtHybkfetpcKo=</DigestValue></Reference></SignedInfo><SignatureValue>o/pUbSQAukz7+ZYAWhnA0AJbIlyyCPL7bKVEM2lVqbrXt7cyey+umkCXamuOgsWPVUKBMkXtMH8L\n5etLmD0getWIhTGhzOnDCk+gtIPfL4jMo9tkEuOCROQAXCci23VFscKcrkB+3X6h4wEOtA2APhOY\nB+wvC794o8/82ffjP79aVAi57rp3Wmzx+9pe9yMwoJuljAy2sc2tIMgdQGWVmOGBpQm3JqsidyzI\nJWG2kjnc7pDXK9pwYzXoKiqUqqrut90d+kQqRyv7MSZXR50HFqD/LI69h68b7P8Bjo3bPXOhNXGR\n9YCoemH6EkfCJxp2gIjzjWW+l2Hj2EsFQi8YXw==</SignatureValue></Signature></root>';
|
'<?xml version="1.0" encoding="UTF-8"?><root>\n <License id="Terms">\n <MachineBindings>\n <Binding Key="1" Value="576562626572264761624c65526f7578"/>\n <Binding Key="2" Value="576562626572264761624c65526f7578"/>\n </MachineBindings>\n <MachineID Value="D7nTUnjNAmtsUMcnoyrqkgIbYdM="/>\n <SerialHash Value="2033b8ac3e6faa3742ca9f0bfae44d18f2a96b80"/>\n <Features>\n <Feature Value="33"/>\n <Feature Value="1"/>\n <Feature Value="12"/>\n <Feature Value="2"/>\n <Feature Value="24"/>\n <Feature Value="3"/>\n <Feature Value="36"/>\n <Feature Value="17"/>\n <Feature Value="19"/>\n <Feature Value="62"/>\n </Features>\n <DeveloperData Value="AQAAAEY0LUJHUlgtWEQ0RS1aQ1dWLUM1SlctR0RIQg=="/>\n <SerialMasked Value="F4-BGRX-XD4E-ZCWV-C5JW-XXXX"/>\n <StartDate Value="2021-02-08T00:00:00"/>\n <UpdateDate Value="2021-02-09T00:34:57"/>\n <InitialActivationDate Value="2021-02-08T00:34:56"/>\n <LicenseVersion Value="6.x"/>\n <ClientProvidedVersion Value="2018.4.30f1"/>\n <AlwaysOnline Value="false"/>\n <Entitlements>\n <Entitlement Ns="unity_editor" Tag="UnityPersonal" Type="EDITOR" ValidTo="9999-12-31T00:00:00"/>\n <Entitlement Ns="unity_editor" Tag="DarkSkin" Type="EDITOR_FEATURE" ValidTo="9999-12-31T00:00:00"/>\n </Entitlements>\n </License>\n<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"/><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/><Reference URI="#Terms"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><DigestValue>m0Db8UK+ktnOLJBtHybkfetpcKo=</DigestValue></Reference></SignedInfo><SignatureValue>o/pUbSQAukz7+ZYAWhnA0AJbIlyyCPL7bKVEM2lVqbrXt7cyey+umkCXamuOgsWPVUKBMkXtMH8L\n5etLmD0getWIhTGhzOnDCk+gtIPfL4jMo9tkEuOCROQAXCci23VFscKcrkB+3X6h4wEOtA2APhOY\nB+wvC794o8/82ffjP79aVAi57rp3Wmzx+9pe9yMwoJuljAy2sc2tIMgdQGWVmOGBpQm3JqsidyzI\nJWG2kjnc7pDXK9pwYzXoKiqUqqrut90d+kQqRyv7MSZXR50HFqD/LI69h68b7P8Bjo3bPXOhNXGR\n9YCoemH6EkfCJxp2gIjzjWW+l2Hj2EsFQi8YXw==</SignatureValue></Signature></root>';
|
||||||
process.env.UNITY_LICENSE = testLicense;
|
Deno.env.set('UNITY_LICENSE', testLicense);
|
||||||
|
|
||||||
const determineVersion = jest.spyOn(Versioning, 'determineBuildVersion').mockImplementation(async () => '1.3.37');
|
const determineVersion = jest.spyOn(Versioning, 'determineBuildVersion').mockImplementation(async () => '1.3.37');
|
||||||
const determineUnityVersion = jest
|
const determineUnityVersion = jest
|
||||||
|
|
|
||||||
|
|
@ -76,17 +76,17 @@ class BuildParameters {
|
||||||
// Todo - Don't use process.env directly, that's what the input model class is for.
|
// Todo - Don't use process.env directly, that's what the input model class is for.
|
||||||
// ---
|
// ---
|
||||||
let unitySerial = '';
|
let unitySerial = '';
|
||||||
if (!process.env.UNITY_SERIAL && Input.githubInputEnabled) {
|
if (!Deno.env.get('UNITY_SERIAL') && Input.githubInputEnabled) {
|
||||||
// No serial was present, so it is a personal license that we need to convert
|
// No serial was present, so it is a personal license that we need to convert
|
||||||
if (!process.env.UNITY_LICENSE) {
|
if (!Deno.env.get('UNITY_LICENSE')) {
|
||||||
throw new Error(`Missing Unity License File and no Serial was found. If this
|
throw new Error(`Missing Unity License File and no Serial was found. If this
|
||||||
is a personal license, make sure to follow the activation
|
is a personal license, make sure to follow the activation
|
||||||
steps and set the UNITY_LICENSE GitHub secret or enter a Unity
|
steps and set the UNITY_LICENSE GitHub secret or enter a Unity
|
||||||
serial number inside the UNITY_SERIAL GitHub secret.`);
|
serial number inside the UNITY_SERIAL GitHub secret.`);
|
||||||
}
|
}
|
||||||
unitySerial = this.getSerialFromLicenseFile(process.env.UNITY_LICENSE);
|
unitySerial = this.getSerialFromLicenseFile(Deno.env.get('UNITY_LICENSE'));
|
||||||
} else {
|
} else {
|
||||||
unitySerial = process.env.UNITY_SERIAL!;
|
unitySerial = Deno.env.get('UNITY_SERIAL')!;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -94,7 +94,7 @@ class BuildParameters {
|
||||||
customImage: Input.customImage,
|
customImage: Input.customImage,
|
||||||
unitySerial,
|
unitySerial,
|
||||||
|
|
||||||
runnerTempPath: process.env.RUNNER_TEMP,
|
runnerTempPath: Deno.env.get('RUNNER_TEMP'),
|
||||||
targetPlatform: Input.targetPlatform,
|
targetPlatform: Input.targetPlatform,
|
||||||
projectPath: Input.projectPath,
|
projectPath: Input.projectPath,
|
||||||
buildName: Input.buildName,
|
buildName: Input.buildName,
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
import * as core from '../../../node_modules/@actions/core';
|
import { fsSync, core } from '../dependencies.ts';
|
||||||
import fs from '../../../node_modules/fs';
|
|
||||||
import Action from './action.ts';
|
import Action from './action.ts';
|
||||||
import Project from './project.ts';
|
import Project from './project.ts';
|
||||||
|
|
||||||
class Cache {
|
class Cache {
|
||||||
static verify() {
|
static verify() {
|
||||||
if (!fs.existsSync(Project.libraryFolder)) {
|
if (!fsSync.existsSync(Project.libraryFolder)) {
|
||||||
this.notifyAboutCachingPossibility();
|
this.notifyAboutCachingPossibility();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Command } from '../../../node_modules/commander-ts';
|
import { Command } from '../../../node_modules/commander-ts';
|
||||||
import { BuildParameters, CloudRunner, ImageTag, Input } from '../index.ts';
|
import { BuildParameters, CloudRunner, ImageTag, Input } from '../index.ts';
|
||||||
import * as core from '../../../node_modules/@actions/core';
|
import { core } from '../../dependencies.ts';
|
||||||
import { ActionYamlReader } from '../input-readers/action-yaml.ts';
|
import { ActionYamlReader } from '../input-readers/action-yaml.ts';
|
||||||
import CloudRunnerLogger from '../cloud-runner/services/cloud-runner-logger.ts';
|
import CloudRunnerLogger from '../cloud-runner/services/cloud-runner-logger.ts';
|
||||||
import CloudRunnerQueryOverride from '../cloud-runner/services/cloud-runner-query-override.ts';
|
import CloudRunnerQueryOverride from '../cloud-runner/services/cloud-runner-query-override.ts';
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import * as SDK from 'aws-sdk';
|
import { aws } from '../../../../dependencies.ts';
|
||||||
import CloudRunnerAWSTaskDef from './cloud-runner-aws-task-def.ts';
|
import CloudRunnerAWSTaskDef from './cloud-runner-aws-task-def.ts';
|
||||||
import CloudRunnerSecret from '../../services/cloud-runner-secret.ts';
|
import CloudRunnerSecret from '../../services/cloud-runner-secret.ts';
|
||||||
import { AWSCloudFormationTemplates } from './aws-cloud-formation-templates.ts';
|
import { AWSCloudFormationTemplates } from './aws-cloud-formation-templates.ts';
|
||||||
|
|
@ -13,7 +13,7 @@ export class AWSJobStack {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async setupCloudFormations(
|
public async setupCloudFormations(
|
||||||
CF: SDK.CloudFormation,
|
CF: aws.CloudFormation,
|
||||||
buildGuid: string,
|
buildGuid: string,
|
||||||
image: string,
|
image: string,
|
||||||
entrypoint: string[],
|
entrypoint: string[],
|
||||||
|
|
@ -118,7 +118,7 @@ export class AWSJobStack {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const createStackInput: SDK.CloudFormation.CreateStackInput = {
|
const createStackInput: aws.CloudFormation.CreateStackInput = {
|
||||||
StackName: taskDefStackName,
|
StackName: taskDefStackName,
|
||||||
TemplateBody: taskDefCloudFormation,
|
TemplateBody: taskDefCloudFormation,
|
||||||
Capabilities: ['CAPABILITY_IAM'],
|
Capabilities: ['CAPABILITY_IAM'],
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ export class AwsCliCommands {
|
||||||
}
|
}
|
||||||
@CliFunction(`aws-list-stacks`, `List stacks`)
|
@CliFunction(`aws-list-stacks`, `List stacks`)
|
||||||
static async awsListStacks(perResultCallback: any = false, verbose: boolean = false) {
|
static async awsListStacks(perResultCallback: any = false, verbose: boolean = false) {
|
||||||
process.env.AWS_REGION = Input.region;
|
Deno.env.set('AWS_REGION', Input.region);
|
||||||
const CF = new AWS.CloudFormation();
|
const CF = new AWS.CloudFormation();
|
||||||
const stacks =
|
const stacks =
|
||||||
(await CF.listStacks().promise()).StackSummaries?.filter(
|
(await CF.listStacks().promise()).StackSummaries?.filter(
|
||||||
|
|
@ -71,7 +71,7 @@ export class AwsCliCommands {
|
||||||
}
|
}
|
||||||
@CliFunction(`aws-list-tasks`, `List tasks`)
|
@CliFunction(`aws-list-tasks`, `List tasks`)
|
||||||
static async awsListTasks(perResultCallback: any = false) {
|
static async awsListTasks(perResultCallback: any = false) {
|
||||||
process.env.AWS_REGION = Input.region;
|
Deno.env.set('AWS_REGION', Input.region);
|
||||||
const ecs = new AWS.ECS();
|
const ecs = new AWS.ECS();
|
||||||
const clusters = (await ecs.listClusters().promise()).clusterArns || [];
|
const clusters = (await ecs.listClusters().promise()).clusterArns || [];
|
||||||
CloudRunnerLogger.log(`Clusters ${clusters.length}`);
|
CloudRunnerLogger.log(`Clusters ${clusters.length}`);
|
||||||
|
|
@ -105,7 +105,7 @@ export class AwsCliCommands {
|
||||||
}
|
}
|
||||||
@CliFunction(`aws-list-log-groups`, `List tasks`)
|
@CliFunction(`aws-list-log-groups`, `List tasks`)
|
||||||
static async awsListLogGroups(perResultCallback: any = false, verbose: boolean = false) {
|
static async awsListLogGroups(perResultCallback: any = false, verbose: boolean = false) {
|
||||||
process.env.AWS_REGION = Input.region;
|
Deno.env.set('AWS_REGION', Input.region);
|
||||||
const ecs = new AWS.CloudWatchLogs();
|
const ecs = new AWS.CloudWatchLogs();
|
||||||
let logStreamInput: AWS.CloudWatchLogs.DescribeLogGroupsRequest = {
|
let logStreamInput: AWS.CloudWatchLogs.DescribeLogGroupsRequest = {
|
||||||
/* logGroupNamePrefix: 'game-ci' */
|
/* logGroupNamePrefix: 'game-ci' */
|
||||||
|
|
@ -138,7 +138,7 @@ export class AwsCliCommands {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async cleanup(deleteResources = false, OneDayOlderOnly: boolean = false) {
|
private static async cleanup(deleteResources = false, OneDayOlderOnly: boolean = false) {
|
||||||
process.env.AWS_REGION = Input.region;
|
Deno.env.set('AWS_REGION', Input.region);
|
||||||
const CF = new AWS.CloudFormation();
|
const CF = new AWS.CloudFormation();
|
||||||
const ecs = new AWS.ECS();
|
const ecs = new AWS.ECS();
|
||||||
const cwl = new AWS.CloudWatchLogs();
|
const cwl = new AWS.CloudWatchLogs();
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class AWSBuildEnvironment implements ProviderInterface {
|
||||||
environment: CloudRunnerEnvironmentVariable[],
|
environment: CloudRunnerEnvironmentVariable[],
|
||||||
secrets: CloudRunnerSecret[],
|
secrets: CloudRunnerSecret[],
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
process.env.AWS_REGION = Input.region;
|
Deno.env.set('AWS_REGION', Input.region);
|
||||||
const ECS = new SDK.ECS();
|
const ECS = new SDK.ECS();
|
||||||
const CF = new SDK.CloudFormation();
|
const CF = new SDK.CloudFormation();
|
||||||
CloudRunnerLogger.log(`AWS Region: ${CF.config.region}`);
|
CloudRunnerLogger.log(`AWS Region: ${CF.config.region}`);
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
|
import { k8s, core, YAML } from '../../../../dependencies.ts';
|
||||||
import waitUntil from 'async-wait-until';
|
import waitUntil from 'async-wait-until';
|
||||||
import * as core from '../../../node_modules/@actions/core';
|
|
||||||
import * as k8s from '@kubernetes/client-node';
|
|
||||||
import BuildParameters from '../../../build-parameters.ts';
|
import BuildParameters from '../../../build-parameters.ts';
|
||||||
import CloudRunnerLogger from '../../services/cloud-runner-logger.ts';
|
import CloudRunnerLogger from '../../services/cloud-runner-logger.ts';
|
||||||
import YAML from '../../../node_modules/yaml';
|
|
||||||
import { IncomingMessage } from '../../../node_modules/http';
|
import { IncomingMessage } from '../../../node_modules/http';
|
||||||
|
|
||||||
class KubernetesStorage {
|
class KubernetesStorage {
|
||||||
|
|
@ -95,8 +93,8 @@ class KubernetesStorage {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
if (process.env.K8s_STORAGE_PVC_SPEC) {
|
if (Deno.env.get('K8s_STORAGE_PVC_SPEC')) {
|
||||||
YAML.parse(process.env.K8s_STORAGE_PVC_SPEC);
|
YAML.parse(Deno.env.get('K8s_STORAGE_PVC_SPEC'));
|
||||||
}
|
}
|
||||||
const result = await kubeClient.createNamespacedPersistentVolumeClaim(namespace, pvc);
|
const result = await kubeClient.createNamespacedPersistentVolumeClaim(namespace, pvc);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,11 @@
|
||||||
import fs from '../../../node_modules/fs';
|
import { fs, uuid, path, __dirname } from '../../../dependencies.ts';
|
||||||
import * as path from 'https://deno.land/std@0.141.0/path/mod.ts';
|
|
||||||
import BuildParameters from '../../build-parameters.ts';
|
import BuildParameters from '../../build-parameters.ts';
|
||||||
import { Cli } from '../../cli/cli.ts';
|
import { Cli } from '../../cli/cli.ts';
|
||||||
import Input from '../../input.ts';
|
import Input from '../../input.ts';
|
||||||
import UnityVersioning from '../../unity-versioning.ts';
|
import UnityVersioning from '../../unity-versioning.ts';
|
||||||
import CloudRunner from '../cloud-runner';
|
import CloudRunner from '../cloud-runner.ts';
|
||||||
import { CloudRunnerSystem } from '../services/cloud-runner-system';
|
import { CloudRunnerSystem } from '../services/cloud-runner-system/index.ts';
|
||||||
import { Caching } from './caching.ts';
|
import { Caching } from './caching.ts';
|
||||||
import { v4 as uuidv4 } from '../../../node_modules/uuid';
|
|
||||||
|
|
||||||
describe('Cloud Runner Caching', () => {
|
describe('Cloud Runner Caching', () => {
|
||||||
it('responds', () => {});
|
it('responds', () => {});
|
||||||
|
|
@ -20,7 +18,7 @@ describe('Cloud Runner Caching', () => {
|
||||||
projectPath: 'test-project',
|
projectPath: 'test-project',
|
||||||
unityVersion: UnityVersioning.read('test-project'),
|
unityVersion: UnityVersioning.read('test-project'),
|
||||||
targetPlatform: 'StandaloneLinux64',
|
targetPlatform: 'StandaloneLinux64',
|
||||||
cacheKey: `test-case-${uuidv4()}`,
|
cacheKey: `test-case-${uuid()}`,
|
||||||
};
|
};
|
||||||
Input.githubInputEnabled = false;
|
Input.githubInputEnabled = false;
|
||||||
const buildParameter = await BuildParameters.create();
|
const buildParameter = await BuildParameters.create();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
import { assert } from '../../../node_modules/console';
|
import { fs, path, assert } from '../../../dependencies.ts';
|
||||||
import fs from '../../../node_modules/fs';
|
|
||||||
import * as path from 'https://deno.land/std@0.141.0/path/mod.ts';
|
|
||||||
import CloudRunner from '../cloud-runner.ts';
|
import CloudRunner from '../cloud-runner.ts';
|
||||||
import CloudRunnerLogger from '../services/cloud-runner-logger.ts';
|
import CloudRunnerLogger from '../services/cloud-runner-logger.ts';
|
||||||
import { CloudRunnerFolders } from '../services/cloud-runner-folders.ts';
|
import { CloudRunnerFolders } from '../services/cloud-runner-folders.ts';
|
||||||
|
|
@ -16,7 +14,7 @@ export class Caching {
|
||||||
@CliFunction(`cache-push`, `push to cache`)
|
@CliFunction(`cache-push`, `push to cache`)
|
||||||
static async cachePush() {
|
static async cachePush() {
|
||||||
try {
|
try {
|
||||||
const buildParameter = JSON.parse(process.env.BUILD_PARAMETERS || '{}');
|
const buildParameter = JSON.parse(Deno.env.get('BUILD_PARAMETERS') || '{}');
|
||||||
CloudRunner.buildParameters = buildParameter;
|
CloudRunner.buildParameters = buildParameter;
|
||||||
await Caching.PushToCache(
|
await Caching.PushToCache(
|
||||||
Cli.options['cachePushTo'],
|
Cli.options['cachePushTo'],
|
||||||
|
|
@ -31,7 +29,7 @@ export class Caching {
|
||||||
@CliFunction(`cache-pull`, `pull from cache`)
|
@CliFunction(`cache-pull`, `pull from cache`)
|
||||||
static async cachePull() {
|
static async cachePull() {
|
||||||
try {
|
try {
|
||||||
const buildParameter = JSON.parse(process.env.BUILD_PARAMETERS || '{}');
|
const buildParameter = JSON.parse(Deno.env.get('BUILD_PARAMETERS') || '{}');
|
||||||
CloudRunner.buildParameters = buildParameter;
|
CloudRunner.buildParameters = buildParameter;
|
||||||
await Caching.PullFromCache(
|
await Caching.PullFromCache(
|
||||||
Cli.options['cachePushFrom'],
|
Cli.options['cachePushFrom'],
|
||||||
|
|
@ -164,7 +162,7 @@ export class Caching {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async handleCachePurging() {
|
public static async handleCachePurging() {
|
||||||
if (process.env.PURGE_REMOTE_BUILDER_CACHE !== undefined) {
|
if (Deno.env.get('PURGE_REMOTE_BUILDER_CACHE') !== undefined) {
|
||||||
RemoteClientLogger.log(`purging ${CloudRunnerFolders.purgeRemoteCaching}`);
|
RemoteClientLogger.log(`purging ${CloudRunnerFolders.purgeRemoteCaching}`);
|
||||||
fs.promises.rmdir(CloudRunnerFolders.cacheFolder, { recursive: true });
|
fs.promises.rmdir(CloudRunnerFolders.cacheFolder, { recursive: true });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
import fs from '../../../node_modules/fs';
|
import { fs, assert, path } from '../../../dependencies.ts';
|
||||||
import CloudRunner from '../cloud-runner.ts';
|
import CloudRunner from '../cloud-runner.ts';
|
||||||
import { CloudRunnerFolders } from '../services/cloud-runner-folders.ts';
|
import { CloudRunnerFolders } from '../services/cloud-runner-folders.ts';
|
||||||
import { Caching } from './caching.ts';
|
import { Caching } from './caching.ts';
|
||||||
import { LfsHashing } from '../services/lfs-hashing.ts';
|
import { LfsHashing } from '../services/lfs-hashing.ts';
|
||||||
import { RemoteClientLogger } from './remote-client-logger.ts';
|
import { RemoteClientLogger } from './remote-client-logger.ts';
|
||||||
import * as path from 'https://deno.land/std@0.141.0/path/mod.ts';
|
|
||||||
import { assert } from '../../../node_modules/console';
|
|
||||||
import CloudRunnerLogger from '../services/cloud-runner-logger.ts';
|
import CloudRunnerLogger from '../services/cloud-runner-logger.ts';
|
||||||
import { CliFunction } from '../../cli/cli-functions-repository.ts';
|
import { CliFunction } from '../../cli/cli-functions-repository.ts';
|
||||||
import { CloudRunnerSystem } from '../services/cloud-runner-system.ts';
|
import { CloudRunnerSystem } from '../services/cloud-runner-system.ts';
|
||||||
|
|
@ -70,7 +68,7 @@ export class RemoteClient {
|
||||||
RemoteClientLogger.log(`${CloudRunner.buildParameters.branch}`);
|
RemoteClientLogger.log(`${CloudRunner.buildParameters.branch}`);
|
||||||
await CloudRunnerSystem.Run(`git checkout ${CloudRunner.buildParameters.branch}`);
|
await CloudRunnerSystem.Run(`git checkout ${CloudRunner.buildParameters.branch}`);
|
||||||
assert(fs.existsSync(path.join(`.git`, `lfs`)), 'LFS folder should not exist before caching');
|
assert(fs.existsSync(path.join(`.git`, `lfs`)), 'LFS folder should not exist before caching');
|
||||||
RemoteClientLogger.log(`Checked out ${process.env.GITHUB_SHA}`);
|
RemoteClientLogger.log(`Checked out ${Deno.env.get('GITHUB_SHA')}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
@ -87,7 +85,7 @@ export class RemoteClient {
|
||||||
|
|
||||||
@CliFunction(`remote-cli`, `sets up a repository, usually before a game-ci build`)
|
@CliFunction(`remote-cli`, `sets up a repository, usually before a game-ci build`)
|
||||||
static async runRemoteClientJob() {
|
static async runRemoteClientJob() {
|
||||||
const buildParameter = JSON.parse(process.env.BUILD_PARAMETERS || '{}');
|
const buildParameter = JSON.parse(Deno.env.get('BUILD_PARAMETERS') || '{}');
|
||||||
RemoteClientLogger.log(`Build Params:
|
RemoteClientLogger.log(`Build Params:
|
||||||
${JSON.stringify(buildParameter, undefined, 4)}
|
${JSON.stringify(buildParameter, undefined, 4)}
|
||||||
`);
|
`);
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ export class CloudRunnerFolders {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static get purgeRemoteCaching(): boolean {
|
public static get purgeRemoteCaching(): boolean {
|
||||||
return process.env.PURGE_REMOTE_BUILDER_CACHE !== undefined;
|
return Deno.env.get('PURGE_REMOTE_BUILDER_CACHE') !== undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static get lfsCacheFolderFull() {
|
public static get lfsCacheFolderFull() {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import { customAlphabet } from '../../../node_modules/nanoid';
|
import { nanoid } from '../../../dependencies.ts';
|
||||||
import CloudRunnerConstants from './cloud-runner-constants.ts';
|
import CloudRunnerConstants from './cloud-runner-constants.ts';
|
||||||
|
|
||||||
class CloudRunnerNamespace {
|
class CloudRunnerNamespace {
|
||||||
static generateGuid(runNumber: string | number, platform: string) {
|
static generateGuid(runNumber: string | number, platform: string) {
|
||||||
const nanoid = customAlphabet(CloudRunnerConstants.alphabet, 4);
|
const nanoid = nanoid.customAlphabet(CloudRunnerConstants.alphabet, 4);
|
||||||
|
|
||||||
return `${runNumber}-${platform.toLowerCase().replace('standalone', '')}-${nanoid()}`;
|
return `${runNumber}-${platform.toLowerCase().replace('standalone', '')}-${nanoid()}`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
import * as path from 'https://deno.land/std@0.141.0/path/mod.ts';
|
|
||||||
import { CloudRunnerFolders } from './cloud-runner-folders.ts';
|
import { CloudRunnerFolders } from './cloud-runner-folders.ts';
|
||||||
import { CloudRunnerSystem } from './cloud-runner-system.ts';
|
import { CloudRunnerSystem } from './cloud-runner-system.ts';
|
||||||
import fs from '../../../node_modules/fs';
|
import { fsSync as fs, assert, path } from '../../../dependencies.ts';
|
||||||
import { assert } from '../../../node_modules/console';
|
|
||||||
import { Cli } from '../../cli/cli.ts';
|
import { Cli } from '../../cli/cli.ts';
|
||||||
import { CliFunction } from '../../cli/cli-functions-repository.ts';
|
import { CliFunction } from '../../cli/cli-functions-repository.ts';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
import { exec } from '../../../node_modules/@actions/exec';
|
|
||||||
import ImageEnvironmentFactory from './image-environment-factory.ts';
|
import ImageEnvironmentFactory from './image-environment-factory.ts';
|
||||||
import { existsSync, mkdirSync } from '../../../node_modules/fs';
|
import { path, exec, fs } from '../dependencies.ts';
|
||||||
import * as path from 'https://deno.land/std@0.141.0/path/mod.ts';
|
|
||||||
|
|
||||||
class Docker {
|
class Docker {
|
||||||
static async run(image, parameters, silent = false) {
|
static async run(image, parameters, silent = false) {
|
||||||
|
|
@ -20,9 +18,9 @@ class Docker {
|
||||||
const { workspace, actionFolder, runnerTempPath, sshAgent, gitPrivateToken } = parameters;
|
const { workspace, actionFolder, runnerTempPath, sshAgent, gitPrivateToken } = parameters;
|
||||||
|
|
||||||
const githubHome = path.join(runnerTempPath, '_github_home');
|
const githubHome = path.join(runnerTempPath, '_github_home');
|
||||||
if (!existsSync(githubHome)) mkdirSync(githubHome);
|
if (!fs.existsSync(githubHome)) fs.mkdirSync(githubHome);
|
||||||
const githubWorkflow = path.join(runnerTempPath, '_github_workflow');
|
const githubWorkflow = path.join(runnerTempPath, '_github_workflow');
|
||||||
if (!existsSync(githubWorkflow)) mkdirSync(githubWorkflow);
|
if (!fs.existsSync(githubWorkflow)) fs.mkdirSync(githubWorkflow);
|
||||||
|
|
||||||
return `docker run \
|
return `docker run \
|
||||||
--workdir /github/workspace \
|
--workdir /github/workspace \
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,13 @@ class ImageEnvironmentFactory {
|
||||||
}
|
}
|
||||||
public static getEnvironmentVariables(parameters: BuildParameters) {
|
public static getEnvironmentVariables(parameters: BuildParameters) {
|
||||||
const environmentVariables: Parameter[] = [
|
const environmentVariables: Parameter[] = [
|
||||||
{ name: 'UNITY_LICENSE', value: process.env.UNITY_LICENSE || ReadLicense() },
|
{ name: 'UNITY_LICENSE', value: Deno.env.get('UNITY_LICENSE') || ReadLicense() },
|
||||||
{ name: 'UNITY_LICENSE_FILE', value: process.env.UNITY_LICENSE_FILE },
|
{ name: 'UNITY_LICENSE_FILE', value: Deno.env.get('UNITY_LICENSE_FILE') },
|
||||||
{ name: 'UNITY_EMAIL', value: process.env.UNITY_EMAIL },
|
{ name: 'UNITY_EMAIL', value: Deno.env.get('UNITY_EMAIL') },
|
||||||
{ name: 'UNITY_PASSWORD', value: process.env.UNITY_PASSWORD },
|
{ name: 'UNITY_PASSWORD', value: Deno.env.get('UNITY_PASSWORD') },
|
||||||
{ name: 'UNITY_SERIAL', value: parameters.unitySerial },
|
{ name: 'UNITY_SERIAL', value: parameters.unitySerial },
|
||||||
{ name: 'UNITY_VERSION', value: parameters.editorVersion },
|
{ name: 'UNITY_VERSION', value: parameters.editorVersion },
|
||||||
{ name: 'USYM_UPLOAD_AUTH_TOKEN', value: process.env.USYM_UPLOAD_AUTH_TOKEN },
|
{ name: 'USYM_UPLOAD_AUTH_TOKEN', value: Deno.env.get('USYM_UPLOAD_AUTH_TOKEN') },
|
||||||
{ name: 'PROJECT_PATH', value: parameters.projectPath },
|
{ name: 'PROJECT_PATH', value: parameters.projectPath },
|
||||||
{ name: 'BUILD_TARGET', value: parameters.targetPlatform },
|
{ name: 'BUILD_TARGET', value: parameters.targetPlatform },
|
||||||
{ name: 'BUILD_NAME', value: parameters.buildName },
|
{ name: 'BUILD_NAME', value: parameters.buildName },
|
||||||
|
|
@ -50,21 +50,21 @@ class ImageEnvironmentFactory {
|
||||||
{ name: 'ANDROID_SDK_MANAGER_PARAMETERS', value: parameters.androidSdkManagerParameters },
|
{ name: 'ANDROID_SDK_MANAGER_PARAMETERS', value: parameters.androidSdkManagerParameters },
|
||||||
{ name: 'CUSTOM_PARAMETERS', value: parameters.customParameters },
|
{ name: 'CUSTOM_PARAMETERS', value: parameters.customParameters },
|
||||||
{ name: 'CHOWN_FILES_TO', value: parameters.chownFilesTo },
|
{ name: 'CHOWN_FILES_TO', value: parameters.chownFilesTo },
|
||||||
{ name: 'GITHUB_REF', value: process.env.GITHUB_REF },
|
{ name: 'GITHUB_REF', value: Deno.env.get('GITHUB_REF') },
|
||||||
{ name: 'GITHUB_SHA', value: process.env.GITHUB_SHA },
|
{ name: 'GITHUB_SHA', value: Deno.env.get('GITHUB_SHA') },
|
||||||
{ name: 'GITHUB_REPOSITORY', value: process.env.GITHUB_REPOSITORY },
|
{ name: 'GITHUB_REPOSITORY', value: Deno.env.get('GITHUB_REPOSITORY') },
|
||||||
{ name: 'GITHUB_ACTOR', value: process.env.GITHUB_ACTOR },
|
{ name: 'GITHUB_ACTOR', value: Deno.env.get('GITHUB_ACTOR') },
|
||||||
{ name: 'GITHUB_WORKFLOW', value: process.env.GITHUB_WORKFLOW },
|
{ name: 'GITHUB_WORKFLOW', value: Deno.env.get('GITHUB_WORKFLOW') },
|
||||||
{ name: 'GITHUB_HEAD_REF', value: process.env.GITHUB_HEAD_REF },
|
{ name: 'GITHUB_HEAD_REF', value: Deno.env.get('GITHUB_HEAD_REF') },
|
||||||
{ name: 'GITHUB_BASE_REF', value: process.env.GITHUB_BASE_REF },
|
{ name: 'GITHUB_BASE_REF', value: Deno.env.get('GITHUB_BASE_REF') },
|
||||||
{ name: 'GITHUB_EVENT_NAME', value: process.env.GITHUB_EVENT_NAME },
|
{ name: 'GITHUB_EVENT_NAME', value: Deno.env.get('GITHUB_EVENT_NAME') },
|
||||||
{ name: 'GITHUB_WORKSPACE', value: '/github/workspace' },
|
{ name: 'GITHUB_WORKSPACE', value: '/github/workspace' },
|
||||||
{ name: 'GITHUB_ACTION', value: process.env.GITHUB_ACTION },
|
{ name: 'GITHUB_ACTION', value: Deno.env.get('GITHUB_ACTION') },
|
||||||
{ name: 'GITHUB_EVENT_PATH', value: process.env.GITHUB_EVENT_PATH },
|
{ name: 'GITHUB_EVENT_PATH', value: Deno.env.get('GITHUB_EVENT_PATH') },
|
||||||
{ name: 'RUNNER_OS', value: process.env.RUNNER_OS },
|
{ name: 'RUNNER_OS', value: Deno.env.get('RUNNER_OS') },
|
||||||
{ name: 'RUNNER_TOOL_CACHE', value: process.env.RUNNER_TOOL_CACHE },
|
{ name: 'RUNNER_TOOL_CACHE', value: Deno.env.get('RUNNER_TOOL_CACHE') },
|
||||||
{ name: 'RUNNER_TEMP', value: process.env.RUNNER_TEMP },
|
{ name: 'RUNNER_TEMP', value: Deno.env.get('RUNNER_TEMP') },
|
||||||
{ name: 'RUNNER_WORKSPACE', value: process.env.RUNNER_WORKSPACE },
|
{ name: 'RUNNER_WORKSPACE', value: Deno.env.get('RUNNER_WORKSPACE') },
|
||||||
];
|
];
|
||||||
if (parameters.sshAgent) environmentVariables.push({ name: 'SSH_AUTH_SOCK', value: '/ssh-agent' });
|
if (parameters.sshAgent) environmentVariables.push({ name: 'SSH_AUTH_SOCK', value: '/ssh-agent' });
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
import fs from '../../../node_modules/fs';
|
import { fsSync as fs, path, YAML, __dirname } from '../../dependencies.ts';
|
||||||
import * as path from 'https://deno.land/std@0.141.0/path/mod.ts';
|
|
||||||
import YAML from '../../../node_modules/yaml';
|
|
||||||
|
|
||||||
export class ActionYamlReader {
|
export class ActionYamlReader {
|
||||||
private actionYamlParsed: any;
|
private actionYamlParsed: any;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// import { assert } from '../../../node_modules/console';
|
import { assert } from 'https://deno.land/std@0.142.0/testing/asserts.ts';
|
||||||
// import fs from '../../../node_modules/fs';
|
import { fs } from '../../dependencies.ts';
|
||||||
import { CloudRunnerSystem } from '../cloud-runner/services/cloud-runner-system.ts';
|
import { CloudRunnerSystem } from '../cloud-runner/services/cloud-runner-system.ts';
|
||||||
import CloudRunnerLogger from '../cloud-runner/services/cloud-runner-logger.ts';
|
import CloudRunnerLogger from '../cloud-runner/services/cloud-runner-logger.ts';
|
||||||
import Input from '../input.ts';
|
import Input from '../input.ts';
|
||||||
|
|
@ -10,10 +10,10 @@ export class GitRepoReader {
|
||||||
if (Input.cloudRunnerCluster === 'local') {
|
if (Input.cloudRunnerCluster === 'local') {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
// assert(fs.existsSync(`.git`));
|
assert(fs.existsSync(`.git`));
|
||||||
const value = (await CloudRunnerSystem.Run(`git remote -v`, false, true)).replace(/ /g, ``);
|
const value = (await CloudRunnerSystem.Run(`git remote -v`, false, true)).replace(/ /g, ``);
|
||||||
CloudRunnerLogger.log(`value ${value}`);
|
CloudRunnerLogger.log(`value ${value}`);
|
||||||
// assert(value.includes('github.com'));
|
assert(value.includes('github.com'));
|
||||||
|
|
||||||
return value.split('github.com/')[1].split('.git')[0];
|
return value.split('github.com/')[1].split('.git')[0];
|
||||||
}
|
}
|
||||||
|
|
@ -22,7 +22,7 @@ export class GitRepoReader {
|
||||||
if (Input.cloudRunnerCluster === 'local') {
|
if (Input.cloudRunnerCluster === 'local') {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
// assert(fs.existsSync(`.git`));
|
assert(fs.existsSync(`.git`));
|
||||||
|
|
||||||
return (await CloudRunnerSystem.Run(`git branch --show-current`, false, true))
|
return (await CloudRunnerSystem.Run(`git branch --show-current`, false, true))
|
||||||
.split('\n')[0]
|
.split('\n')[0]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
import * as path from 'https://deno.land/std@0.141.0/path/mod.ts';
|
import { fsSync as fs, path, YAML, __dirname } from '../../dependencies.ts';
|
||||||
import fs from '../../../node_modules/fs';
|
|
||||||
import YAML from '../../../node_modules/yaml';
|
|
||||||
import Input from '../input.ts';
|
import Input from '../input.ts';
|
||||||
|
|
||||||
export function ReadLicense() {
|
export function ReadLicense() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import fs from '../../../node_modules/fs';
|
import { fs, path } from '../dependencies.ts';
|
||||||
import * as path from 'https://deno.land/std@0.141.0/path/mod.ts';
|
|
||||||
import { Cli } from './cli/cli.ts';
|
import { Cli } from './cli/cli.ts';
|
||||||
import CloudRunnerQueryOverride from './cloud-runner/services/cloud-runner-query-override.ts';
|
import CloudRunnerQueryOverride from './cloud-runner/services/cloud-runner-query-override.ts';
|
||||||
import Platform from './platform.ts';
|
import Platform from './platform.ts';
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
import { BuildParameters } from '../index.ts';
|
import { BuildParameters } from '../index.ts';
|
||||||
import { getUnityChangeset } from '../../../node_modules/unity-changeset';
|
import { fsSync as fs, exec, getUnityChangeset } from '../../dependencies.ts';
|
||||||
import { exec } from '../../../node_modules/@actions/exec';
|
|
||||||
import fs from '../../../node_modules/fs';
|
|
||||||
|
|
||||||
class SetupMac {
|
class SetupMac {
|
||||||
static unityHubPath = `"/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"`;
|
static unityHubPath = `"/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"`;
|
||||||
|
|
@ -49,26 +47,26 @@ class SetupMac {
|
||||||
private static async setEnvironmentVariables(buildParameters: BuildParameters, actionFolder: string) {
|
private static async setEnvironmentVariables(buildParameters: BuildParameters, actionFolder: string) {
|
||||||
// Need to set environment variables from here because we execute
|
// Need to set environment variables from here because we execute
|
||||||
// the scripts on the host for mac
|
// the scripts on the host for mac
|
||||||
process.env.ACTION_FOLDER = actionFolder;
|
Deno.env.set('ACTION_FOLDER', actionFolder);
|
||||||
process.env.UNITY_VERSION = buildParameters.editorVersion;
|
Deno.env.set('UNITY_VERSION', buildParameters.editorVersion);
|
||||||
process.env.UNITY_SERIAL = buildParameters.unitySerial;
|
Deno.env.set('UNITY_SERIAL', buildParameters.unitySerial);
|
||||||
process.env.PROJECT_PATH = buildParameters.projectPath;
|
Deno.env.set('PROJECT_PATH', buildParameters.projectPath);
|
||||||
process.env.BUILD_TARGET = buildParameters.targetPlatform;
|
Deno.env.set('BUILD_TARGET', buildParameters.targetPlatform);
|
||||||
process.env.BUILD_NAME = buildParameters.buildName;
|
Deno.env.set('BUILD_NAME', buildParameters.buildName);
|
||||||
process.env.BUILD_PATH = buildParameters.buildPath;
|
Deno.env.set('BUILD_PATH', buildParameters.buildPath);
|
||||||
process.env.BUILD_FILE = buildParameters.buildFile;
|
Deno.env.set('BUILD_FILE', buildParameters.buildFile);
|
||||||
process.env.BUILD_METHOD = buildParameters.buildMethod;
|
Deno.env.set('BUILD_METHOD', buildParameters.buildMethod);
|
||||||
process.env.VERSION = buildParameters.buildVersion;
|
Deno.env.set('VERSION', buildParameters.buildVersion);
|
||||||
process.env.ANDROID_VERSION_CODE = buildParameters.androidVersionCode;
|
Deno.env.set('ANDROID_VERSION_CODE', buildParameters.androidVersionCode);
|
||||||
process.env.ANDROID_KEYSTORE_NAME = buildParameters.androidKeystoreName;
|
Deno.env.set('ANDROID_KEYSTORE_NAME', buildParameters.androidKeystoreName);
|
||||||
process.env.ANDROID_KEYSTORE_BASE64 = buildParameters.androidKeystoreBase64;
|
Deno.env.set('ANDROID_KEYSTORE_BASE64', buildParameters.androidKeystoreBase64);
|
||||||
process.env.ANDROID_KEYSTORE_PASS = buildParameters.androidKeystorePass;
|
Deno.env.set('ANDROID_KEYSTORE_PASS', buildParameters.androidKeystorePass);
|
||||||
process.env.ANDROID_KEYALIAS_NAME = buildParameters.androidKeyaliasName;
|
Deno.env.set('ANDROID_KEYALIAS_NAME', buildParameters.androidKeyaliasName);
|
||||||
process.env.ANDROID_KEYALIAS_PASS = buildParameters.androidKeyaliasPass;
|
Deno.env.set('ANDROID_KEYALIAS_PASS', buildParameters.androidKeyaliasPass);
|
||||||
process.env.ANDROID_TARGET_SDK_VERSION = buildParameters.androidTargetSdkVersion;
|
Deno.env.set('ANDROID_TARGET_SDK_VERSION', buildParameters.androidTargetSdkVersion);
|
||||||
process.env.ANDROID_SDK_MANAGER_PARAMETERS = buildParameters.androidSdkManagerParameters;
|
Deno.env.set('ANDROID_SDK_MANAGER_PARAMETERS', buildParameters.androidSdkManagerParameters);
|
||||||
process.env.CUSTOM_PARAMETERS = buildParameters.customParameters;
|
Deno.env.set('CUSTOM_PARAMETERS', buildParameters.customParameters);
|
||||||
process.env.CHOWN_FILES_TO = buildParameters.chownFilesTo;
|
Deno.env.set('CHOWN_FILES_TO', buildParameters.chownFilesTo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { exec } from '../../../node_modules/@actions/exec';
|
import { fsSync as fs, exec } from '../../dependencies.ts';
|
||||||
import fs from '../../../node_modules/fs';
|
import { BuildParameters } from '../index.ts';
|
||||||
import { BuildParameters } from '..';
|
|
||||||
|
|
||||||
class SetupWindows {
|
class SetupWindows {
|
||||||
public static async setup(buildParameters: BuildParameters) {
|
public static async setup(buildParameters: BuildParameters) {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import fs from '../../../node_modules/fs';
|
import { fsSync as fs } from '../../dependencies.ts';
|
||||||
import { BuildParameters } from '../index.ts';
|
import { BuildParameters } from '../index.ts';
|
||||||
|
|
||||||
class ValidateWindows {
|
class ValidateWindows {
|
||||||
public static validate(buildParameters: BuildParameters) {
|
public static validate(buildParameters: BuildParameters) {
|
||||||
ValidateWindows.validateWindowsPlatformRequirements(buildParameters.targetPlatform);
|
ValidateWindows.validateWindowsPlatformRequirements(buildParameters.targetPlatform);
|
||||||
if (!(process.env.UNITY_EMAIL && process.env.UNITY_PASSWORD)) {
|
if (!(Deno.env.get('UNITY_EMAIL') && Deno.env.get('UNITY_PASSWORD'))) {
|
||||||
throw new Error(`Unity email and password must be set for Windows based builds to
|
throw new Error(`Unity email and password must be set for Windows based builds to
|
||||||
authenticate the license. Make sure to set them inside UNITY_EMAIL
|
authenticate the license. Make sure to set them inside UNITY_EMAIL
|
||||||
and UNITY_PASSWORD in Github Secrets and pass them into the environment.`);
|
and UNITY_PASSWORD in Github Secrets and pass them into the environment.`);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ describe('System', () => {
|
||||||
* To ensure our integration with '@actions/exec' works as expected we run some specific tests in CI only
|
* To ensure our integration with '@actions/exec' works as expected we run some specific tests in CI only
|
||||||
*/
|
*/
|
||||||
describe('integration', () => {
|
describe('integration', () => {
|
||||||
if (!process.env.CI) {
|
if (!Deno.env.get('CI')) {
|
||||||
it("doesn't run locally", () => {
|
it("doesn't run locally", () => {
|
||||||
expect(true).toBe(true);
|
expect(true).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
import * as fs from '../../../node_modules/fs';
|
import { fs, path } from '../dependencies.ts';
|
||||||
import * as fs from 'https://deno.land/std@0.141.0/fs/mod.ts';
|
|
||||||
import * as path from 'https://deno.land/std@0.141.0/path/mod.ts';
|
|
||||||
|
|
||||||
export default class UnityVersioning {
|
export default class UnityVersioning {
|
||||||
static get versionPattern() {
|
static get versionPattern() {
|
||||||
|
|
|
||||||
|
|
@ -33,21 +33,21 @@ export default class Versioning {
|
||||||
* For pull requests we can reliably use GITHUB_HEAD_REF
|
* For pull requests we can reliably use GITHUB_HEAD_REF
|
||||||
*/
|
*/
|
||||||
static get headRef() {
|
static get headRef() {
|
||||||
return process.env.GITHUB_HEAD_REF;
|
return Deno.env.get('GITHUB_HEAD_REF');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For branches GITHUB_REF will have format `refs/heads/feature-branch-1`
|
* For branches GITHUB_REF will have format `refs/heads/feature-branch-1`
|
||||||
*/
|
*/
|
||||||
static get ref() {
|
static get ref() {
|
||||||
return process.env.GITHUB_REF;
|
return Deno.env.get('GITHUB_REF');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The commit SHA that triggered the workflow run.
|
* The commit SHA that triggered the workflow run.
|
||||||
*/
|
*/
|
||||||
static get sha() {
|
static get sha() {
|
||||||
return process.env.GITHUB_SHA;
|
return Deno.env.get('GITHUB_SHA');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1167,11 +1167,6 @@
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.60.tgz#35f3d6213daed95da7f0f73e75bcc6980e90597b"
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.60.tgz#35f3d6213daed95da7f0f73e75bcc6980e90597b"
|
||||||
integrity sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==
|
integrity sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==
|
||||||
|
|
||||||
"@types/node@^17.0.23":
|
|
||||||
version "17.0.23"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.23.tgz#3b41a6e643589ac6442bdbd7a4a3ded62f33f7da"
|
|
||||||
integrity sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==
|
|
||||||
|
|
||||||
"@types/normalize-package-data@^2.4.0":
|
"@types/normalize-package-data@^2.4.0":
|
||||||
version "2.4.0"
|
version "2.4.0"
|
||||||
resolved "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz"
|
resolved "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue