Skip to content

Commit

Permalink
Travis: add support for testing on OS X
Browse files Browse the repository at this point in the history
  • Loading branch information
malept committed Apr 18, 2016
1 parent 4fa534e commit fef8a6f
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
*.cer
*.csr
*.key
*.pem
node_modules
test/work
.DS_Store
Expand Down
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
sudo: required
dist: trusty
os:
- osx
osx_image: xcode7.3
language: node_js
node_js:
- '4'
- '5'
# Does not yet work on OSX/GCE
# See: https://github.com/travis-ci/travis-ci/issues/4011
cache:
- directories:
- "$HOME/.npm"
- "$HOME/.electron"
- /Library/Caches/Homebrew
before_install: test/ci/before_install.sh
after_success: npm run coveralls
env:
Expand Down
23 changes: 23 additions & 0 deletions test/ci/before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,27 @@ case "$TRAVIS_OS_NAME" in
sudo apt-get update
sudo apt-get install --no-install-recommends --yes wine1.6
;;
"osx")
# Install Wine
BREW_INSTALL="brew install --ignore-dependencies --force-bottle"
brew update
$BREW_INSTALL freetype
brew deps --skip-optional wine | grep -v freetype | xargs $BREW_INSTALL
$BREW_INSTALL wine
# Create CA
openssl req -newkey rsa:4096 -days 1 -x509 -nodes -subj \
"/C=CI/ST=Travis/L=Developer/O=Developer/CN=Developer CA" \
-out /tmp/root.cer -keyout /tmp/root.key
touch /tmp/certindex
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain \
/tmp/root.cer
# Create dev certificate
openssl req -newkey rsa:1024 -nodes -subj \
"/C=CI/ST=Travis/L=Developer/O=Developer/CN=Developer CodeCert" \
-out codesign.csr -keyout codesign.key
openssl ca -batch -config $(pwd)/test/ci/dev_ca.cnf -notext -create_serial \
-in codesign.csr -out codesign.cer
openssl pkcs12 -export -in codesign.cer -inkey codesign.key -out codesign.p12 -password pass:12345
security import codesign.p12 -k ~/Library/Keychains/login.keychain -P 12345 -T /usr/bin/codesign
;;
esac
33 changes: 33 additions & 0 deletions test/ci/dev_ca.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[ ca ]
default_ca = devca

[ crl_ext ]
authorityKeyIdentifier=keyid:always

[ devca ]
new_certs_dir = /tmp
unique_subject = no
certificate = /tmp/root.cer
database = /tmp/certindex
private_key = /tmp/root.key
serial = /tmp/serialfile
default_days = 1
default_md = sha1
policy = devca_policy
x509_extensions = devca_extensions

[ devca_policy ]
commonName = supplied
stateOrProvinceName = supplied
countryName = supplied
emailAddress = optional
organizationName = supplied
organizationalUnitName = optional

[ devca_extensions ]
basicConstraints = CA:false
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always
keyUsage = digitalSignature,keyEncipherment
extendedKeyUsage = codeSigning
crlDistributionPoints = URI:http://path.to.crl/devca.crl
2 changes: 1 addition & 1 deletion test/mac.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ module.exports = function (baseOpts) {
t.timeoutAfter(config.timeout)

var opts = Object.create(baseOpts)
opts['osx-sign'] = true // Ad-hoc
opts['osx-sign'] = {identity: 'Developer CodeCert'}

var appPath

Expand Down

0 comments on commit fef8a6f

Please sign in to comment.