In this post I’ll show you how to modify your .travis.yml to run your meteor package tests on Travis CI’s new and improved container (docker) based infrastructure using spacejam, our command line package tester.
If you’re not familiar with spacejam yet, please read this post first.
What’s so new and improved with Travis’s new infrastructure?
Well, a lot:
- Because it’s based on linux containers, and not linux virtual machines, builds start instantly after you push, because there is no virtual machine to boot, just a container to start.
Builds also run faster, since every docker container gets 2 dedicated cores and 4GB of memory, vs 1.5 cores and 3GB.
And a few things more. You can read all about it here. Be cautious with caching, though, in the old infrastructure too.
What do I need to change in my .travis.yml?
Examples are better than a thousand words
Your old .travis.yml
language: node_js node_js: - "0.10.36" before_install: - "curl https://install.meteor.com | /bin/sh" - "npm install -g spacejam" script: "spacejam test-packages ./"
Your new .travis.yml
# This is how you tell travis to run the build on the new container (docker) based infrastructure sudo: false language: node_js node_js: - "0.10.36" # Since sudo isn't possible anymore (for now), meteor can't add a link to itself to /usr/local/bin, so you'll have to add the meteor installation folder to the PATH yourself. before_install: - "curl https://install.meteor.com | /bin/sh" - export PATH="$HOME/.meteor:$PATH" - "npm install -g spacejam" script: "spacejam test-packages ./"
So, the only changes are:
export PATH="$HOME/.meteor:$PATH"to the
How do I install linux packages without sudo?
You’ll have to tell travis what packages to install for you in the .travis.yml file, as follows:
addons: apt: packages: - jq - imagemagick
If you’re getting an error that the package cannot be installed, it means it’s not in Travis’s packages whitelist, but no worries, you can just create an issue in their packages whitelist repo to add it. They respond pretty fast. It also seems like travis will add back support for sudo at some point in time in the future.
That’s it for today. Not too much, but not a small time saver…