зеркало из https://github.com/electron/electron.git
build: remove CircleCI from release pipeline (#42651)
* build: remove CircleCI from release pipeline * build: remove IS_GHA_RELEASE and CHECK_DIST_MANIFEST
This commit is contained in:
Родитель
3534923bd2
Коммит
a8baa6f1ad
|
@ -170,7 +170,6 @@ runs:
|
|||
run: |
|
||||
cd src/electron
|
||||
node script/yarn create-typescript-definitions
|
||||
# TODO(vertedinde): These uploads currently point to a different Azure bucket & GitHub Repo
|
||||
- name: Publish Electron Dist ${{ inputs.step-suffix }}
|
||||
if: ${{ inputs.is-release == 'true' }}
|
||||
shell: bash
|
||||
|
|
|
@ -62,9 +62,6 @@ env:
|
|||
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
||||
ELECTRON_GITHUB_TOKEN: ${{ secrets.ELECTRON_GITHUB_TOKEN }}
|
||||
GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' }}
|
||||
# Only disable this in the Asan build
|
||||
CHECK_DIST_MANIFEST: true
|
||||
IS_GHA_RELEASE: true
|
||||
ELECTRON_OUT_DIR: Default
|
||||
|
||||
jobs:
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
const { BlobServiceClient } = require('@azure/storage-blob');
|
||||
const path = require('node:path');
|
||||
|
||||
// TODO(vertedinde): This variable is a test variable in GHA, sending test
|
||||
// artifacts to a test account. Change to the real electron artifacts
|
||||
// storage account when ready.
|
||||
const { ELECTRON_ARTIFACTS_BLOB_STORAGE } = process.env;
|
||||
if (!ELECTRON_ARTIFACTS_BLOB_STORAGE) {
|
||||
console.error('Missing required ELECTRON_ARTIFACTS_BLOB_STORAGE environment variable.');
|
||||
|
|
|
@ -9,11 +9,9 @@ const octokit = new Octokit({
|
|||
});
|
||||
|
||||
const BUILD_APPVEYOR_URL = 'https://ci.appveyor.com/api/builds';
|
||||
const CIRCLECI_PIPELINE_URL = 'https://circleci.com/api/v2/project/gh/electron/electron/pipeline';
|
||||
const GH_ACTIONS_PIPELINE_URL = 'https://github.com/electron/electron/actions';
|
||||
const GH_ACTIONS_API_URL = '/repos/electron/electron/actions';
|
||||
|
||||
const CIRCLECI_WAIT_TIME = process.env.CIRCLECI_WAIT_TIME || 30000;
|
||||
const GH_ACTIONS_WAIT_TIME = process.env.GH_ACTIONS_WAIT_TIME || 30000;
|
||||
|
||||
const appVeyorJobs = {
|
||||
|
@ -22,16 +20,6 @@ const appVeyorJobs = {
|
|||
'electron-woa': 'electron-woa-release'
|
||||
};
|
||||
|
||||
const circleCIPublishWorkflows = [
|
||||
'linux-publish',
|
||||
'macos-publish'
|
||||
];
|
||||
|
||||
const circleCIPublishIndividualArches = {
|
||||
'macos-publish': ['osx-x64', 'mas-x64', 'osx-arm64', 'mas-arm64'],
|
||||
'linux-publish': ['arm', 'arm64', 'x64']
|
||||
};
|
||||
|
||||
const ghActionsPublishWorkflows = [
|
||||
'linux-publish',
|
||||
'macos-publish'
|
||||
|
@ -121,120 +109,6 @@ async function githubActionsCall (targetBranch, workflowName, options) {
|
|||
}
|
||||
}
|
||||
|
||||
async function circleCIcall (targetBranch, workflowName, options) {
|
||||
console.log(`Triggering CircleCI to run build job: ${workflowName} on branch: ${targetBranch} with release flag.`);
|
||||
const buildRequest = {
|
||||
branch: targetBranch,
|
||||
parameters: {}
|
||||
};
|
||||
if (options.ghRelease) {
|
||||
buildRequest.parameters['upload-to-storage'] = '0';
|
||||
} else {
|
||||
buildRequest.parameters['upload-to-storage'] = '1';
|
||||
}
|
||||
buildRequest.parameters[`run-${workflowName}`] = true;
|
||||
if (options.arch) {
|
||||
const validArches = circleCIPublishIndividualArches[workflowName];
|
||||
assert(validArches.includes(options.arch), `Unknown CircleCI architecture "${options.arch}". Valid values are ${JSON.stringify(validArches)}`);
|
||||
buildRequest.parameters['macos-publish-arch-limit'] = options.arch;
|
||||
}
|
||||
|
||||
jobRequestedCount++;
|
||||
// The logic below expects that the CircleCI workflows for releases each
|
||||
// contain only one job in order to maintain compatibility with sudowoodo.
|
||||
// If the workflows are changed in the CircleCI config.yml, this logic will
|
||||
// also need to be changed as well as possibly changing sudowoodo.
|
||||
try {
|
||||
const circleResponse = await circleCIRequest(CIRCLECI_PIPELINE_URL, 'POST', buildRequest);
|
||||
console.log(`CircleCI release build pipeline ${circleResponse.id} for ${workflowName} triggered.`);
|
||||
const workflowId = await getCircleCIWorkflowId(circleResponse.id);
|
||||
if (workflowId === -1) {
|
||||
return;
|
||||
}
|
||||
const workFlowUrl = `https://circleci.com/workflow-run/${workflowId}`;
|
||||
if (options.runningPublishWorkflows) {
|
||||
console.log(`CircleCI release workflow request for ${workflowName} successful. Check ${workFlowUrl} for status.`);
|
||||
} else {
|
||||
console.log(`CircleCI release build workflow running at https://circleci.com/workflow-run/${workflowId} for ${workflowName}.`);
|
||||
const jobNumber = await getCircleCIJobNumber(workflowId);
|
||||
if (jobNumber === -1) {
|
||||
return;
|
||||
}
|
||||
const jobUrl = `https://circleci.com/gh/electron/electron/${jobNumber}`;
|
||||
console.log(`CircleCI release build request for ${workflowName} successful. Check ${jobUrl} for status.`);
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('Error calling CircleCI: ', err);
|
||||
}
|
||||
}
|
||||
|
||||
async function getCircleCIWorkflowId (pipelineId) {
|
||||
const pipelineInfoUrl = `https://circleci.com/api/v2/pipeline/${pipelineId}`;
|
||||
let workflowId = 0;
|
||||
while (workflowId === 0) {
|
||||
const pipelineInfo = await circleCIRequest(pipelineInfoUrl, 'GET');
|
||||
switch (pipelineInfo.state) {
|
||||
case 'created': {
|
||||
const workflows = await circleCIRequest(`${pipelineInfoUrl}/workflow`, 'GET');
|
||||
// The logic below expects three workflow.items: publish, lint, & setup
|
||||
if (workflows.items.length === 3) {
|
||||
workflowId = workflows.items.find(item => item.name.includes('publish')).id;
|
||||
break;
|
||||
}
|
||||
console.log('Unexpected number of workflows, response was:', workflows);
|
||||
workflowId = -1;
|
||||
break;
|
||||
}
|
||||
case 'error': {
|
||||
console.log('Error retrieving workflows, response was:', pipelineInfo);
|
||||
workflowId = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
await new Promise(resolve => setTimeout(resolve, CIRCLECI_WAIT_TIME));
|
||||
}
|
||||
return workflowId;
|
||||
}
|
||||
|
||||
async function getCircleCIJobNumber (workflowId) {
|
||||
const jobInfoUrl = `https://circleci.com/api/v2/workflow/${workflowId}/job`;
|
||||
let jobNumber = 0;
|
||||
while (jobNumber === 0) {
|
||||
const jobInfo = await circleCIRequest(jobInfoUrl, 'GET');
|
||||
if (!jobInfo.items) {
|
||||
continue;
|
||||
}
|
||||
if (jobInfo.items.length !== 1) {
|
||||
console.log('Unexpected number of jobs, response was:', jobInfo);
|
||||
jobNumber = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (jobInfo.items[0].status) {
|
||||
case 'not_running':
|
||||
case 'queued':
|
||||
case 'running': {
|
||||
if (jobInfo.items[0].job_number && !isNaN(jobInfo.items[0].job_number)) {
|
||||
jobNumber = jobInfo.items[0].job_number;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'canceled':
|
||||
case 'error':
|
||||
case 'infrastructure_fail':
|
||||
case 'timedout':
|
||||
case 'not_run':
|
||||
case 'failed': {
|
||||
console.log(`Error job returned a status of ${jobInfo.items[0].status}, response was:`, jobInfo);
|
||||
jobNumber = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
await new Promise(resolve => setTimeout(resolve, CIRCLECI_WAIT_TIME));
|
||||
}
|
||||
return jobNumber;
|
||||
}
|
||||
|
||||
async function getGitHubActionsRun (workflowId, headCommit) {
|
||||
let runNumber = 0;
|
||||
let actionRun;
|
||||
|
@ -288,33 +162,6 @@ async function getGitHubActionsRun (workflowId, headCommit) {
|
|||
return runNumber;
|
||||
}
|
||||
|
||||
async function circleCIRequest (url, method, requestBody) {
|
||||
const requestOpts = {
|
||||
username: process.env.CIRCLE_TOKEN,
|
||||
password: '',
|
||||
method,
|
||||
url,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json'
|
||||
}
|
||||
};
|
||||
if (requestBody) {
|
||||
requestOpts.body = JSON.stringify(requestBody);
|
||||
}
|
||||
|
||||
return makeRequest(requestOpts, true).catch(err => {
|
||||
if (err.response?.body) {
|
||||
console.error('Could not call CircleCI: ', {
|
||||
statusCode: err.response.statusCode,
|
||||
body: JSON.parse(err.response.body)
|
||||
});
|
||||
} else {
|
||||
console.error('Error calling CircleCI:', err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function callAppVeyor (targetBranch, job, options) {
|
||||
console.log(`Triggering AppVeyor to run build job: ${job} on branch: ${targetBranch} with release flag.`);
|
||||
const environmentVariables = {
|
||||
|
@ -373,19 +220,6 @@ function buildAppVeyor (targetBranch, options) {
|
|||
}
|
||||
}
|
||||
|
||||
function buildCircleCI (targetBranch, options) {
|
||||
if (options.job) {
|
||||
assert(circleCIPublishWorkflows.includes(options.job), `Unknown CircleCI workflow name: ${options.job}. Valid values are: ${circleCIPublishWorkflows}.`);
|
||||
circleCIcall(targetBranch, options.job, options);
|
||||
} else {
|
||||
assert(!options.arch, 'Cannot provide a single architecture while building all workflows, please specify a single workflow via --workflow');
|
||||
options.runningPublishWorkflows = true;
|
||||
for (const job of circleCIPublishWorkflows) {
|
||||
circleCIcall(targetBranch, job, options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function buildGHActions (targetBranch, options) {
|
||||
if (options.job) {
|
||||
assert(ghActionsPublishWorkflows.includes(options.job), `Unknown GitHub Actions workflow name: ${options.job}. Valid values are: ${ghActionsPublishWorkflows}.`);
|
||||
|
@ -402,10 +236,6 @@ function buildGHActions (targetBranch, options) {
|
|||
function runRelease (targetBranch, options) {
|
||||
if (options.ci) {
|
||||
switch (options.ci) {
|
||||
case 'CircleCI': {
|
||||
buildCircleCI(targetBranch, options);
|
||||
break;
|
||||
}
|
||||
case 'GitHubActions': {
|
||||
buildGHActions(targetBranch, options);
|
||||
break;
|
||||
|
@ -420,7 +250,6 @@ function runRelease (targetBranch, options) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
buildCircleCI(targetBranch, options);
|
||||
buildAppVeyor(targetBranch, options);
|
||||
buildGHActions(targetBranch, options);
|
||||
}
|
||||
|
@ -436,8 +265,8 @@ if (require.main === module) {
|
|||
const targetBranch = args._[0];
|
||||
if (args._.length < 1) {
|
||||
console.log(`Trigger CI to build release builds of electron.
|
||||
Usage: ci-release-build.js [--job=CI_JOB_NAME] [--arch=INDIVIDUAL_ARCH] [--ci=CircleCI|AppVeyor|GitHubActions]
|
||||
[--ghRelease] [--circleBuildNum=xxx] [--appveyorJobId=xxx] [--commit=sha] TARGET_BRANCH
|
||||
Usage: ci-release-build.js [--job=CI_JOB_NAME] [--arch=INDIVIDUAL_ARCH] [--ci=AppVeyor|GitHubActions]
|
||||
[--ghRelease] [--appveyorJobId=xxx] [--commit=sha] TARGET_BRANCH
|
||||
`);
|
||||
process.exit(0);
|
||||
}
|
||||
|
|
|
@ -14,8 +14,7 @@ const version = process.argv[2];
|
|||
const targetRepo = findRepo();
|
||||
|
||||
function findRepo () {
|
||||
if (process.env.IS_GHA_RELEASE) return 'test-releases';
|
||||
else return version.indexOf('nightly') > 0 ? 'nightlies' : 'electron';
|
||||
return version.indexOf('nightly') > 0 ? 'nightlies' : 'electron';
|
||||
}
|
||||
|
||||
async function findRelease () {
|
||||
|
|
|
@ -127,23 +127,7 @@ async function createRelease (branchToTarget, isBeta) {
|
|||
process.exit(1);
|
||||
});
|
||||
|
||||
const ghaTestRelease = await octokit.repos.createRelease({
|
||||
owner: 'electron',
|
||||
repo: 'test-releases',
|
||||
tag_name: newVersion,
|
||||
draft: true,
|
||||
name: `electron ${newVersion}`,
|
||||
body: releaseBody,
|
||||
prerelease: releaseIsPrelease,
|
||||
target_commitish: newVersion.includes('nightly') ? 'main' : branchToTarget
|
||||
}).catch(err => {
|
||||
console.log(`${fail} Error creating new GHA test release: `, err);
|
||||
});
|
||||
|
||||
console.log(`Release has been created with id: ${release.data.id}.`);
|
||||
if (ghaTestRelease && ghaTestRelease.data) {
|
||||
console.log(`Test Release has been created with id: ${ghaTestRelease.data.id}.`);
|
||||
}
|
||||
console.log(`${pass} Draft release for ${newVersion} successful.`);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@ const isNightlyElectronVersion = currentElectronVersion.includes('nightly');
|
|||
const targetRepo = getRepo();
|
||||
|
||||
function getRepo () {
|
||||
if (process.env.IS_GHA_RELEASE) return 'test-releases';
|
||||
return isNightlyElectronVersion ? 'nightlies' : 'electron';
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ const octokit = new Octokit({
|
|||
});
|
||||
|
||||
function getRepo () {
|
||||
if (process.env.IS_GHA_RELEASE) return 'test-releases';
|
||||
return pkgVersion.indexOf('nightly') > 0 ? 'nightlies' : 'electron';
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ const getHeaders = (filePath: string, fileName: string) => {
|
|||
};
|
||||
|
||||
function getRepo () {
|
||||
if (process.env.IS_GHA_RELEASE) return 'test-releases';
|
||||
return releaseVersion.indexOf('nightly') > 0 ? 'nightlies' : 'electron';
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче