Allow creating projects on Travis which use Bazel to build.
Technically this is already the case, because of simple execution calls. I would rename this issue to be more about patching travis-ci to support bazel projects with sane defaults, and less shell-script magic. All the hooks are already there in a .travis.yml file to do all the needed setup in a pinch.
So... steps would be:
I have set up a working demo at https://github.com/korfuri/bazel-travis
It is not optimal at all for a few reasons:
Nevertheless, it works, feel free to use it as an example for your own projects.
Thank you korfuri!
Although this issue is closed, I would add that using a custom CROSSTOOL is no longer necessary for travis. Instead, select the "trusty beta" image in the .travis.yml file:
dist: trusty
sudo: required
os:
- linux
As this has gcc4.8, zip, and jdk8, no longer need to specify oraclejdk8 or addons. That's it!
https://github.com/pubref/rules_protobuf/blob/master/.travis.yml
I've set up a Travis CI build using Bazel binary packages, though it requires manually installing Oracle 8 JDK since Bazel is incompatible with Travis CI's Oracle 8 JDK package. See more details, including a complete config, in issue #1821.
For an even better experience, we would need to get Bazel repo whitelisted for Travis CI (see
https://github.com/travis-ci/apt-source-whitelist/issues/305), at which point one can drop the root privileges and run in container-based infrastructure (which is faster) using the apt plugin support in Travis CI.
Just wanted to add that the three alternatives look very different and maybe a blog post reviewing the three and explaining pros/cons could help noobs. I ended up using @korfuri's suggestion for a small getting-started repo
FYI: rules_protobuf, rules_go, and rules_closure all have working examples of Travis that build on both Linux and OSX.
I didn't mean to suggest any of the alternatives don't work but rather that they differ and so a blog post by someone (maybe the bazel team) could be great for noobs.
Most helpful comment
I have set up a working demo at https://github.com/korfuri/bazel-travis
It is not optimal at all for a few reasons:
Nevertheless, it works, feel free to use it as an example for your own projects.