Travis and Erlang on OSX - takes 21 minutes to build

Hello,

I have the following travis file:

language: erlang

matrix:

  include:
    - os: linux
      dist: bionic
      otp_release: 23.3.1

    - os: linux
      dist: focal
      otp_release: 24.3.1

    - os: linux
      dist: focal
      otp_release: 25.0

    - os: osx
      osx_image: xcode12.2
      language: generic

before_script:

- if [[ $TRAVIS_OS_NAME == linux ]]; then sudo apt-get -y update || true ; fi
- if [[ $TRAVIS_OS_NAME == osx ]]; then brew install erlang || true; fi

- curl https://s3.amazonaws.com/rebar3/rebar3 --output rebar3 && chmod +x rebar3

script:
    - ./rebar3 compile

Unfortunately on OSX it takes 21 minutes to build, while 20 minutes are spent to install erlang … There is any other way to install a prebuild version on osx or to somehow cache the install ?

Do you build it on the disk shared between OSX and the VM? That can be horribly slow. If this is the case, it might help to use a disk which is not shared with the host os.

Hello,

I’m not sure what do you mean. I’m only running brew install erlang into before_script section.

Does it help if you pass --force-bottle to brew install?

Never mind, I thought you where trying to build something on a local vm.

I tested on another project : Travis CI - Test and Deploy with Confidence

Seems previous build was around 30 minutes. Now decreased to 17 minutes. Almost the entire time is still spent in installing erlang.

After looking to travis console and docs I make the following config that decreased the time to 8 minutes:


    - os: osx
      osx_image: xcode12.2
      language: generic
      env:
        - HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=true
        - HOMEBREW_NO_INSTALL_UPGRADE=true
        - HOMEBREW_NO_INSTALL_CLEANUP=true
      cache:
        directories:
          - $HOME/Library/Caches/Homebrew
          - /usr/local/Homebrew

Basically:

  • add section cache
  • add env variables for homebrew to avoid doing unnecessary updates