|
| 1 | +# Facebook projects that use `fbcode_builder` for continuous integration |
| 2 | +# share this Travis configuration to run builds via Docker. |
| 3 | + |
| 4 | +sudo: required |
| 5 | + |
| 6 | +# Docker disables IPv6 in containers by default. Enable it for unit tests that need [::1]. |
| 7 | +before_script: |
| 8 | + # `daemon.json` is normally missing, but let's log it in case that changes. |
| 9 | + - sudo touch /etc/docker/daemon.json |
| 10 | + - sudo cat /etc/docker/daemon.json |
| 11 | + - sudo service docker stop |
| 12 | + # This needs YAML quoting because of the curly braces. |
| 13 | + - 'echo ''{"ipv6": true, "fixed-cidr-v6": "2001:db8:1::/64"}'' | sudo tee /etc/docker/daemon.json' |
| 14 | + - sudo service docker start |
| 15 | + # Fail early if docker failed on start -- add `- sudo dockerd` to debug. |
| 16 | + - sudo docker info |
| 17 | + # Paranoia log: what if our config got overwritten? |
| 18 | + - sudo cat /etc/docker/daemon.json |
| 19 | + |
| 20 | +env: |
| 21 | + global: |
| 22 | + - travis_cache_dir=$HOME/travis_ccache |
| 23 | + # Travis times out after 50 minutes. Very generously leave 10 minutes |
| 24 | + # for setup (e.g. cache download, compression, and upload), so we never |
| 25 | + # fail to cache the progress we made. |
| 26 | + - docker_build_timeout=40m |
| 27 | + |
| 28 | +cache: |
| 29 | + # Our build caches can be 200-300MB, so increase the timeout to 7 minutes |
| 30 | + # to make sure we never fail to cache the progress we made. |
| 31 | + timeout: 420 |
| 32 | + directories: |
| 33 | + - $HOME/travis_ccache # see docker_build_with_ccache.sh |
| 34 | + |
| 35 | +# Ugh, `services:` must be in the matrix, or we get `docker: command not found` |
| 36 | +# https://github.com/travis-ci/travis-ci/issues/5142 |
| 37 | +matrix: |
| 38 | + include: |
| 39 | + - env: ['os_image=ubuntu:16.04', gcc_version=5] |
| 40 | + services: [docker] |
| 41 | + |
| 42 | +script: |
| 43 | + # Travis seems to get confused when `matrix:` is used with `language:` |
| 44 | + - sudo apt-get install python2.7 |
| 45 | + # We don't want to write the script inline because of Travis kludginess -- |
| 46 | + # it looks like it escapes " and \ in scripts when using `matrix:`. |
| 47 | + - ./build/fbcode_builder/travis_docker_build.sh |
| 48 | + |
| 49 | +notifications: |
| 50 | + webhooks: https://code.facebook.com/travis/webhook/ |
0 commit comments