await creating build params

pull/310/head
Frostebite 2022-01-25 17:37:05 +00:00
parent 8c6e681cf7
commit ba6d307134
5 changed files with 21 additions and 37 deletions

3
dist/index.js vendored
View File

@ -671,7 +671,6 @@ class CloudRunnerSystem {
let output = ''; let output = '';
const child = child_process_1.exec(command, (error, stdout, stderr) => { const child = child_process_1.exec(command, (error, stdout, stderr) => {
if (error) { if (error) {
remote_client_logger_1.RemoteClientLogger.logCliError(`${error.message}`);
throw error; throw error;
} }
if (stderr) { if (stderr) {
@ -3813,7 +3812,7 @@ class Input {
} }
static gitPrivateToken() { static gitPrivateToken() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
return core.getInput('gitPrivateToken') || (yield github_cli_1.GithubCliReader.GetGitHubAuthToken()) || ''; return core.getInput('gitPrivateToken') || (yield Input.githubToken());
}); });
} }
static get chownFilesTo() { static get chownFilesTo() {

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -38,15 +38,13 @@ describe('BuildParameters', () => {
it('returns the android version code with provided input', async () => { it('returns the android version code with provided input', async () => {
const mockValue = '42'; const mockValue = '42';
jest.spyOn(Input, 'androidVersionCode', 'get').mockReturnValue(mockValue); jest.spyOn(Input, 'androidVersionCode', 'get').mockReturnValue(mockValue);
await expect(BuildParameters.create()).resolves.toEqual( expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ androidVersionCode: mockValue }));
expect.objectContaining({ androidVersionCode: mockValue }),
);
}); });
it('returns the android version code from version by default', async () => { it('returns the android version code from version by default', async () => {
const mockValue = ''; const mockValue = '';
jest.spyOn(Input, 'androidVersionCode', 'get').mockReturnValue(mockValue); jest.spyOn(Input, 'androidVersionCode', 'get').mockReturnValue(mockValue);
await expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ androidVersionCode: 1003037 })); expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ androidVersionCode: 1003037 }));
}); });
it('determines the android sdk manager parameters only once', async () => { it('determines the android sdk manager parameters only once', async () => {
@ -57,19 +55,19 @@ describe('BuildParameters', () => {
it('returns the platform', async () => { it('returns the platform', async () => {
const mockValue = 'somePlatform'; const mockValue = 'somePlatform';
jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(mockValue); jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(mockValue);
await expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ platform: mockValue })); expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ platform: mockValue }));
}); });
it('returns the project path', async () => { it('returns the project path', async () => {
const mockValue = 'path/to/project'; const mockValue = 'path/to/project';
jest.spyOn(Input, 'projectPath', 'get').mockReturnValue(mockValue); jest.spyOn(Input, 'projectPath', 'get').mockReturnValue(mockValue);
await expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ projectPath: mockValue })); expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ projectPath: mockValue }));
}); });
it('returns the build name', async () => { it('returns the build name', async () => {
const mockValue = 'someBuildName'; const mockValue = 'someBuildName';
jest.spyOn(Input, 'buildName', 'get').mockReturnValue(mockValue); jest.spyOn(Input, 'buildName', 'get').mockReturnValue(mockValue);
await expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ buildName: mockValue })); expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ buildName: mockValue }));
}); });
it('returns the build path', async () => { it('returns the build path', async () => {
@ -78,15 +76,13 @@ describe('BuildParameters', () => {
const expectedBuildPath = `${mockPath}/${mockPlatform}`; const expectedBuildPath = `${mockPath}/${mockPlatform}`;
jest.spyOn(Input, 'buildsPath', 'get').mockReturnValue(mockPath); jest.spyOn(Input, 'buildsPath', 'get').mockReturnValue(mockPath);
jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(mockPlatform); jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(mockPlatform);
await expect(BuildParameters.create()).resolves.toEqual( expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ buildPath: expectedBuildPath }));
expect.objectContaining({ buildPath: expectedBuildPath }),
);
}); });
it('returns the build file', async () => { it('returns the build file', async () => {
const mockValue = 'someBuildName'; const mockValue = 'someBuildName';
jest.spyOn(Input, 'buildName', 'get').mockReturnValue(mockValue); jest.spyOn(Input, 'buildName', 'get').mockReturnValue(mockValue);
await expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ buildFile: mockValue })); expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ buildFile: mockValue }));
}); });
test.each([Platform.types.StandaloneWindows, Platform.types.StandaloneWindows64])( test.each([Platform.types.StandaloneWindows, Platform.types.StandaloneWindows64])(
@ -94,7 +90,7 @@ describe('BuildParameters', () => {
async (targetPlatform) => { async (targetPlatform) => {
jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(targetPlatform); jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(targetPlatform);
jest.spyOn(Input, 'buildName', 'get').mockReturnValue(targetPlatform); jest.spyOn(Input, 'buildName', 'get').mockReturnValue(targetPlatform);
await expect(BuildParameters.create()).resolves.toEqual( expect(BuildParameters.create()).resolves.toEqual(
expect.objectContaining({ buildFile: `${targetPlatform}.exe` }), expect.objectContaining({ buildFile: `${targetPlatform}.exe` }),
); );
}, },
@ -104,7 +100,7 @@ describe('BuildParameters', () => {
jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(targetPlatform); jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(targetPlatform);
jest.spyOn(Input, 'buildName', 'get').mockReturnValue(targetPlatform); jest.spyOn(Input, 'buildName', 'get').mockReturnValue(targetPlatform);
jest.spyOn(Input, 'androidAppBundle', 'get').mockReturnValue(false); jest.spyOn(Input, 'androidAppBundle', 'get').mockReturnValue(false);
await expect(BuildParameters.create()).resolves.toEqual( expect(BuildParameters.create()).resolves.toEqual(
expect.objectContaining({ buildFile: `${targetPlatform}.apk` }), expect.objectContaining({ buildFile: `${targetPlatform}.apk` }),
); );
}); });
@ -113,7 +109,7 @@ describe('BuildParameters', () => {
jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(targetPlatform); jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(targetPlatform);
jest.spyOn(Input, 'buildName', 'get').mockReturnValue(targetPlatform); jest.spyOn(Input, 'buildName', 'get').mockReturnValue(targetPlatform);
jest.spyOn(Input, 'androidAppBundle', 'get').mockReturnValue(true); jest.spyOn(Input, 'androidAppBundle', 'get').mockReturnValue(true);
await expect(BuildParameters.create()).resolves.toEqual( expect(BuildParameters.create()).resolves.toEqual(
expect.objectContaining({ buildFile: `${targetPlatform}.aab` }), expect.objectContaining({ buildFile: `${targetPlatform}.aab` }),
); );
}); });
@ -121,53 +117,43 @@ describe('BuildParameters', () => {
it('returns the build method', async () => { it('returns the build method', async () => {
const mockValue = 'Namespace.ClassName.BuildMethod'; const mockValue = 'Namespace.ClassName.BuildMethod';
jest.spyOn(Input, 'buildMethod', 'get').mockReturnValue(mockValue); jest.spyOn(Input, 'buildMethod', 'get').mockReturnValue(mockValue);
await expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ buildMethod: mockValue })); expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ buildMethod: mockValue }));
}); });
it('returns the android keystore name', async () => { it('returns the android keystore name', async () => {
const mockValue = 'keystore.keystore'; const mockValue = 'keystore.keystore';
jest.spyOn(Input, 'androidKeystoreName', 'get').mockReturnValue(mockValue); jest.spyOn(Input, 'androidKeystoreName', 'get').mockReturnValue(mockValue);
await expect(BuildParameters.create()).resolves.toEqual( expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ androidKeystoreName: mockValue }));
expect.objectContaining({ androidKeystoreName: mockValue }),
);
}); });
it('returns the android keystore base64-encoded content', async () => { it('returns the android keystore base64-encoded content', async () => {
const mockValue = 'secret'; const mockValue = 'secret';
jest.spyOn(Input, 'androidKeystoreBase64', 'get').mockReturnValue(mockValue); jest.spyOn(Input, 'androidKeystoreBase64', 'get').mockReturnValue(mockValue);
await expect(BuildParameters.create()).resolves.toEqual( expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ androidKeystoreBase64: mockValue }));
expect.objectContaining({ androidKeystoreBase64: mockValue }),
);
}); });
it('returns the android keystore pass', async () => { it('returns the android keystore pass', async () => {
const mockValue = 'secret'; const mockValue = 'secret';
jest.spyOn(Input, 'androidKeystorePass', 'get').mockReturnValue(mockValue); jest.spyOn(Input, 'androidKeystorePass', 'get').mockReturnValue(mockValue);
await expect(BuildParameters.create()).resolves.toEqual( expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ androidKeystorePass: mockValue }));
expect.objectContaining({ androidKeystorePass: mockValue }),
);
}); });
it('returns the android keyalias name', async () => { it('returns the android keyalias name', async () => {
const mockValue = 'secret'; const mockValue = 'secret';
jest.spyOn(Input, 'androidKeyaliasName', 'get').mockReturnValue(mockValue); jest.spyOn(Input, 'androidKeyaliasName', 'get').mockReturnValue(mockValue);
await expect(BuildParameters.create()).resolves.toEqual( expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ androidKeyaliasName: mockValue }));
expect.objectContaining({ androidKeyaliasName: mockValue }),
);
}); });
it('returns the android keyalias pass', async () => { it('returns the android keyalias pass', async () => {
const mockValue = 'secret'; const mockValue = 'secret';
jest.spyOn(Input, 'androidKeyaliasPass', 'get').mockReturnValue(mockValue); jest.spyOn(Input, 'androidKeyaliasPass', 'get').mockReturnValue(mockValue);
await expect(BuildParameters.create()).resolves.toEqual( expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ androidKeyaliasPass: mockValue }));
expect.objectContaining({ androidKeyaliasPass: mockValue }),
);
}); });
it('returns the android target sdk version', async () => { it('returns the android target sdk version', async () => {
const mockValue = 'AndroidApiLevelAuto'; const mockValue = 'AndroidApiLevelAuto';
jest.spyOn(Input, 'androidTargetSdkVersion', 'get').mockReturnValue(mockValue); jest.spyOn(Input, 'androidTargetSdkVersion', 'get').mockReturnValue(mockValue);
await expect(BuildParameters.create()).resolves.toEqual( expect(BuildParameters.create()).resolves.toEqual(
expect.objectContaining({ androidTargetSdkVersion: mockValue }), expect.objectContaining({ androidTargetSdkVersion: mockValue }),
); );
}); });
@ -175,7 +161,7 @@ describe('BuildParameters', () => {
it('returns the custom parameters', async () => { it('returns the custom parameters', async () => {
const mockValue = '-profile SomeProfile -someBoolean -someValue exampleValue'; const mockValue = '-profile SomeProfile -someBoolean -someValue exampleValue';
jest.spyOn(Input, 'customParameters', 'get').mockReturnValue(mockValue); jest.spyOn(Input, 'customParameters', 'get').mockReturnValue(mockValue);
await expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ customParameters: mockValue })); expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ customParameters: mockValue }));
}); });
}); });
}); });

View File

@ -10,7 +10,6 @@ export class CloudRunnerSystem {
let output = ''; let output = '';
const child = exec(command, (error, stdout, stderr) => { const child = exec(command, (error, stdout, stderr) => {
if (error) { if (error) {
RemoteClientLogger.logCliError(`${error.message}`);
throw error; throw error;
} }
if (stderr) { if (stderr) {

View File

@ -165,7 +165,7 @@ class Input {
} }
static async gitPrivateToken() { static async gitPrivateToken() {
return core.getInput('gitPrivateToken') || (await GithubCliReader.GetGitHubAuthToken()) || ''; return core.getInput('gitPrivateToken') || (await Input.githubToken());
} }
static get chownFilesTo() { static get chownFilesTo() {