From 20f6a2d8dbca27d761f40e2f5cca040e8be2af95 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 1 Aug 2018 11:20:30 -0700 Subject: [PATCH 01/15] Move over some build logic from appveyor.yml --- script/vsts/platforms/windows.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/script/vsts/platforms/windows.yml b/script/vsts/platforms/windows.yml index b08c8a058..8aad8957d 100644 --- a/script/vsts/platforms/windows.yml +++ b/script/vsts/platforms/windows.yml @@ -23,7 +23,21 @@ phases: - script: | IF NOT EXIST C:\tmp MKDIR C:\tmp SET SQUIRREL_TEMP=C:\tmp - script\build.cmd --create-windows-installer --code-sign --compress-artifacts + IF [%BUILD_SOURCEBRANCHNAME:~-9%]==[-releases] SET IS_RELEASE_BRANCH=true + IF [%BUILD_SOURCEBRANCHNAME%]==[master] IF NOT DEFINED SYSTEM_PULLREQUEST_PULLREQUESTNUMBER SET IS_SIGNED_ZIP_BRANCH=true + IF [%BUILD_SOURCEBRANCHNAME:~0,9%]==[electron-] SET IS_SIGNED_ZIP_BRANCH=true + IF [%IS_RELEASE_BRANCH%]==[true] ( + ECHO Building on release branch - Creating production artifacts && + script\build.cmd --code-sign --compress-artifacts --create-windows-installer + ) ELSE ( + IF [%IS_SIGNED_ZIP_BRANCH%]==[true] ( + ECHO Building on %BUILD_SOURCEBRANCHNAME% branch - Creating signed zips && + script\build.cmd --code-sign --compress-artifacts + ) ELSE ( + ECHO Test build only - Not creating artifacts && + script\build.cmd + ) + ) env: ATOM_RELEASE_VERSION: $(ReleaseVersion) ATOM_WIN_CODE_SIGNING_CERT_DOWNLOAD_URL: $(ATOM_WIN_CODE_SIGNING_CERT_DOWNLOAD_URL) From 668e25a5048ef35b7387c8577000d484acfafb08 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 1 Aug 2018 11:20:44 -0700 Subject: [PATCH 02/15] Add Pull Request build configuration for VSTS --- script/vsts/pull-requests.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 script/vsts/pull-requests.yml diff --git a/script/vsts/pull-requests.yml b/script/vsts/pull-requests.yml new file mode 100644 index 000000000..7224ae231 --- /dev/null +++ b/script/vsts/pull-requests.yml @@ -0,0 +1,23 @@ +trigger: + branches: + exclude: + - master + - 1.* # VSTS only supports wildcards at the end + +phases: + +- phase: GetReleaseVersion + steps: + # This has to be done separately because VSTS inexplicably + # exits the script block after `npm install` completes. + - script: | + cd script\vsts + npm install + displayName: npm install + - script: node script\vsts\get-release-version.js + name: Version + +# Import OS-specific build definitions +- template: platforms/windows.yml +- template: platforms/macos.yml +- template: platforms/linux.yml From fefb1f2ed02028db83132a085d5c50dd78a64808 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 1 Aug 2018 11:40:02 -0700 Subject: [PATCH 03/15] Fix syntax error in windows.yml when referencing environment variables --- script/vsts/platforms/windows.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/vsts/platforms/windows.yml b/script/vsts/platforms/windows.yml index 8aad8957d..194ac9b3b 100644 --- a/script/vsts/platforms/windows.yml +++ b/script/vsts/platforms/windows.yml @@ -23,9 +23,9 @@ phases: - script: | IF NOT EXIST C:\tmp MKDIR C:\tmp SET SQUIRREL_TEMP=C:\tmp - IF [%BUILD_SOURCEBRANCHNAME:~-9%]==[-releases] SET IS_RELEASE_BRANCH=true + IF [%BUILD_SOURCEBRANCHNAME%:~-9%]==[-releases] SET IS_RELEASE_BRANCH=true IF [%BUILD_SOURCEBRANCHNAME%]==[master] IF NOT DEFINED SYSTEM_PULLREQUEST_PULLREQUESTNUMBER SET IS_SIGNED_ZIP_BRANCH=true - IF [%BUILD_SOURCEBRANCHNAME:~0,9%]==[electron-] SET IS_SIGNED_ZIP_BRANCH=true + IF [%BUILD_SOURCEBRANCHNAME%:~0,9%]==[electron-] SET IS_SIGNED_ZIP_BRANCH=true IF [%IS_RELEASE_BRANCH%]==[true] ( ECHO Building on release branch - Creating production artifacts && script\build.cmd --code-sign --compress-artifacts --create-windows-installer From e64bd40ff528d24ddda425241a39dbd5f0c589e3 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 1 Aug 2018 14:35:09 -0700 Subject: [PATCH 04/15] More windows.yml syntax fixes --- script/vsts/platforms/windows.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/script/vsts/platforms/windows.yml b/script/vsts/platforms/windows.yml index 194ac9b3b..544196e85 100644 --- a/script/vsts/platforms/windows.yml +++ b/script/vsts/platforms/windows.yml @@ -23,18 +23,18 @@ phases: - script: | IF NOT EXIST C:\tmp MKDIR C:\tmp SET SQUIRREL_TEMP=C:\tmp - IF [%BUILD_SOURCEBRANCHNAME%:~-9%]==[-releases] SET IS_RELEASE_BRANCH=true + IF [%BUILD_SOURCEBRANCHNAME:~-9%]==[-releases] SET IS_RELEASE_BRANCH=true IF [%BUILD_SOURCEBRANCHNAME%]==[master] IF NOT DEFINED SYSTEM_PULLREQUEST_PULLREQUESTNUMBER SET IS_SIGNED_ZIP_BRANCH=true - IF [%BUILD_SOURCEBRANCHNAME%:~0,9%]==[electron-] SET IS_SIGNED_ZIP_BRANCH=true + IF [%BUILD_SOURCEBRANCHNAME:~0,9%]==[electron-] SET IS_SIGNED_ZIP_BRANCH=true IF [%IS_RELEASE_BRANCH%]==[true] ( - ECHO Building on release branch - Creating production artifacts && + ECHO Building on release branch - Creating production artifacts script\build.cmd --code-sign --compress-artifacts --create-windows-installer ) ELSE ( IF [%IS_SIGNED_ZIP_BRANCH%]==[true] ( - ECHO Building on %BUILD_SOURCEBRANCHNAME% branch - Creating signed zips && + ECHO Building on %BUILD_SOURCEBRANCHNAME% branch - Creating signed zips script\build.cmd --code-sign --compress-artifacts ) ELSE ( - ECHO Test build only - Not creating artifacts && + ECHO Test build only - Not creating artifacts script\build.cmd ) ) From ff2409f10e29bb3106286f633778a4bf654d813d Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 1 Aug 2018 14:46:01 -0700 Subject: [PATCH 05/15] Only use --code-sign parameter on macOS if env variables are set --- script/vsts/platforms/macos.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/script/vsts/platforms/macos.yml b/script/vsts/platforms/macos.yml index c3f0c39cf..2bca994ee 100644 --- a/script/vsts/platforms/macos.yml +++ b/script/vsts/platforms/macos.yml @@ -14,7 +14,11 @@ phases: displayName: Install Node.js 8.9.3 - script: | - script/build --code-sign --compress-artifacts + if [ ! -z $ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL ] && [ $ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL != "null" ]; then + script/build --code-sign --compress-artifacts + else + script/build --compress-artifacts + fi displayName: Build Atom env: ATOM_RELEASE_VERSION: $(ReleaseVersion) From c1eba502c3a0bafaecbf630ae2b6fc8da6c203d0 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 1 Aug 2018 17:35:58 -0700 Subject: [PATCH 06/15] Enable S3 artifact uploads for builds on master --- script/publish-release | 53 ++++++++++++++++------------ script/vsts/get-release-version.js | 9 +++++ script/vsts/nightly-release.yml | 2 +- script/vsts/platforms/windows.yml | 30 +++++++++------- script/vsts/release-branch-build.yml | 42 ++++++++++++++++++++++ 5 files changed, 99 insertions(+), 37 deletions(-) diff --git a/script/publish-release b/script/publish-release index 47ef55a9b..3d5eaa5c6 100644 --- a/script/publish-release +++ b/script/publish-release @@ -13,40 +13,47 @@ const argv = yargs .usage('Usage: $0 [options]') .help('help') .describe('assets-path', 'Path to the folder where all release assets are stored') + .describe('s3-path', 'Indicates the S3 path in which the assets should be uploaded') + .describe('create-github-release', 'Creates a GitHub release for this build, draft if release branch or public if Nightly') .wrap(yargs.terminalWidth()) .argv -let assetsPath = argv.assetsPath || path.join(CONFIG.repositoryRootPath, 'out') -let assets = glob.sync(path.join(assetsPath, '*(*.exe|*.zip|*.nupkg|*.tar.gz|*.rpm|*.deb|RELEASES*)')) +const assetsPath = argv.assetsPath || path.join(CONFIG.repositoryRootPath, 'out') +const assets = glob.sync(path.join(assetsPath, '*(*.exe|*.zip|*.nupkg|*.tar.gz|*.rpm|*.deb|RELEASES*)')) +const bucketPath = argv.s3Path || `releases/v${CONFIG.computedAppVersion}/` -console.log(`Uploading release assets for ${CONFIG.computedAppVersion} to S3`) +console.log(`Uploading release assets for ${CONFIG.computedAppVersion} to S3 under '${bucketPath}'`) uploadToS3( process.env.ATOM_RELEASES_S3_KEY, process.env.ATOM_RELEASES_S3_SECRET, process.env.ATOM_RELEASES_S3_BUCKET, - `releases/v${CONFIG.computedAppVersion}/`, + bucketPath, assets).then( () => { - console.log(`Publishing GitHub release ${CONFIG.computedAppVersion}`) - publishRelease({ - token: process.env.GITHUB_TOKEN, - owner: 'atom', - repo: CONFIG.channel !== 'nightly' ? 'atom' : 'atom-nightly-releases', - name: CONFIG.computedAppVersion, - tag: `v${CONFIG.computedAppVersion}`, - draft: false, - prerelease: CONFIG.channel !== 'stable', - reuseRelease: true, - skipIfPublished: true, - assets - }, function (err, release) { - if (err) { - console.error("An error occurred while publishing the release:\n\n", err) - } else { - console.log("Release published successfully: ", release.html_url) - } - }) + if (argv.createGithubRelease) { + console.log(`Creating GitHub release v${CONFIG.computedAppVersion}`) + publishRelease({ + token: process.env.GITHUB_TOKEN, + owner: 'atom', + repo: CONFIG.channel !== 'nightly' ? 'atom' : 'atom-nightly-releases', + name: CONFIG.computedAppVersion, + tag: `v${CONFIG.computedAppVersion}`, + draft: false, + prerelease: CONFIG.channel !== 'stable', + reuseRelease: true, + skipIfPublished: true, + assets + }, function (err, release) { + if (err) { + console.error("An error occurred while publishing the release:\n\n", err) + } else { + console.log("Release published successfully: ", release.html_url) + } + }) + } else { + console.log("Skipping GitHub release creation") + } }).catch((err) => { console.error('An error occurred while uploading the release:', err) }) diff --git a/script/vsts/get-release-version.js b/script/vsts/get-release-version.js index ff51a6cfb..745beb4e9 100644 --- a/script/vsts/get-release-version.js +++ b/script/vsts/get-release-version.js @@ -40,6 +40,15 @@ async function getReleaseVersion () { // the associated variables. console.log(`##vso[task.setvariable variable=ReleaseVersion;isOutput=true]${releaseVersion}`) console.log(`##vso[build.updatebuildnumber]${releaseVersion}+${process.env.BUILD_BUILDNUMBER}`) + + // Write out some variables that indicate whether artifacts should be uploaded + const buildBranch = process.env.BUILD_SOURCEBRANCHNAME + const isReleaseBranch = buildBranch.match(/\d\.\d+-releases/) !== undefined + const isSignedZipBranch = + buildBranch.startsWith('electron-') || + buildBranch === 'master' && !process.env.SYSTEM_PULLREQUEST_PULLREQUESTNUMBER + console.log(`##vso[task.setvariable variable=IsReleaseBranch;isOutput=true]${isReleaseBranch}`) + console.log(`##vso[task.setvariable variable=IsSignedBuildBranch;isOutput=true]${isSignedBuildBranch}`) } getReleaseVersion() diff --git a/script/vsts/nightly-release.yml b/script/vsts/nightly-release.yml index 33da441fb..81d64876c 100644 --- a/script/vsts/nightly-release.yml +++ b/script/vsts/nightly-release.yml @@ -47,7 +47,7 @@ phases: artifactName: Binaries - script: | - $(Build.SourcesDirectory)\script\publish-release.cmd --assets-path "$(System.ArtifactsDirectory)/Binaries" + $(Build.SourcesDirectory)\script\publish-release.cmd --create-github-release --assets-path "$(System.ArtifactsDirectory)/Binaries" env: GITHUB_TOKEN: $(GITHUB_TOKEN) ATOM_RELEASE_VERSION: $(ReleaseVersion) diff --git a/script/vsts/platforms/windows.yml b/script/vsts/platforms/windows.yml index 544196e85..a6a841b95 100644 --- a/script/vsts/platforms/windows.yml +++ b/script/vsts/platforms/windows.yml @@ -3,6 +3,8 @@ phases: dependsOn: GetReleaseVersion variables: ReleaseVersion: $[ dependencies.GetReleaseVersion.outputs['Version.ReleaseVersion'] ] + IsReleaseBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsReleaseBranch'] ] + IsSignedZipBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsSignedZipBranch'] ] queue: name: Hosted timeoutInMinutes: 180 @@ -23,18 +25,15 @@ phases: - script: | IF NOT EXIST C:\tmp MKDIR C:\tmp SET SQUIRREL_TEMP=C:\tmp - IF [%BUILD_SOURCEBRANCHNAME:~-9%]==[-releases] SET IS_RELEASE_BRANCH=true - IF [%BUILD_SOURCEBRANCHNAME%]==[master] IF NOT DEFINED SYSTEM_PULLREQUEST_PULLREQUESTNUMBER SET IS_SIGNED_ZIP_BRANCH=true - IF [%BUILD_SOURCEBRANCHNAME:~0,9%]==[electron-] SET IS_SIGNED_ZIP_BRANCH=true IF [%IS_RELEASE_BRANCH%]==[true] ( - ECHO Building on release branch - Creating production artifacts + ECHO Creating production artifacts for release branch %BUILD_SOURCEBRANCHNAME% script\build.cmd --code-sign --compress-artifacts --create-windows-installer ) ELSE ( IF [%IS_SIGNED_ZIP_BRANCH%]==[true] ( - ECHO Building on %BUILD_SOURCEBRANCHNAME% branch - Creating signed zips + ECHO Creating signed CI artifacts for branch %BUILD_SOURCEBRANCHNAME% script\build.cmd --code-sign --compress-artifacts ) ELSE ( - ECHO Test build only - Not creating artifacts + ECHO Pull request build, no artifacts created script\build.cmd ) ) @@ -42,6 +41,8 @@ phases: ATOM_RELEASE_VERSION: $(ReleaseVersion) ATOM_WIN_CODE_SIGNING_CERT_DOWNLOAD_URL: $(ATOM_WIN_CODE_SIGNING_CERT_DOWNLOAD_URL) ATOM_WIN_CODE_SIGNING_CERT_PASSWORD: $(ATOM_WIN_CODE_SIGNING_CERT_PASSWORD) + IS_RELEASE_BRANCH: $(IsReleaseBranch) + IS_SIGNED_ZIP_BRANCH: $(IsSignedZipBranch) displayName: Build Atom - script: script\lint.cmd @@ -53,13 +54,6 @@ phases: CI_PROVIDER: VSTS displayName: Run tests - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/AtomSetup-x64.exe - ArtifactName: AtomSetup-x64.exe - ArtifactType: Container - displayName: Upload AtomSetup-x64.exe - - task: PublishBuildArtifacts@1 inputs: PathtoPublish: $(Build.SourcesDirectory)/out/atom-x64-windows.zip @@ -67,12 +61,21 @@ phases: ArtifactType: Container displayName: Upload atom-x64-windows.zip + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.SourcesDirectory)/out/AtomSetup-x64.exe + ArtifactName: AtomSetup-x64.exe + ArtifactType: Container + displayName: Upload AtomSetup-x64.exe + condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true')) + - task: PublishBuildArtifacts@1 inputs: PathtoPublish: $(Build.SourcesDirectory)/out/atom-x64-$(ReleaseVersion)-full.nupkg ArtifactName: atom-x64-$(ReleaseVersion)-full.nupkg ArtifactType: Container displayName: Upload atom-x64-$(ReleaseVersion)-full.nupkg + condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true')) - task: PublishBuildArtifacts@1 inputs: @@ -80,3 +83,4 @@ phases: ArtifactName: RELEASES-x64 ArtifactType: Container displayName: Upload RELEASES-x64 + condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true')) diff --git a/script/vsts/release-branch-build.yml b/script/vsts/release-branch-build.yml index 8ef4c50d7..a1fa52940 100644 --- a/script/vsts/release-branch-build.yml +++ b/script/vsts/release-branch-build.yml @@ -19,3 +19,45 @@ phases: #- template: platforms/windows.yml - template: platforms/macos.yml - template: platforms/linux.yml + +- phase: UploadArtifacts + queue: Hosted # Need this for Python 2.7 + condition: and(succeeded(), eq(variables['IsSignedZipBranch'], 'true')) + + dependsOn: + - GetReleaseVersion + # - Windows + - Linux + - macOS + + variables: + ReleaseVersion: $[ dependencies.GetReleaseVersion.outputs['Version.ReleaseVersion'] ] + IsReleaseBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsReleaseBranch'] ] + IsSignedZipBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsSignedZipBranch'] ] + + steps: + - task: NodeTool@0 + inputs: + versionSpec: 8.9.3 + displayName: Install Node.js 8.9.3 + + # This has to be done separately because VSTS inexplicably + # exits the script block after `npm install` completes. + - script: | + cd script + npm install + displayName: npm install + + - task: DownloadBuildArtifacts@0 + displayName: Download Release Artifacts + inputs: + artifactName: Binaries + + - script: | + $(Build.SourcesDirectory)\script\publish-release.cmd --assets-path "$(System.ArtifactsDirectory)/Binaries" --s3-path "vsts-artifacts/$(Build.BuildNumber)" + env: + ATOM_RELEASE_VERSION: $(ReleaseVersion) + ATOM_RELEASES_S3_KEY: $(ATOM_RELEASES_S3_KEY) + ATOM_RELEASES_S3_SECRET: $(ATOM_RELEASES_S3_SECRET) + ATOM_RELEASES_S3_BUCKET: $(ATOM_RELEASES_S3_BUCKET) + displayName: Upload CI Artifacts to S3 From 9ecb2847374ba334ad6e42a1752065569abe90f1 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 1 Aug 2018 17:40:52 -0700 Subject: [PATCH 07/15] Fix wrong variable name --- script/vsts/get-release-version.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/vsts/get-release-version.js b/script/vsts/get-release-version.js index 745beb4e9..0a0ee4ba7 100644 --- a/script/vsts/get-release-version.js +++ b/script/vsts/get-release-version.js @@ -48,7 +48,7 @@ async function getReleaseVersion () { buildBranch.startsWith('electron-') || buildBranch === 'master' && !process.env.SYSTEM_PULLREQUEST_PULLREQUESTNUMBER console.log(`##vso[task.setvariable variable=IsReleaseBranch;isOutput=true]${isReleaseBranch}`) - console.log(`##vso[task.setvariable variable=IsSignedBuildBranch;isOutput=true]${isSignedBuildBranch}`) + console.log(`##vso[task.setvariable variable=IsSignedBuildBranch;isOutput=true]${isSignedZipBranch}`) } getReleaseVersion() From 1d5c71ef7f10be32ab99ea3b6a92dc6c1f0475ad Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 1 Aug 2018 17:41:14 -0700 Subject: [PATCH 08/15] Disable branch builds for Pull Requests build definition --- script/vsts/pull-requests.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/script/vsts/pull-requests.yml b/script/vsts/pull-requests.yml index 7224ae231..8f17bacff 100644 --- a/script/vsts/pull-requests.yml +++ b/script/vsts/pull-requests.yml @@ -1,8 +1,4 @@ -trigger: - branches: - exclude: - - master - - 1.* # VSTS only supports wildcards at the end +trigger: none # No CI builds, only PR builds phases: From be99688094f59066613886a289f8e58dc3d0e397 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 1 Aug 2018 18:52:18 -0700 Subject: [PATCH 09/15] Use quotes on env variable values coming from VSTS --- script/vsts/platforms/windows.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/vsts/platforms/windows.yml b/script/vsts/platforms/windows.yml index a6a841b95..3562c76f5 100644 --- a/script/vsts/platforms/windows.yml +++ b/script/vsts/platforms/windows.yml @@ -25,11 +25,11 @@ phases: - script: | IF NOT EXIST C:\tmp MKDIR C:\tmp SET SQUIRREL_TEMP=C:\tmp - IF [%IS_RELEASE_BRANCH%]==[true] ( + IF [%IS_RELEASE_BRANCH%]==["true"] ( ECHO Creating production artifacts for release branch %BUILD_SOURCEBRANCHNAME% script\build.cmd --code-sign --compress-artifacts --create-windows-installer ) ELSE ( - IF [%IS_SIGNED_ZIP_BRANCH%]==[true] ( + IF [%IS_SIGNED_ZIP_BRANCH%]==["true"] ( ECHO Creating signed CI artifacts for branch %BUILD_SOURCEBRANCHNAME% script\build.cmd --code-sign --compress-artifacts ) ELSE ( From fb0bbd98320772a49fa0dcbbd7095fbf94b2e91e Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 1 Aug 2018 18:52:27 -0700 Subject: [PATCH 10/15] Fix wrong VSTS variable name --- script/vsts/get-release-version.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/vsts/get-release-version.js b/script/vsts/get-release-version.js index 0a0ee4ba7..4d38bc7c0 100644 --- a/script/vsts/get-release-version.js +++ b/script/vsts/get-release-version.js @@ -48,7 +48,7 @@ async function getReleaseVersion () { buildBranch.startsWith('electron-') || buildBranch === 'master' && !process.env.SYSTEM_PULLREQUEST_PULLREQUESTNUMBER console.log(`##vso[task.setvariable variable=IsReleaseBranch;isOutput=true]${isReleaseBranch}`) - console.log(`##vso[task.setvariable variable=IsSignedBuildBranch;isOutput=true]${isSignedZipBranch}`) + console.log(`##vso[task.setvariable variable=IsSignedZipBranch;isOutput=true]${isSignedZipBranch}`) } getReleaseVersion() From 059dc2913537b45d6f1ccf0db7a484013e2c9b09 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 1 Aug 2018 19:54:23 -0700 Subject: [PATCH 11/15] Improve logic in macos.yml for deciding when to code sign macOS builds --- script/vsts/platforms/macos.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/script/vsts/platforms/macos.yml b/script/vsts/platforms/macos.yml index 2bca994ee..5f54112b9 100644 --- a/script/vsts/platforms/macos.yml +++ b/script/vsts/platforms/macos.yml @@ -3,6 +3,8 @@ phases: dependsOn: GetReleaseVersion variables: ReleaseVersion: $[ dependencies.GetReleaseVersion.outputs['Version.ReleaseVersion'] ] + IsReleaseBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsReleaseBranch'] ] + IsSignedZipBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsSignedZipBranch'] ] queue: name: Hosted macOS Preview timeoutInMinutes: 180 @@ -14,13 +16,15 @@ phases: displayName: Install Node.js 8.9.3 - script: | - if [ ! -z $ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL ] && [ $ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL != "null" ]; then + if [ $IS_RELEASE_BRANCH == "true" ] || [ $IS_SIGNED_ZIP_BRANCH == "true" ]; then script/build --code-sign --compress-artifacts else script/build --compress-artifacts fi displayName: Build Atom env: + IS_RELEASE_BRANCH: $(IsReleaseBranch) + IS_SIGNED_ZIP_BRANCH: $(IsSignedZipBranch) ATOM_RELEASE_VERSION: $(ReleaseVersion) ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL: $(ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL) ATOM_MAC_CODE_SIGNING_CERT_PASSWORD: $(ATOM_MAC_CODE_SIGNING_CERT_PASSWORD) From 167de057b472e44726294301642f4f9fc5353172 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 1 Aug 2018 20:38:07 -0700 Subject: [PATCH 12/15] Compress artifacts on Windows PR builds --- script/vsts/platforms/windows.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/vsts/platforms/windows.yml b/script/vsts/platforms/windows.yml index 3562c76f5..199ab40e2 100644 --- a/script/vsts/platforms/windows.yml +++ b/script/vsts/platforms/windows.yml @@ -33,8 +33,8 @@ phases: ECHO Creating signed CI artifacts for branch %BUILD_SOURCEBRANCHNAME% script\build.cmd --code-sign --compress-artifacts ) ELSE ( - ECHO Pull request build, no artifacts created - script\build.cmd + ECHO Pull request build, no code signing will be performed + script\build.cmd --compress-artifacts ) ) env: From d2ed1d4bbd7ebf8b05430f93f129baea3c5a7553 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Thu, 2 Aug 2018 06:45:46 -0700 Subject: [PATCH 13/15] Fix broken logic for IsReleaseBranch --- script/vsts/get-release-version.js | 2 +- script/vsts/platforms/windows.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/script/vsts/get-release-version.js b/script/vsts/get-release-version.js index 4d38bc7c0..b25f06687 100644 --- a/script/vsts/get-release-version.js +++ b/script/vsts/get-release-version.js @@ -43,7 +43,7 @@ async function getReleaseVersion () { // Write out some variables that indicate whether artifacts should be uploaded const buildBranch = process.env.BUILD_SOURCEBRANCHNAME - const isReleaseBranch = buildBranch.match(/\d\.\d+-releases/) !== undefined + const isReleaseBranch = buildBranch.match(/\d\.\d+-releases/) !== null const isSignedZipBranch = buildBranch.startsWith('electron-') || buildBranch === 'master' && !process.env.SYSTEM_PULLREQUEST_PULLREQUESTNUMBER diff --git a/script/vsts/platforms/windows.yml b/script/vsts/platforms/windows.yml index 199ab40e2..2ad6fc639 100644 --- a/script/vsts/platforms/windows.yml +++ b/script/vsts/platforms/windows.yml @@ -25,11 +25,11 @@ phases: - script: | IF NOT EXIST C:\tmp MKDIR C:\tmp SET SQUIRREL_TEMP=C:\tmp - IF [%IS_RELEASE_BRANCH%]==["true"] ( + IF [%IS_RELEASE_BRANCH%]==[true] ( ECHO Creating production artifacts for release branch %BUILD_SOURCEBRANCHNAME% script\build.cmd --code-sign --compress-artifacts --create-windows-installer ) ELSE ( - IF [%IS_SIGNED_ZIP_BRANCH%]==["true"] ( + IF [%IS_SIGNED_ZIP_BRANCH%]==[true] ( ECHO Creating signed CI artifacts for branch %BUILD_SOURCEBRANCHNAME% script\build.cmd --code-sign --compress-artifacts ) ELSE ( From 8f006cab6136778aaca8b26824283314dec4c561 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Thu, 2 Aug 2018 06:55:30 -0700 Subject: [PATCH 14/15] Add check for Atom.RunTests variable to make it easy to skip CI tests --- script/vsts/platforms/linux.yml | 1 + script/vsts/platforms/macos.yml | 1 + script/vsts/platforms/windows.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/script/vsts/platforms/linux.yml b/script/vsts/platforms/linux.yml index 6e569cc5e..d0b03ff51 100644 --- a/script/vsts/platforms/linux.yml +++ b/script/vsts/platforms/linux.yml @@ -36,6 +36,7 @@ phases: CI: true CI_PROVIDER: VSTS displayName: Run tests + condition: and(succeeded(), eq(variables['Atom.RunTests'], 'true')) - task: PublishBuildArtifacts@1 inputs: diff --git a/script/vsts/platforms/macos.yml b/script/vsts/platforms/macos.yml index 5f54112b9..012a618a7 100644 --- a/script/vsts/platforms/macos.yml +++ b/script/vsts/platforms/macos.yml @@ -41,6 +41,7 @@ phases: CI: true CI_PROVIDER: VSTS displayName: Run tests + condition: and(succeeded(), eq(variables['Atom.RunTests'], 'true')) - script: | cp $(Build.SourcesDirectory)/out/*.zip $(Build.ArtifactStagingDirectory) diff --git a/script/vsts/platforms/windows.yml b/script/vsts/platforms/windows.yml index 2ad6fc639..4c9433564 100644 --- a/script/vsts/platforms/windows.yml +++ b/script/vsts/platforms/windows.yml @@ -53,6 +53,7 @@ phases: CI: true CI_PROVIDER: VSTS displayName: Run tests + condition: and(succeeded(), eq(variables['Atom.RunTests'], 'true')) - task: PublishBuildArtifacts@1 inputs: From cf79c545c847396d2bbc6237f748bc071fbb741f Mon Sep 17 00:00:00 2001 From: David Wilson Date: Thu, 2 Aug 2018 07:24:46 -0700 Subject: [PATCH 15/15] Change Atom.RunTests to Atom.SkipTests to not require it in build defs --- script/vsts/platforms/linux.yml | 2 +- script/vsts/platforms/macos.yml | 2 +- script/vsts/platforms/windows.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/script/vsts/platforms/linux.yml b/script/vsts/platforms/linux.yml index d0b03ff51..675de8063 100644 --- a/script/vsts/platforms/linux.yml +++ b/script/vsts/platforms/linux.yml @@ -36,7 +36,7 @@ phases: CI: true CI_PROVIDER: VSTS displayName: Run tests - condition: and(succeeded(), eq(variables['Atom.RunTests'], 'true')) + condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true')) - task: PublishBuildArtifacts@1 inputs: diff --git a/script/vsts/platforms/macos.yml b/script/vsts/platforms/macos.yml index 012a618a7..9462d69f1 100644 --- a/script/vsts/platforms/macos.yml +++ b/script/vsts/platforms/macos.yml @@ -41,7 +41,7 @@ phases: CI: true CI_PROVIDER: VSTS displayName: Run tests - condition: and(succeeded(), eq(variables['Atom.RunTests'], 'true')) + condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true')) - script: | cp $(Build.SourcesDirectory)/out/*.zip $(Build.ArtifactStagingDirectory) diff --git a/script/vsts/platforms/windows.yml b/script/vsts/platforms/windows.yml index 4c9433564..9e88e4211 100644 --- a/script/vsts/platforms/windows.yml +++ b/script/vsts/platforms/windows.yml @@ -53,7 +53,7 @@ phases: CI: true CI_PROVIDER: VSTS displayName: Run tests - condition: and(succeeded(), eq(variables['Atom.RunTests'], 'true')) + condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true')) - task: PublishBuildArtifacts@1 inputs: