Skip to content

Commit

Permalink
feat(ci): add Travis and AppVeyor ci support
Browse files Browse the repository at this point in the history
  • Loading branch information
emorikawa committed Dec 7, 2015
1 parent 69a5036 commit 989f38c
Show file tree
Hide file tree
Showing 11 changed files with 302 additions and 130 deletions.
85 changes: 41 additions & 44 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,38 @@
env:
global:
- NYLAS_ACCESS_TOKEN=cb200be7c921f73a1c35930f6a4ac8758b271be0

compiler:
- clang
- gcc

- clang
- gcc
matrix:
include:
# Wants a c++11 compiler
- os: linux
env: NODE_VERSION=0.10 CC=gcc-4.8 CXX=g++-4.8 NYLAS_HOME=/home/travis/.nylas
- os: linux
env: NODE_VERSION=0.12 CC=gcc-4.8 CXX=g++-4.8 NYLAS_HOME=/home/travis/.nylas
- os: linux
env: NODE_VERSION=4.2 CC=gcc-4.8 CXX=g++-4.8 NYLAS_HOME=/home/travis/.nylas
- os: linux
env: NODE_VERSION=5 CC=gcc-4.8 CXX=g++-4.8 NYLAS_HOME=/home/travis/.nylas
- os: osx
env: NODE_VERSION=0.10
- os: osx
env: NODE_VERSION=0.12 CC=clang CXX=clang++
# osx already supports c++11 in Apple LLVM
- os: osx
env: NODE_VERSION=4.2 CC=clang CXX=clang++
- os: osx
env: NODE_VERSION=5 CC=clang CXX=clang++

- os: linux
env: NODE_VERSION=0.10 CC=gcc-4.8 CXX=g++-4.8 NYLAS_HOME=/home/travis/.nylas
- os: linux
env: NODE_VERSION=0.12 CC=gcc-4.8 CXX=g++-4.8 NYLAS_HOME=/home/travis/.nylas
- os: linux
env: NODE_VERSION=4.2 CC=gcc-4.8 CXX=g++-4.8 NYLAS_HOME=/home/travis/.nylas PUBLISH_BUILD=true
- os: linux
env: NODE_VERSION=5 CC=gcc-4.8 CXX=g++-4.8 NYLAS_HOME=/home/travis/.nylas
- os: osx
env: NODE_VERSION=0.10
- os: osx
env: NODE_VERSION=0.12 CC=clang CXX=clang++
- os: osx
env: NODE_VERSION=4.2 CC=clang CXX=clang++ PUBLISH_BUILD=true
- os: osx
env: NODE_VERSION=5 CC=clang CXX=clang++
sudo: false

install:
- echo $CC
- echo $CXX
- clang --version
- if [ "$CC" = "gcc-4.8" ]; then gcc-4.8 -v; else gcc -v; fi
- git clone https://github.com/creationix/nvm.git /tmp/.nvm
- source /tmp/.nvm/nvm.sh
- nvm install $NODE_VERSION
- nvm use --delete-prefix $NODE_VERSION

- echo $CC
- echo $CXX
- clang --version
- if [ "$CC" = "gcc-4.8" ]; then gcc-4.8 -v; else gcc -v; fi
- git clone https://github.com/creationix/nvm.git /tmp/.nvm
- source /tmp/.nvm/nvm.sh
- nvm install $NODE_VERSION
- nvm use --delete-prefix $NODE_VERSION
before_script:
- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
export DISPLAY=:99.0;
sh -e /etc/init.d/xvfb start;
fi

- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then export DISPLAY=:99.0; sh -e /etc/init.d/xvfb
start; fi
script: script/cibuild

addons:
apt:
sources:
Expand All @@ -59,11 +45,22 @@ addons:
- git
- libgnome-keyring-dev
- xvfb

branches:
only:
- master
- ci-test

