Browse Source

build: move macos release builds to CircleCI (3-1-x) (#17338)

trop[bot] 6 years ago
parent
commit
c3d8107ca6
3 changed files with 8 additions and 129 deletions
  1. 4 0
      .circleci/config.yml
  2. 4 78
      script/ci-release-build.js
  3. 0 51
      vsts.yml

+ 4 - 0
.circleci/config.yml

@@ -263,6 +263,7 @@ jobs:
       TARGET_ARCH: x64
       RUN_TESTS: true
       INSTALL_MACOS_NODE: true
+    resource_class: large
     macos:
       xcode: "8.3.3"
     <<: *build-steps
@@ -272,6 +273,7 @@ jobs:
       TARGET_ARCH: x64
       RUN_RELEASE_BUILD: true
       INSTALL_MACOS_NODE: true
+    resource_class: large
     macos:
       xcode: "8.3.3"
     <<: *build-steps
@@ -282,6 +284,7 @@ jobs:
       MAS_BUILD: 1
       RUN_TESTS: true
       INSTALL_MACOS_NODE: true
+    resource_class: large
     macos:
       xcode: "8.3.3"
     <<: *build-steps
@@ -292,6 +295,7 @@ jobs:
       MAS_BUILD: 1
       RUN_RELEASE_BUILD: true
       INSTALL_MACOS_NODE: true
+    resource_class: large
     macos:
       xcode: "8.3.3"
     <<: *build-steps

+ 4 - 78
script/ci-release-build.js

@@ -3,7 +3,6 @@ require('dotenv-safe').load()
 const assert = require('assert')
 const request = require('request')
 const buildAppVeyorURL = 'https://windows-ci.electronjs.org/api/builds'
-const vstsURL = 'https://github.visualstudio.com/electron/_apis/build'
 
 const appVeyorJobs = {
   'electron-x64': 'electron',
@@ -14,13 +13,9 @@ const circleCIJobs = [
   'electron-linux-arm',
   'electron-linux-arm64',
   'electron-linux-ia32',
-//  'electron-linux-mips64el',
-  'electron-linux-x64'
-]
-
-const vstsJobs = [
-  'electron-release-mas-x64',
-  'electron-release-osx-x64'
+  'electron-linux-x64',
+  'electron-osx-x64',
+  'electron-mas-x64'
 ]
 
 async function makeRequest (requestOptions, parseResponse) {
@@ -139,70 +134,6 @@ function buildCircleCI (targetBranch, options) {
   }
 }
 
-async function buildVSTS (targetBranch, options) {
-  if (options.job) {
-    assert(vstsJobs.includes(options.job), `Unknown VSTS CI job name: ${options.job}. Valid values are: ${vstsJobs}.`)
-  }
-  console.log(`Triggering VSTS to run build on branch: ${targetBranch} with release flag.`)
-  let environmentVariables = {}
-
-  if (!options.ghRelease) {
-    environmentVariables.UPLOAD_TO_S3 = 1
-  }
-
-  if (options.automaticRelease) {
-    environmentVariables.AUTO_RELEASE = 'true'
-  }
-
-  let requestOpts = {
-    url: `${vstsURL}/definitions?api-version=4.1`,
-    auth: {
-      user: '',
-      password: process.env.VSTS_TOKEN
-    },
-    headers: {
-      'Content-Type': 'application/json'
-    }
-  }
-  let vstsResponse = await makeRequest(requestOpts, true).catch(err => {
-    console.log('Error calling VSTS to get build definitions:', err)
-  })
-  let buildsToRun = []
-  if (options.job) {
-    buildsToRun = vstsResponse.value.filter(build => build.name === options.job)
-  } else {
-    buildsToRun = vstsResponse.value.filter(build => vstsJobs.includes(build.name))
-  }
-  buildsToRun.forEach((build) => callVSTSBuild(build, targetBranch, environmentVariables))
-}
-
-async function callVSTSBuild (build, targetBranch, environmentVariables) {
-  let buildBody = {
-    definition: build,
-    sourceBranch: targetBranch,
-    priority: 'high'
-  }
-  if (Object.keys(environmentVariables).length !== 0) {
-    buildBody.parameters = JSON.stringify(environmentVariables)
-  }
-  let requestOpts = {
-    url: `${vstsURL}/builds?api-version=4.1`,
-    auth: {
-      user: '',
-      password: process.env.VSTS_TOKEN
-    },
-    headers: {
-      'Content-Type': 'application/json'
-    },
-    body: JSON.stringify(buildBody),
-    method: 'POST'
-  }
-  let vstsResponse = await makeRequest(requestOpts, true).catch(err => {
-    console.log(`Error calling VSTS for job ${build.name}`, err)
-  })
-  console.log(`VSTS release build request for ${build.name} successful. Check ${vstsResponse._links.web.href} for status.`)
-}
-
 function runRelease (targetBranch, options) {
   if (options.ci) {
     switch (options.ci) {
@@ -214,10 +145,6 @@ function runRelease (targetBranch, options) {
         buildAppVeyor(targetBranch, options)
         break
       }
-      case 'VSTS': {
-        buildVSTS(targetBranch, options)
-        break
-      }
       default: {
         console.log(`Error! Unknown CI: ${options.ci}.`)
         process.exit(1)
@@ -226,7 +153,6 @@ function runRelease (targetBranch, options) {
   } else {
     buildCircleCI(targetBranch, options)
     buildAppVeyor(targetBranch, options)
-    buildVSTS(targetBranch, options)
   }
 }
 
@@ -239,7 +165,7 @@ 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] [--ci=CircleCI|AppVeyor|VSTS] [--ghRelease] [--automaticRelease] TARGET_BRANCH
+    Usage: ci-release-build.js [--job=CI_JOB_NAME] [--ci=CircleCI|AppVeyor] [--ghRelease] [--automaticRelease] TARGET_BRANCH
     `)
     process.exit(0)
   }

+ 0 - 51
vsts.yml

@@ -1,51 +0,0 @@
-resources:
-- repo: self
-steps:
-- bash: |
-    echo 'Non release VSTS builds do not run on older branches'
-  displayName: Skip build on older branch
-  condition: ne(variables['ELECTRON_RELEASE'], '1')
-
-- bash: |
-    git clean -fdx
-  displayName: Clean unneeded git directories
-  timeoutInMinutes: 2
-  condition: eq(variables['ELECTRON_RELEASE'], '1')
-
-- bash: |
-    echo 'Bootstrapping Electron for release build'
-    script/bootstrap.py --target_arch=$TARGET_ARCH
-  name: Bootstrap
-  condition: eq(variables['ELECTRON_RELEASE'], '1')
-
-- bash: |
-    echo 'Building Electron for release'
-    script/build.py -c R
-  name: Build
-  condition: and(succeeded(), eq(variables['ELECTRON_RELEASE'], '1'))
-
-- bash: |
-    echo 'Creating Electron release distribution'
-    script/create-dist.py
-  name: Create_distribution
-  condition: and(succeeded(), eq(variables['ELECTRON_RELEASE'], '1'))
-
-- bash: |
-    if [ "$UPLOAD_TO_S3" != "1" ]; then
-      echo 'Uploading Electron release distribution to github releases'
-      ELECTRON_S3_BUCKET="$(s3_bucket)" ELECTRON_S3_ACCESS_KEY="$(s3_access_key)" ELECTRON_S3_SECRET_KEY="$(s3_secret_key)" ELECTRON_GITHUB_TOKEN="$(github_token)" script/upload.py
-    else
-      echo 'Uploading Electron release distribution to s3'
-      ELECTRON_S3_BUCKET="$(s3_bucket)" ELECTRON_S3_ACCESS_KEY="$(s3_access_key)" ELECTRON_S3_SECRET_KEY="$(s3_secret_key)" ELECTRON_GITHUB_TOKEN="$(github_token)" script/upload.py --upload_to_s3
-    fi
-  name: Upload_distribution
-  condition: and(succeeded(), eq(variables['ELECTRON_RELEASE'], '1'))
-
-- task: PublishBuildArtifacts@1
-  displayName: Publish Build Artifacts
-  inputs:
-    PathtoPublish: '$(Build.SourcesDirectory)/out'
-    ArtifactName: out
-  condition: and(succeeded(), eq(variables['ELECTRON_RELEASE'], '1'))
-
-- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3