diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..de5a94718 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,26 @@ +git: + depth: 10 + +env: + - NODE_VERSION=0.10 + - NODE_VERSION=0.12 + +os: + - linux + - osx + +install: + - git clone https://github.com/creationix/nvm.git /tmp/.nvm + - source /tmp/.nvm/nvm.sh + - nvm install $NODE_VERSION + - nvm use $NODE_VERSION + - if [ $TRAVIS_OS_NAME == "linux" ]; then + sudo apt-get install build-essential git libgnome-keyring-dev fakeroot; + fi + +script: script/cibuild + +notifications: + email: + on_success: never + on_failure: change diff --git a/build/Gruntfile.coffee b/build/Gruntfile.coffee index e2ca43e07..7c687ac92 100644 --- a/build/Gruntfile.coffee +++ b/build/Gruntfile.coffee @@ -227,8 +227,8 @@ module.exports = (grunt) -> ciTasks.push('mkdeb') if process.platform is 'linux' ciTasks.push('create-windows-installer') if process.platform is 'win32' ciTasks.push('test') if process.platform is 'darwin' - ciTasks.push('codesign') - ciTasks.push('publish-build') + ciTasks.push('codesign') unless process.env.TRAVIS + ciTasks.push('publish-build') unless process.env.TRAVIS grunt.registerTask('ci', ciTasks) defaultTasks = ['download-atom-shell', 'download-atom-shell-chromedriver', 'build', 'set-version', 'generate-asar'] diff --git a/build/tasks/spec-task.coffee b/build/tasks/spec-task.coffee index b5547fe64..da5b24685 100644 --- a/build/tasks/spec-task.coffee +++ b/build/tasks/spec-task.coffee @@ -12,7 +12,7 @@ module.exports = (grunt) -> packageSpecQueue = null logDeprecations = (label, {stderr}={}) -> - return unless process.env.JANKY_SHA1 + return unless process.env.JANKY_SHA1 or process.env.CI stderr ?= '' deprecatedStart = stderr.indexOf('Calls to deprecated functions') return if deprecatedStart is -1 @@ -60,7 +60,7 @@ module.exports = (grunt) -> cwd: packagePath env: _.extend({}, process.env, ATOM_PATH: rootDir) - grunt.verbose.writeln "Launching #{path.basename(packagePath)} specs." + grunt.log.ok "Launching #{path.basename(packagePath)} specs." spawn options, (error, results, code) -> if process.platform is 'win32' if error @@ -104,13 +104,14 @@ module.exports = (grunt) -> ATOM_INTEGRATION_TESTS_ENABLED: true ) + grunt.log.ok "Launching core specs." spawn options, (error, results, code) -> if process.platform is 'win32' process.stderr.write(fs.readFileSync('ci.log')) if error fs.unlinkSync('ci.log') else # TODO: Restore concurrency on Windows - packageSpecQueue.concurrency = concurrency + packageSpecQueue?.concurrency = concurrency logDeprecations('Core Specs', results) callback(null, error) diff --git a/spec/integration/helpers/start-atom.coffee b/spec/integration/helpers/start-atom.coffee index 798853eab..0de6644b3 100644 --- a/spec/integration/helpers/start-atom.coffee +++ b/spec/integration/helpers/start-atom.coffee @@ -1,4 +1,5 @@ path = require "path" +http = require "http" temp = require("temp").track() remote = require "remote" async = require "async" @@ -11,6 +12,19 @@ AtomLauncherPath = path.join(__dirname, "..", "helpers", "atom-launcher.sh") ChromedriverPath = path.resolve(__dirname, '..', '..', '..', 'atom-shell', 'chromedriver', 'chromedriver') SocketPath = path.join(temp.mkdirSync("socket-dir"), "atom-#{process.env.USER}.sock") ChromedriverPort = 9515 +ChromedriverURLBase = "/wd/hub" +ChromedriverStatusURL = "http://localhost:#{ChromedriverPort}#{ChromedriverURLBase}/status" + +pollChromeDriver = (done) -> + checkStatus = -> + http.get(ChromedriverStatusURL, (response) -> + if response.statusCode is 200 + done() + else + pollChromeDriver(done) + ).on("error", -> pollChromeDriver(done)) + + setTimeout(checkStatus, 100) buildAtomClient = (args, env) -> client = webdriverio.remote( @@ -110,7 +124,7 @@ module.exports = (args, env, fn) -> chromedriver = spawn(ChromedriverPath, [ "--verbose", "--port=#{ChromedriverPort}", - "--url-base=/wd/hub" + "--url-base=#{ChromedriverURLBase}" ]) chromedriverLogs = [] @@ -123,7 +137,7 @@ module.exports = (args, env, fn) -> chromedriver.stderr.on "close", -> resolve(errorCode) - waits(100) + waitsFor("webdriver to start", pollChromeDriver, 15000) waitsFor("webdriver to finish", (done) -> finish = once -> diff --git a/spec/integration/startup-spec.coffee b/spec/integration/startup-spec.coffee index 2dcf6ba38..b20427954 100644 --- a/spec/integration/startup-spec.coffee +++ b/spec/integration/startup-spec.coffee @@ -2,6 +2,9 @@ # # ATOM_INTEGRATION_TESTS_ENABLED=true apm test 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 fs = require "fs" path = require "path" diff --git a/spec/jasmine-helper.coffee b/spec/jasmine-helper.coffee index 1e099d897..31f65167b 100644 --- a/spec/jasmine-helper.coffee +++ b/spec/jasmine-helper.coffee @@ -7,7 +7,7 @@ module.exports.runSpecSuite = (specSuite, logFile, logErrors=true) -> {TerminalReporter} = require 'jasmine-tagged' - disableFocusMethods() if process.env.JANKY_SHA1 + disableFocusMethods() if process.env.JANKY_SHA1 or process.env.CI TimeReporter = require './time-reporter' timeReporter = new TimeReporter() diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index e683d7d6e..0112042e2 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -51,7 +51,7 @@ Object.defineProperty document, 'title', jasmine.getEnv().addEqualityTester(_.isEqual) # Use underscore's definition of equality for toEqual assertions -if process.env.JANKY_SHA1 and process.platform is 'win32' +if process.env.CI jasmine.getEnv().defaultTimeoutInterval = 60000 else jasmine.getEnv().defaultTimeoutInterval = 5000