git:
submodules: false
before_install:
- openssl aes-256-cbc -k "$DECRYPTION_PASSWORD" -in build/resources/ssh/nylas-n1-ci-ssh.openssl.enc -out nylas-n1-ci-ssh -d
- mv nylas-n1-ci-ssh ~/.ssh/id_rsa
- ssh-keyscan github.com >> ~/.ssh/known_hosts
- chmod 400 ~/.ssh/id_rsa
- git submodule update --init --recursive
- 2>/dev/null 1>/dev/null openssl aes-256-cbc -K $encrypted_d583b56b822e_key -iv $encrypted_d583b56b822e_iv -in build/resources/nylas/encrypted_certificates/travis/travis-files.tar.enc -out build/resources/nylas/encrypted_certificates/travis/travis-files.tar -d
- mkdir build/resources/certs
- 2>/dev/null 1>/dev/null tar xvf build/resources/nylas/encrypted_certificates/travis/travis-files.tar --directory=build/resources/certs/
- 2>/dev/null 1>/dev/null source build/resources/certs/set_unix_env.sh
env:
global:
secure: O+XG3C/VnCfCVXTHudOQ6JMmBqrRHXh1j7jRwfQ3PYd27gm9BWNjvwlbWTLNcaar9gM00Pwi3rR8IujzJLlw3usZGWbJMLkz+aPYdOlbiDLhyMdIHwX4oI58d1eHx7m8Eun3qT3Y0VkO3blBNdWFWV4ebkfLZyygzXva4CDlSFtbeQYGy4ft76v7Au9uVlOUoV8f+juPx+0Jv+AtQmsY9Sf+6WbxrNaE9y2u2q1ks+XpjFn8Wt1f/xp/Vae0/MjJFpGIVfaUy+q7W8QQ0TyzSCM0eGtjxilS+BkGHjjvlLlMdCspRnZzpSJC+KkpEKLJrAPjR0DAfYMedWockEaIwGG8Onf90fXKG0nlvAg4WrWjnpr0q+V79zOU/yYD/kysLBYg6fYzv6uTvN7TzNaFkKaiQZvorI9P8w/wShGFHE4Y8JC5QU4CLI8q2qrkI38KKt3valIP4qxA/56aM0+D5roTecfh3Y40OcpqKZicpeNvuB1u2FmD2+oxLEb3MVnyfnVnDBP7Crp8/oLsIl/gGR/SVUEyLIimozugUySnCig1BEicygECvp6eRpEHryNrEvLKfxtppr3eWcRKQwnYwch4CaFwya0Lpc1dSA9NaOFQu0kR374s+fhqYgrkaCJevZd+ouKY+0Zt8gZ4CjJVhJ5YamwZAPG+obRd9G3xRM0=
49 changes: 49 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
version: '{build}'

platform:
- x86

pull_requests:
do_not_increment_build_number: true

branches:
only:
- master
- ci-test

test: off

# We deploy via grunt publish-nylas-build instead of AppVeyor
deploy: off

# We need to only clone the main module because our submodule requires the
# encrypted ssh key to access submodules
clone_depth: 1
build:
verbosity: minimal
install:
- ps: Install-Product node $env:NODE_VERSION $env:PLATFORM
- ps: nuget install secure-file -ExcludeVersion

# We need to extract the encrypted private ssh key to clone the submodule.
- ps: secure-file\tools\secure-file -decrypt build\resources\ssh\nylas-n1-ci-ssh-secure-file.enc -secret $env:DECRYPTION_PASSWORD
- ps: mv -Force build\resources\ssh\nylas-n1-ci-ssh-secure-file c:\users\appveyor\.ssh\id_rsa
- ps: git submodule init
# http://stackoverflow.com/questions/21002919/running-a-remote-powershell-script-with-a-git-command-in-it-results-in-nativecom
- ps: Start-Process -FilePath git.exe -ArgumentList 'submodule update' -Wait -NoNewWindow

- ps: secure-file\tools\secure-file -decrypt build\resources\nylas\encrypted_certificates\appveyor\win-nylas-n1.p12.enc -secret $env:DECRYPTION_PASSWORD
- ps: secure-file\tools\secure-file -decrypt build\resources\nylas\encrypted_certificates\appveyor\set_win_env.ps1.enc -secret $env:DECRYPTION_PASSWORD
- ps: . build\resources\nylas\encrypted_certificates\appveyor\set_win_env.ps1

