1env:
2  global:
3    # Set at the root level as this is ignored when set under matrix.env.
4    - GCC_VERSION="4.9"
5    # Fail on first error if UBSAN or ASAN enabled for a target
6    - UBSAN_OPTIONS=halt_on_error=1
7    - ASAN_OPTIONS=halt_on_error=1
8    # Travis machines have 2 cores
9    - JOBS=2
10    - MAKEFLAGS="-j 2"
11
12conan-linux: &conan-linux
13  os: linux
14  dist: xenial
15  language: python
16  python: "3.7"
17  services:
18    - docker
19  install:
20    - ./conan/travis/install.sh
21  script:
22    - ./conan/travis/build.sh
23  if: tag IS present
24
25conan-linux-master: &conan-linux-master
26  os: linux
27  dist: xenial
28  language: python
29  python: "3.7"
30  services:
31    - docker
32  install:
33    - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./conan/travis/install.sh; fi'
34  script:
35    - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./conan/travis/build.sh; fi'
36  branches:
37    only:
38    - master
39
40conan-osx: &conan-osx
41  os: osx
42  language: generic
43  install:
44    - ./conan/travis/install.sh
45  script:
46    - ./conan/travis/build.sh
47  if: tag IS present
48
49matrix:
50  include:
51    #- language: python
52    #  python: "2.7"
53    #  install:
54    #    - "pip install wheel twine"
55    #  script:
56    #    - "cd python/"
57    #    - 'VERSION="$TRAVIS_TAG" python setup.py sdist bdist_wheel'
58    #    - "cd ../"
59    #  deploy:
60    #    # Checkpointed release builds.
61    #    - provider: script
62    #      script: .travis/deploy-python.sh
63    #      skip_cleanup: true
64    #      on:
65    #        tags: true
66    #        # all_branches must be set with tags: true. See below post:
67    #        # https://stackoverflow.com/a/27775257/1076585
68    #        all_branches: true
69    #    # Produce a new build for the cutting edge when master changes.
70    #    - provider: script
71    #      script: .travis/deploy-python.sh
72    #      skip_cleanup: true
73    #      on:
74    #        branch: master
75    - language: cpp
76      os:
77        - linux
78
79      addons:
80        apt:
81          packages:
82            - docker-ce
83      script:
84        - bash .travis/build-and-run-docker-test-containers.sh
85
86    - language: cpp
87      os:
88        - linux
89
90      compiler:
91        - gcc
92
93      env:
94        matrix:
95          - BUILD_TYPE=Debug
96          - BUILD_TYPE=Release
97
98      before_install:
99      - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi
100      - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq; fi
101      - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq g++-$GCC_VERSION; fi
102      - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq gcc-$GCC_VERSION; fi
103      - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo ln -s -v -f $(which g++-$GCC_VERSION) /usr/bin/g++; fi
104      - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo ln -s -v -f $(which gcc-$GCC_VERSION) /usr/bin/gcc; fi
105
106      script:
107      - pip install cmake
108      - bash .travis/check-sources.sh
109      - bash grpc/build_grpc.sh
110      - cmake .
111        -DCMAKE_BUILD_TYPE=$BUILD_TYPE
112        -DFLATBUFFERS_BUILD_GRPCTEST=ON
113        -DGRPC_INSTALL_PATH=$TRAVIS_BUILD_DIR/google/grpc/install
114        -DPROTOBUF_DOWNLOAD_PATH=$TRAVIS_BUILD_DIR/google/grpc/third_party/protobuf
115        -DFLATBUFFERS_CODE_SANITIZE=ON
116      - cmake --build . --target all --clean-first -- -j${JOBS}
117      - LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/google/grpc/install/lib ctest --extra-verbose --output-on-failure
118      - bash scripts/check-generate-code.sh
119
120    - language: cpp
121      os: osx
122      osx_image: xcode9.3
123      env:
124        matrix:
125          - BUILD_TYPE=Debug
126          - BUILD_TYPE=Release
127
128      script:
129      - pip install --user cmake
130      - mkdir ~/cmake_path
131      - ln -s $(find ~/Library/Python -name cmake -type f | head -n 1) ~/cmake_path/cmake
132      - ln -s $(find ~/Library/Python -name ctest -type f | head -n 1) ~/cmake_path/ctest
133      - export PATH=~/cmake_path:${PATH}
134      - bash grpc/build_grpc.sh
135      - cmake .
136        -DCMAKE_BUILD_TYPE=$BUILD_TYPE
137        -DFLATBUFFERS_BUILD_GRPCTEST=ON
138        -DGRPC_INSTALL_PATH=$TRAVIS_BUILD_DIR/google/grpc/install
139        -DPROTOBUF_DOWNLOAD_PATH=$TRAVIS_BUILD_DIR/google/grpc/third_party/protobuf
140        -DFLATBUFFERS_CODE_SANITIZE=ON
141      - cmake --build . -- -j${JOBS}
142      - DYLD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/google/grpc/install/lib ctest --extra-verbose --output-on-failure
143      - bash scripts/check-generate-code.sh
144
145    - <<: *conan-linux-master
146      env: CONAN_GCC_VERSIONS=8 CONAN_DOCKER_IMAGE=conanio/gcc8
147    - <<: *conan-linux
148      env: CONAN_GCC_VERSIONS=4.9 CONAN_DOCKER_IMAGE=conanio/gcc49
149    - <<: *conan-linux
150      env: CONAN_GCC_VERSIONS=5 CONAN_DOCKER_IMAGE=conanio/gcc5
151    - <<: *conan-linux
152      env: CONAN_GCC_VERSIONS=6 CONAN_DOCKER_IMAGE=conanio/gcc6
153    - <<: *conan-linux
154      env: CONAN_GCC_VERSIONS=7 CONAN_DOCKER_IMAGE=conanio/gcc7
155    - <<: *conan-linux
156      env: CONAN_GCC_VERSIONS=8 CONAN_DOCKER_IMAGE=conanio/gcc8
157    - <<: *conan-linux
158      env: CONAN_GCC_VERSIONS=9 CONAN_DOCKER_IMAGE=conanio/gcc9
159    - <<: *conan-linux
160      env: CONAN_CLANG_VERSIONS=3.9 CONAN_DOCKER_IMAGE=conanio/clang39
161    - <<: *conan-linux
162      env: CONAN_CLANG_VERSIONS=4.0 CONAN_DOCKER_IMAGE=conanio/clang40
163    - <<: *conan-linux
164      env: CONAN_CLANG_VERSIONS=5.0 CONAN_DOCKER_IMAGE=conanio/clang50
165    - <<: *conan-linux
166      env: CONAN_CLANG_VERSIONS=6.0 CONAN_DOCKER_IMAGE=conanio/clang60
167    - <<: *conan-linux
168      env: CONAN_CLANG_VERSIONS=7.0 CONAN_DOCKER_IMAGE=conanio/clang7
169    - <<: *conan-linux
170      env: CONAN_CLANG_VERSIONS=8 CONAN_DOCKER_IMAGE=conanio/clang8
171    - <<: *conan-osx
172      osx_image: xcode7.3
173      env: CONAN_APPLE_CLANG_VERSIONS=7.3
174    - <<: *conan-osx
175      osx_image: xcode8.3
176      env: CONAN_APPLE_CLANG_VERSIONS=8.1
177    - <<: *conan-osx
178      osx_image: xcode9
179      env: CONAN_APPLE_CLANG_VERSIONS=9.0
180    - <<: *conan-osx
181      osx_image: xcode9.4
182      env: CONAN_APPLE_CLANG_VERSIONS=9.1
183    - <<: *conan-osx
184      osx_image: xcode10.2
185      env: CONAN_APPLE_CLANG_VERSIONS=10.0
186
187    - language: android
188      sudo: true
189      dist: trusty
190      android:
191        components:
192          - tools
193          - platform-tools
194          - extra-android-m2repository
195        licenses:
196          - 'android-sdk-preview-license-52d11cd2'
197          - 'android-sdk-license-.+'
198          - 'google-gdk-license-.+'
199      compiler:
200        - gcc
201      before_install:
202        - echo y | sdkmanager "platforms;android-30"
203        - echo y | sdkmanager "build-tools;30.0.2"
204        - echo y | sdkmanager "ndk-bundle"
205        - echo y | sdkmanager "cmake;3.6.4111459"
206      script:
207        - cmake -DFLATBUFFERS_BUILD_TESTS=OFF -DFLATBUFFERS_BUILD_FLATLIB=OFF -DFLATBUFFERS_BUILD_FLATHASH=OFF .; make; export PATH="$PATH:${PWD}"
208        - cd android; ./gradlew clean build
209
210    - language: generic
211      if: type IN (pull_request)
212      os: linux
213      install:
214        - bash .travis/format_install.sh
215
216      script:
217        - bash .travis/format_check.sh
218