use osx on travis-ci?
AlJohri opened this issue · 6 comments
I'm curious why you don't currently try actually running the mac script on travis?
nevermind, just tried this myself and that didn't seem like it was ever going to end
reopening this. I got it working in 24 minutes for my fork of laptop which does a bunch more stuff. https://travis-ci.org/WPMedia/laptop/builds/245425407
here is a travis ci config that works:
language: generic
os: osx
osx_image: xcode8.3
install:
- brew install shellcheck
script:
- shellcheck mac -e SC2039
- ./mac
matrix:
fast_finish: true
notifications:
email: false
The only change I needed to make was adding sudo to the chsh command and appending "$USER" at the end of it.
@AlJohri Running the mac
script on Travis CI seems like win. Cool!
In case it saves someone a minute, Al’s related work on the WPMedia fork:
@gohanlon thanks!
One other change I made which wasn't necessary but sped things up a bit was using the travis binary for ruby instead of compiling it on the fly: https://github.com/WPMedia/laptop/blob/b1f6ea5640932cfab2725b8749c24a19326c94e8/mac#L161-L169
if ! rbenv versions | grep -Fq "$ruby_version"; then
if [ "$CI" == "true" ]; then
wget "http://rubies.travis-ci.org/osx/10.12/x86_64/ruby-$ruby_version.tar.bz2"
tar -xf "ruby-$ruby_version.tar.bz2"
mv "ruby-$ruby_version" "$HOME/.rbenv/versions/$ruby_version"
else
RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/opt/openssl rbenv install -s "$ruby_version"
fi
fi
Waiting for Ruby builds is no fun. Although I’m torn, I lean towards not applying that speedup.
The speedup is no doubt huge and is only substituting a step that should already be well tested outside of Laptop.
But, sometimes ruby-build
builds do break, especially around the time of new macOS or Xcode releases, and knowing that the build Laptop depends on is broken would be useful (even though there’s almost certainly nothing to be done within Laptop to fix it).
Side note: I think using openssl from homebrew is a default ruby-build
behavior, so Laptop could remove the RUBY_CONFIGURE_OPTS
. Maybe that'd be a good first test to run on Travis CI?