mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04:00
Compare commits
5 Commits
1815c3c880
...
92eaa73a2d
Author | SHA1 | Date | |
---|---|---|---|
![]() |
92eaa73a2d | ||
![]() |
b662a6fa0e | ||
![]() |
9ed94b241f | ||
![]() |
36503e30c0 | ||
![]() |
01bbef7a89 |
@ -77,5 +77,13 @@
|
|||||||
"unicorn/prefer-spread": "off",
|
"unicorn/prefer-spread": "off",
|
||||||
// Temp disable to prevent mixing changes with other PRs
|
// Temp disable to prevent mixing changes with other PRs
|
||||||
"i18n-text/no-en": "off"
|
"i18n-text/no-en": "off"
|
||||||
}
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": ["jest.setup.js"],
|
||||||
|
"rules": {
|
||||||
|
"import/no-commonjs": "off"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ jobs:
|
|||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
GIT_PRIVATE_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
GIT_PRIVATE_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
||||||
k8sTests:
|
k8sTests:
|
||||||
name: K8s Tests
|
name: K8s Tests
|
||||||
if: github.event.event_type != 'pull_request_target'
|
if: github.event.event_type != 'pull_request_target'
|
||||||
@ -162,7 +162,7 @@ jobs:
|
|||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
GIT_PRIVATE_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
GIT_PRIVATE_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
||||||
|
|
||||||
buildTargetTests:
|
buildTargetTests:
|
||||||
name: Local Build Target Tests
|
name: Local Build Target Tests
|
||||||
@ -198,7 +198,7 @@ jobs:
|
|||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
GIT_PRIVATE_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
GIT_PRIVATE_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
||||||
with:
|
with:
|
||||||
cloudRunnerTests: true
|
cloudRunnerTests: true
|
||||||
versioning: None
|
versioning: None
|
||||||
|
BIN
dist/index.js
generated
vendored
BIN
dist/index.js
generated
vendored
Binary file not shown.
BIN
dist/index.js.map
generated
vendored
BIN
dist/index.js.map
generated
vendored
Binary file not shown.
@ -25,6 +25,6 @@ module.exports = {
|
|||||||
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
||||||
modulePathIgnorePatterns: ['<rootDir>/lib/', '<rootDir>/dist/'],
|
modulePathIgnorePatterns: ['<rootDir>/lib/', '<rootDir>/dist/'],
|
||||||
|
|
||||||
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
// Use jest.setup.js to polyfill fetch for all tests
|
||||||
setupFilesAfterEnv: ['<rootDir>/src/jest.setup.ts'],
|
setupFiles: ['<rootDir>/jest.setup.js'],
|
||||||
};
|
};
|
||||||
|
2
jest.setup.js
Normal file
2
jest.setup.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
const fetch = require('node-fetch');
|
||||||
|
global.fetch = fetch;
|
@ -74,6 +74,7 @@
|
|||||||
"jest-fail-on-console": "^3.0.2",
|
"jest-fail-on-console": "^3.0.2",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"lefthook": "^1.6.1",
|
"lefthook": "^1.6.1",
|
||||||
|
"node-fetch": "2",
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"ts-jest": "^27.1.3",
|
"ts-jest": "^27.1.3",
|
||||||
"ts-node": "10.8.1",
|
"ts-node": "10.8.1",
|
||||||
@ -84,4 +85,4 @@
|
|||||||
"node": "20.5.1",
|
"node": "20.5.1",
|
||||||
"yarn": "1.22.19"
|
"yarn": "1.22.19"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,20 +232,14 @@ export class RemoteClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clear any existing URL configurations
|
// Clear any existing URL configurations
|
||||||
await CloudRunnerSystem.Run(`git config --global --unset-all url."https://github.com/".insteadOf`);
|
await CloudRunnerSystem.Run(`git config --global --unset-all url."https://github.com/".insteadOf || true`);
|
||||||
await CloudRunnerSystem.Run(`git config --global --unset-all url."ssh://git@github.com/".insteadOf`);
|
await CloudRunnerSystem.Run(`git config --global --unset-all url."ssh://git@github.com/".insteadOf || true`);
|
||||||
await CloudRunnerSystem.Run(`git config --global --unset-all url."git@github.com".insteadOf`);
|
await CloudRunnerSystem.Run(`git config --global --unset-all url."git@github.com".insteadOf || true`);
|
||||||
|
|
||||||
// Set new URL configuration with token
|
// Set new URL configuration with token for HTTPS
|
||||||
await CloudRunnerSystem.Run(
|
await CloudRunnerSystem.Run(
|
||||||
`git config --global url."https://${gitPrivateToken}@github.com/".insteadOf "https://github.com/"`,
|
`git config --global url."https://${gitPrivateToken}@github.com/".insteadOf "https://github.com/"`,
|
||||||
);
|
);
|
||||||
await CloudRunnerSystem.Run(
|
|
||||||
`git config --global url."https://${gitPrivateToken}@github.com/".insteadOf "ssh://git@github.com/"`,
|
|
||||||
);
|
|
||||||
await CloudRunnerSystem.Run(
|
|
||||||
`git config --global url."https://${gitPrivateToken}@github.com/".insteadOf "git@github.com"`,
|
|
||||||
);
|
|
||||||
|
|
||||||
await CloudRunnerSystem.Run(`git lfs pull`);
|
await CloudRunnerSystem.Run(`git lfs pull`);
|
||||||
RemoteClientLogger.log(`Successfully pulled LFS files with GIT_PRIVATE_TOKEN`);
|
RemoteClientLogger.log(`Successfully pulled LFS files with GIT_PRIVATE_TOKEN`);
|
||||||
@ -262,20 +256,14 @@ export class RemoteClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clear any existing URL configurations
|
// Clear any existing URL configurations
|
||||||
await CloudRunnerSystem.Run(`git config --global --unset-all url."https://github.com/".insteadOf`);
|
await CloudRunnerSystem.Run(`git config --global --unset-all url."https://github.com/".insteadOf || true`);
|
||||||
await CloudRunnerSystem.Run(`git config --global --unset-all url."ssh://git@github.com/".insteadOf`);
|
await CloudRunnerSystem.Run(`git config --global --unset-all url."ssh://git@github.com/".insteadOf || true`);
|
||||||
await CloudRunnerSystem.Run(`git config --global --unset-all url."git@github.com".insteadOf`);
|
await CloudRunnerSystem.Run(`git config --global --unset-all url."git@github.com".insteadOf || true`);
|
||||||
|
|
||||||
// Set new URL configuration with token
|
// Set new URL configuration with token for HTTPS
|
||||||
await CloudRunnerSystem.Run(
|
await CloudRunnerSystem.Run(
|
||||||
`git config --global url."https://${githubToken}@github.com/".insteadOf "https://github.com/"`,
|
`git config --global url."https://${githubToken}@github.com/".insteadOf "https://github.com/"`,
|
||||||
);
|
);
|
||||||
await CloudRunnerSystem.Run(
|
|
||||||
`git config --global url."https://${githubToken}@github.com/".insteadOf "ssh://git@github.com/"`,
|
|
||||||
);
|
|
||||||
await CloudRunnerSystem.Run(
|
|
||||||
`git config --global url."https://${githubToken}@github.com/".insteadOf "git@github.com"`,
|
|
||||||
);
|
|
||||||
|
|
||||||
await CloudRunnerSystem.Run(`git lfs pull`);
|
await CloudRunnerSystem.Run(`git lfs pull`);
|
||||||
RemoteClientLogger.log(`Successfully pulled LFS files with GITHUB_TOKEN fallback`);
|
RemoteClientLogger.log(`Successfully pulled LFS files with GITHUB_TOKEN fallback`);
|
||||||
|
@ -3,6 +3,7 @@ import CloudRunner from './cloud-runner/cloud-runner';
|
|||||||
import CloudRunnerOptions from './cloud-runner/options/cloud-runner-options';
|
import CloudRunnerOptions from './cloud-runner/options/cloud-runner-options';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import { Octokit } from '@octokit/core';
|
import { Octokit } from '@octokit/core';
|
||||||
|
import fetch from 'node-fetch';
|
||||||
|
|
||||||
class GitHub {
|
class GitHub {
|
||||||
private static readonly asyncChecksApiWorkflowName = `Async Checks API`;
|
private static readonly asyncChecksApiWorkflowName = `Async Checks API`;
|
||||||
@ -15,11 +16,13 @@ class GitHub {
|
|||||||
private static get octokitDefaultToken() {
|
private static get octokitDefaultToken() {
|
||||||
return new Octokit({
|
return new Octokit({
|
||||||
auth: process.env.GITHUB_TOKEN,
|
auth: process.env.GITHUB_TOKEN,
|
||||||
|
request: { fetch },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
private static get octokitPAT() {
|
private static get octokitPAT() {
|
||||||
return new Octokit({
|
return new Octokit({
|
||||||
auth: CloudRunner.buildParameters.gitPrivateToken,
|
auth: CloudRunner.buildParameters.gitPrivateToken,
|
||||||
|
request: { fetch },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
private static get sha() {
|
private static get sha() {
|
||||||
@ -163,11 +166,10 @@ class GitHub {
|
|||||||
core.info(JSON.stringify(workflows));
|
core.info(JSON.stringify(workflows));
|
||||||
throw new Error(`no workflow with name "${GitHub.asyncChecksApiWorkflowName}"`);
|
throw new Error(`no workflow with name "${GitHub.asyncChecksApiWorkflowName}"`);
|
||||||
}
|
}
|
||||||
await GitHub.octokitPAT.request(`POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches`, {
|
await GitHub.octokitPAT.request(`POST /repos/{owner}/{repo}/actions/workflows/{workflowId}/dispatches`, {
|
||||||
owner: GitHub.owner,
|
owner: GitHub.owner,
|
||||||
repo: GitHub.repo,
|
repo: GitHub.repo,
|
||||||
// eslint-disable-next-line camelcase
|
workflowId: selectedId,
|
||||||
workflow_id: selectedId,
|
|
||||||
ref: CloudRunnerOptions.branch,
|
ref: CloudRunnerOptions.branch,
|
||||||
inputs: {
|
inputs: {
|
||||||
checksObject: JSON.stringify({ data, mode }),
|
checksObject: JSON.stringify({ data, mode }),
|
||||||
@ -198,11 +200,10 @@ class GitHub {
|
|||||||
core.info(JSON.stringify(workflows));
|
core.info(JSON.stringify(workflows));
|
||||||
throw new Error(`no workflow with name "${GitHub.asyncChecksApiWorkflowName}"`);
|
throw new Error(`no workflow with name "${GitHub.asyncChecksApiWorkflowName}"`);
|
||||||
}
|
}
|
||||||
await GitHub.octokitPAT.request(`POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches`, {
|
await GitHub.octokitPAT.request(`POST /repos/{owner}/{repo}/actions/workflows/{workflowId}/dispatches`, {
|
||||||
owner: GitHub.owner,
|
owner: GitHub.owner,
|
||||||
repo: GitHub.repo,
|
repo: GitHub.repo,
|
||||||
// eslint-disable-next-line camelcase
|
workflowId: selectedId,
|
||||||
workflow_id: selectedId,
|
|
||||||
ref: CloudRunnerOptions.branch,
|
ref: CloudRunnerOptions.branch,
|
||||||
inputs: {
|
inputs: {
|
||||||
buildGuid: CloudRunner.buildParameters.buildGuid,
|
buildGuid: CloudRunner.buildParameters.buildGuid,
|
||||||
@ -213,10 +214,6 @@ class GitHub {
|
|||||||
core.info(`github workflow complete hook not found`);
|
core.info(`github workflow complete hook not found`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async getCheckStatus() {
|
|
||||||
return await GitHub.octokitDefaultToken.request(`GET /repos/{owner}/{repo}/check-runs/{check_run_id}`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default GitHub;
|
export default GitHub;
|
||||||
|
@ -6242,6 +6242,13 @@ no-case@^3.0.4:
|
|||||||
lower-case "^2.0.2"
|
lower-case "^2.0.2"
|
||||||
tslib "^2.0.3"
|
tslib "^2.0.3"
|
||||||
|
|
||||||
|
node-fetch@2:
|
||||||
|
version "2.7.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
|
||||||
|
integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==
|
||||||
|
dependencies:
|
||||||
|
whatwg-url "^5.0.0"
|
||||||
|
|
||||||
node-fetch@^2.6.7:
|
node-fetch@^2.6.7:
|
||||||
version "2.6.12"
|
version "2.6.12"
|
||||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.12.tgz#02eb8e22074018e3d5a83016649d04df0e348fba"
|
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.12.tgz#02eb8e22074018e3d5a83016649d04df0e348fba"
|
||||||
|
Loading…
Reference in New Issue
Block a user