build_script:
- ps: .\script\cibuild.ps1

environment:
matrix:
- NODE_VERSION: 0.12
PUBLISH_BUILD: true
global:
CERTIFICATE_FILE: .\build\resources\nylas\encrypted_certificates\appveyor\win-nylas-n1.p12
DECRYPTION_PASSWORD:
secure: 48VSzDtdBd52Xlo3TZ1NeR1yRRrZ3AU6Px5XjD5RDp44cFU5GYVspecGqX6DGCV7i0D7nldGMyEbXNrjM1t1Kw==
29 changes: 19 additions & 10 deletions build/Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ babelOptions = require '../static/babelrc'
# packages in the root-level node_modules are compiled against Chrome's v8
# headers.
#
# See build/resources/nylas/docs/ContinuousIntegration.md for more detailed
# instructions on how we build N1.
#
# Some useful grunt options are:
# --install-dir
# --build-dir
Expand Down Expand Up @@ -37,7 +40,6 @@ babelOptions = require '../static/babelrc'
# installDir = /usr/local OR $INSTALL_PREFIX
# binDir = /usr/local/bin
# shareDir = /usr/local/share/nylas

_ = require 'underscore'

packageJson = require '../package.json'
Expand Down Expand Up @@ -332,7 +334,7 @@ module.exports = (grunt) ->
outputDir: 'electron'
downloadDir: electronDownloadDir
rebuild: true # rebuild native modules after electron is updated
token: process.env.NYLAS_ACCESS_TOKEN
token: process.env.NYLAS_GITHUB_OAUTH_TOKEN

'create-windows-installer':
installer:
Expand All @@ -343,7 +345,7 @@ module.exports = (grunt) ->
iconUrl: 'http://edgehill.s3.amazonaws.com/static/nylas.ico'
setupIcon: path.resolve(__dirname, 'resources', 'win', 'nylas.ico')
certificateFile: process.env.CERTIFICATE_FILE
certificatePassword: process.env.CERTIFICATE_PASSWORD
certificatePassword: process.env.WINDOWS_CODESIGN_KEY_PASSWORD
exe: 'nylas.exe'

shell:
Expand Down Expand Up @@ -375,18 +377,25 @@ module.exports = (grunt) ->
buildTasks.push('set-exe-icon') if process.platform is 'win32'
grunt.registerTask('build', buildTasks)

ciTasks = ['output-disk-space', 'download-electron', 'build']
ciTasks = ['output-disk-space',
'download-electron',
'build']
ciTasks.push('dump-symbols') if process.platform isnt 'win32'
ciTasks.push('set-version', 'lint', 'generate-asar')
ciTasks.push('test') if process.platform is 'darwin'

unless process.env.TRAVIS
ciTasks.push('codesign')
ciTasks.push('mkdmg') if process.platform is 'darwin'
ciTasks.push('mkdeb') if process.platform is 'linux'
if process.platform is "darwin"
ciTasks.push('test', 'codesign', 'mkdmg')

else if process.platform is "linux"
ciTasks.push('mkdeb')
# Only works on Fedora build machines
# ciTasks.push('mkrpm') if process.platform is 'linux'
ciTasks.push('create-windows-installer:installer') if process.platform is 'win32'

else if process.platform is "win32"
ciTasks.push('create-windows-installer:installer')

{shouldPublishBuild} = require('./tasks/task-helpers')(grunt)
if shouldPublishBuild()
ciTasks.push('publish-nylas-build')

grunt.registerTask('ci', ciTasks)
2 changes: 1 addition & 1 deletion build/resources/nylas
Submodule nylas updated from 2c6ed6 to 48e33f
Binary file not shown.
Binary file added build/resources/ssh/nylas-n1-ci-ssh.openssl.enc
Binary file not shown.
Loading

0 comments on commit 989f38c

Please sign in to comment.