Update: As of April 2020, I have switched over to GitHub Actions. Travis CI has become buggy and flaky over time and I got tired of trying to keep the builds green. My GitHub action scripts can be seen here.

Just like many software engineers, I maintain my config files for GNU/Linux and Mac OS in a git repository. Given that, I wrote a fair bit of them in interpreted code, notably, Bash, it is a bit hard to ensure that it is bug-free. The other problem I face is that packages on homebrew, the Mac OS package manager becomes obsolete and gets deleted from time to time.

I added CI testing on Travis CI to prevent these breakages and to ensure that my dotfiles are always in good shape for installation. The great thing about Travis CI is that it is entirely free for open-source repositories even for testing on Mac OS containers.

Here’s my Travis CI file, the updated version will be in the repository.

# https://stackoverflow.com/questions/27644586/how-to-set-up-travis-ci-with-multiple-languages
# Test on Both GNU/Linux and Mac OS
matrix:
  include:

    - name: Test on GNU/Linux
      os: linux
      dist: trusty
      sudo: false
      script:
        - set -e
        - bash setup_dotfiles.sh  # Test dotfile setup
        - bash setup/setup_new_ubuntu_machine.sh  # Test Ubuntu-specific setup
        - vim +BundleInstall +qall  # Install all vim bundles

    - name: Test on Mac OS X
      os: osx
      osx_image: xcode10.2
      sudo: required
      script:
        - set -eo pipefail
        - bash setup_dotfiles.sh # Test dotfile setup
        - bash setup/setup_new_mac_machine.sh  # Test Mac OS-specific setup
        - sudo bash setup/_macos
        - vim +BundleInstall +qall  # Install all vim bundles</code></pre>