Skip to content

Commit

Permalink
Add Appveyor CI
Browse files Browse the repository at this point in the history
- Add Appveyor badge
- Add Appveyor.yml definition, with encrypted ATOM_ACCESS_TOKEN
- Add cibuild.cmd script to launch cibuild on Windows
- Prepare to release Atom on Windows from Appveyor (but don't do it yet)
- Reduce dependence on JANKY in ci scripts + tasks
- Suppress release activities on PRs for Travis and Appveyor
- Cache ~/.atom/.apm, ~/.atom/.node-gyp/.atom, and ~/.atom/.npm on Appveyor
  • Loading branch information
joefitzgerald committed Nov 10, 2015
1 parent 91bece4 commit 19334be
Show file tree
Hide file tree
Showing 12 changed files with 86 additions and 25 deletions.
1 change: 0 additions & 1 deletion .node-version

This file was deleted.

1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cache = ~/.atom/.npm
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Atom](https://cloud.githubusercontent.com/assets/72919/2874231/3af1db48-d3dd-11e3-98dc-6066f8bc766f.png)

[![Build Status](https://travis-ci.org/atom/atom.svg?branch=master)](https://travis-ci.org/atom/atom)
[![Build Status](https://travis-ci.org/atom/atom.svg?branch=master)](https://travis-ci.org/atom/atom) [![Build status](https://ci.appveyor.com/api/projects/status/1tkktwh654w07eim?svg=true)](https://ci.appveyor.com/project/Atom/atom)
[![Dependency Status](https://david-dm.org/atom/atom.svg)](https://david-dm.org/atom/atom)
[![Join the Atom Community on Slack](http://atom-slack.herokuapp.com/badge.svg)](http://atom-slack.herokuapp.com/)

Expand Down
1 change: 1 addition & 0 deletions apm/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cache = ~/.atom/.npm
35 changes: 35 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: "{build}"

skip_tags: true
clone_folder: c:\projects\atom
clone_depth: 10

platform:
- x86

environment:
global:
ATOM_DEV_RESOURCE_PATH: c:\projects\atom
ATOM_ACCESS_TOKEN:
secure: Q7vxmSq0bVCLTTRPzXw5ZhPTe7XYhWxX0tQV6neEkddTH6pZkOYNmSCG6VnMX2f+

matrix:
- NODE_VERSION: 0.10.35

install:
- SET PATH=C:\Program Files\Atom\resources\cli;%PATH%
- ps: Install-Product node $env:NODE_VERSION $env:PLATFORM

build_script:
- cd %APPVEYOR_BUILD_FOLDER%
- C:\projects\atom\script\cibuild.cmd

test: off
deploy: off
artifacts:
- path: atom-build

cache:
- '%USERPROFILE%\.atom\.apm'
- '%USERPROFILE%\.atom\.node-gyp\.atom'
- '%USERPROFILE%\.atom\.npm'
25 changes: 19 additions & 6 deletions build/Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,16 @@ module.exports = (grunt) ->
disableAutoUpdate = grunt.option('no-auto-update') ? false

channel = grunt.option('channel')
channel ?= process.env.JANKY_BRANCH if process.env.JANKY_BRANCH in ['stable', 'beta']
releasableBranches = ['stable', 'beta']
if process.env.APPVEYOR and not process.env.APPVEYOR_PULL_REQUEST_NUMBER
channel ?= process.env.APPVEYOR_REPO_BRANCH if process.env.APPVEYOR_REPO_BRANCH in releasableBranches

if process.env.TRAVIS and not process.env.TRAVIS_PULL_REQUEST
channel ?= process.env.TRAVIS_BRANCH if process.env.TRAVIS_BRANCH in releasableBranches

if process.env.JANKY_BRANCH
channel ?= process.env.JANKY_BRANCH if process.env.JANKY_BRANCH in releasableBranches

channel ?= 'dev'

metadata = packageJson
Expand Down Expand Up @@ -270,16 +279,20 @@ module.exports = (grunt) ->
grunt.registerTask('lint', ['standard', 'coffeelint', 'csslint', 'lesslint'])
grunt.registerTask('test', ['shell:kill-atom', 'run-specs'])

ciTasks = ['output-disk-space', 'download-electron', 'download-electron-chromedriver', 'build']
ciTasks = []
ciTasks.push('output-disk-space') unless process.env.CI
ciTasks.push('download-electron')
ciTasks.push('download-electron-chromedriver')
ciTasks.push('build')
ciTasks.push('dump-symbols') if process.platform isnt 'win32'
ciTasks.push('set-version', 'check-licenses', 'lint', 'generate-asar')
ciTasks.push('mkdeb') if process.platform is 'linux'
ciTasks.push('codesign:exe') if process.platform is 'win32' and not process.env.TRAVIS
ciTasks.push('codesign:exe') if process.platform is 'win32' and not process.env.CI
ciTasks.push('create-windows-installer:installer') if process.platform is 'win32'
ciTasks.push('test') if process.platform is 'darwin'
ciTasks.push('codesign:installer') if process.platform is 'win32' and not process.env.TRAVIS
ciTasks.push('codesign:app') if process.platform is 'darwin' and not process.env.TRAVIS
ciTasks.push('publish-build') unless process.env.TRAVIS
ciTasks.push('codesign:installer') if process.platform is 'win32' and not process.env.CI
ciTasks.push('codesign:app') if process.platform is 'darwin' and not process.env.CI
ciTasks.push('publish-build') unless process.env.CI
grunt.registerTask('ci', ciTasks)

defaultTasks = ['download-electron', 'download-electron-chromedriver', 'build', 'set-version', 'generate-asar']
Expand Down
7 changes: 3 additions & 4 deletions build/tasks/publish-build-task.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ request = require 'request'

grunt = null

commitSha = process.env.JANKY_SHA1
token = process.env.ATOM_ACCESS_TOKEN
defaultHeaders =
Authorization: "token #{token}"
Expand All @@ -31,8 +30,8 @@ module.exports = (gruntObject) ->
cp path.join(docsOutputDir, 'api.json'), path.join(buildDir, 'atom-api.json')

grunt.registerTask 'upload-assets', 'Upload the assets to a GitHub release', ->
branchName = process.env.JANKY_BRANCH
switch branchName
channel = grunt.config.get('atom.channel')
switch channel
when 'stable'
isPrerelease = false
when 'beta'
Expand All @@ -55,7 +54,7 @@ module.exports = (gruntObject) ->

zipAssets buildDir, assets, (error) ->
return done(error) if error?
getAtomDraftRelease isPrerelease, branchName, (error, release) ->
getAtomDraftRelease isPrerelease, channel, (error, release) ->
return done(error) if error?
assetNames = (asset.assetName for asset in assets)
deleteExistingAssets release, assetNames, (error) ->
Expand Down
10 changes: 6 additions & 4 deletions build/tasks/set-version-task.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ module.exports = (grunt) ->
{spawn} = require('./task-helpers')(grunt)

getVersion = (callback) ->
onBuildMachine = process.env.JANKY_SHA1 and process.env.JANKY_BRANCH in ['stable', 'beta']
releasableBranches = ['stable', 'beta']
channel = grunt.config.get('atom.channel')
shouldUseCommitHash = if channel in releasableBranches then false else true
inRepository = fs.existsSync(path.resolve(__dirname, '..', '..', '.git'))
{version} = require(path.join(grunt.config.get('atom.appDir'), 'package.json'))
if onBuildMachine or not inRepository
callback(null, version)
else
if shouldUseCommitHash and inRepository
cmd = 'git'
args = ['rev-parse', '--short', 'HEAD']
spawn {cmd, args}, (error, {stdout}={}, code) ->
commitHash = stdout?.trim?()
combinedVersion = "#{version}-#{commitHash}"
callback(error, combinedVersion)
else
callback(null, version)

grunt.registerTask 'set-version', 'Set the version in the plist and package.json', ->
done = @async()
Expand Down
3 changes: 1 addition & 2 deletions build/tasks/spec-task.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ async = require 'async'

# TODO: This should really be parallel on every platform, however:
# - On Windows, our fixtures step on each others toes.
# - On Travis, Mac workers haven't enough horsepower.
if process.env.TRAVIS or process.platform is 'win32'
if process.platform is 'win32'
concurrency = 1
else
concurrency = 2
Expand Down
19 changes: 13 additions & 6 deletions script/cibuild
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@ function loadEnvironmentVariables(filePath) {
}

function readEnvironmentVariables() {
if (process.platform === 'win32') {
loadEnvironmentVariables(path.resolve('/jenkins/config/atomcredentials'));
} else if (process.platform === 'darwin') {
loadEnvironmentVariables('/var/lib/jenkins/config/atomcredentials');
loadEnvironmentVariables('/var/lib/jenkins/config/xcodekeychain');
} else if (process.platform === 'linux') {
if (process.env.JANKY_SHA1) {
if (process.platform === 'win32') {
loadEnvironmentVariables(path.resolve('/jenkins/config/atomcredentials'));
} else if (process.platform === 'darwin') {
loadEnvironmentVariables('/var/lib/jenkins/config/atomcredentials');
loadEnvironmentVariables('/var/lib/jenkins/config/xcodekeychain');
}
}
}

function setEnvironmentVariables() {
if (process.platform === 'linux') {
// Use Clang for building native code, the GCC on Precise is too old.
process.env.CC = 'clang';
process.env.CXX = 'clang++';
Expand Down Expand Up @@ -81,6 +87,7 @@ function removeTempFolders() {
}

readEnvironmentVariables();
setEnvironmentVariables();
removeNodeModules();
removeTempFolders();
cp.safeExec.bind(global, 'npm install npm --loglevel error', {cwd: path.resolve(__dirname, '..', 'build')}, function() {
Expand Down
5 changes: 5 additions & 0 deletions script/cibuild.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\cibuild" %*
) ELSE (
node "%~dp0\cibuild" %*
)
2 changes: 1 addition & 1 deletion spec/integration/startup-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
return unless process.env.ATOM_INTEGRATION_TESTS_ENABLED
# Integration tests require a fast machine and, for now, we cannot afford to
# run them on Travis.
return if process.env.TRAVIS
return if process.env.CI

fs = require "fs-plus"
path = require "path"
Expand Down

0 comments on commit 19334be

Please sign in to comment.