CI: Dockerized language port tests (#5066)
[platform/upstream/flatbuffers.git] / .travis.yml
1 env:
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
12 conan-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
25 conan-osx: &conan-osx
26   os: osx
27   language: generic
28   install:
29     - ./conan/travis/install.sh
30   script:
31     - ./conan/travis/build.sh
32   if: tag IS present
33
34 matrix:
35   include:
36     #- language: python
37     #  python: "2.7"
38     #  install:
39     #    - "pip install wheel twine"
40     #  script:
41     #    - "cd python/"
42     #    - 'VERSION="$TRAVIS_TAG" python setup.py sdist bdist_wheel'
43     #    - "cd ../"
44     #  deploy:
45     #    # Checkpointed release builds.
46     #    - provider: script
47     #      script: .travis/deploy-python.sh
48     #      skip_cleanup: true
49     #      on:
50     #        tags: true
51     #        # all_branches must be set with tags: true. See below post:
52     #        # https://stackoverflow.com/a/27775257/1076585
53     #        all_branches: true
54     #    # Produce a new build for the cutting edge when master changes.
55     #    - provider: script
56     #      script: .travis/deploy-python.sh
57     #      skip_cleanup: true
58     #      on:
59     #        branch: master
60     - language: cpp
61       os:
62         - linux
63
64       addons:
65         apt:
66           packages:
67             - docker-ce
68       script:
69         - bash .travis/build-and-run-docker-test-containers.sh
70
71     - language: cpp
72       os:
73         - linux
74
75       compiler:
76         - gcc
77
78       env:
79         matrix:
80           - BUILD_TYPE=Debug
81           - BUILD_TYPE=Release CONAN=true
82
83       before_install:
84       - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi
85       - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq; fi
86       - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq g++-$GCC_VERSION; fi
87       - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq gcc-$GCC_VERSION; fi
88       - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo ln -s -v -f $(which g++-$GCC_VERSION) /usr/bin/g++; fi
89       - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo ln -s -v -f $(which gcc-$GCC_VERSION) /usr/bin/gcc; fi
90
91       script:
92       - bash grpc/build_grpc.sh
93       - cmake . 
94         -DCMAKE_BUILD_TYPE=$BUILD_TYPE 
95         -DFLATBUFFERS_BUILD_GRPCTEST=ON 
96         -DGRPC_INSTALL_PATH=$TRAVIS_BUILD_DIR/google/grpc/install 
97         -DPROTOBUF_DOWNLOAD_PATH=$TRAVIS_BUILD_DIR/google/grpc/third_party/protobuf
98         -DFLATBUFFERS_CODE_SANITIZE=ON
99       - cmake --build . -- -j${JOBS}
100       - LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/google/grpc/install/lib ctest --extra-verbose --output-on-failure
101       - bash .travis/check-generate-code.sh
102       - if [ "$CONAN" == "true" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo pip install conan && conan create . flatbuffers/${TRAVIS_BRANCH}@google/testing -s build_type=$BUILD_TYPE -tf conan/test_package; fi
103
104     - language: cpp
105       os: osx
106       osx_image: xcode9.3
107       env:
108         matrix:
109           - BUILD_TYPE=Debug
110           - BUILD_TYPE=Release
111       
112       script:
113       - bash grpc/build_grpc.sh
114       - cmake .
115         -DCMAKE_BUILD_TYPE=$BUILD_TYPE 
116         -DFLATBUFFERS_BUILD_GRPCTEST=ON 
117         -DGRPC_INSTALL_PATH=$TRAVIS_BUILD_DIR/google/grpc/install 
118         -DPROTOBUF_DOWNLOAD_PATH=$TRAVIS_BUILD_DIR/google/grpc/third_party/protobuf
119         -DFLATBUFFERS_CODE_SANITIZE=ON
120       - cmake --build . -- -j${JOBS}
121       - DYLD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/google/grpc/install/lib ctest --extra-verbose --output-on-failure
122       - bash .travis/check-generate-code.sh
123
124     - <<: *conan-linux
125       env: CONAN_GCC_VERSIONS=4.9 CONAN_DOCKER_IMAGE=conanio/gcc49
126     - <<: *conan-linux
127       env: CONAN_GCC_VERSIONS=5 CONAN_DOCKER_IMAGE=conanio/gcc5
128     - <<: *conan-linux
129       env: CONAN_GCC_VERSIONS=6 CONAN_DOCKER_IMAGE=conanio/gcc6
130     - <<: *conan-linux
131       env: CONAN_GCC_VERSIONS=7 CONAN_DOCKER_IMAGE=conanio/gcc7
132     - <<: *conan-linux
133       env: CONAN_GCC_VERSIONS=8 CONAN_DOCKER_IMAGE=conanio/gcc8
134     - <<: *conan-linux
135       env: CONAN_CLANG_VERSIONS=3.9 CONAN_DOCKER_IMAGE=conanio/clang39
136     - <<: *conan-linux
137       env: CONAN_CLANG_VERSIONS=4.0 CONAN_DOCKER_IMAGE=conanio/clang40
138     - <<: *conan-linux
139       env: CONAN_CLANG_VERSIONS=5.0 CONAN_DOCKER_IMAGE=conanio/clang50
140     - <<: *conan-linux
141       env: CONAN_CLANG_VERSIONS=6.0 CONAN_DOCKER_IMAGE=conanio/clang60
142     - <<: *conan-osx
143       osx_image: xcode7.3
144       env: CONAN_APPLE_CLANG_VERSIONS=7.3
145     - <<: *conan-osx
146       osx_image: xcode8.3
147       env: CONAN_APPLE_CLANG_VERSIONS=8.1
148     - <<: *conan-osx
149       osx_image: xcode9
150       env: CONAN_APPLE_CLANG_VERSIONS=9.0
151     - <<: *conan-osx
152       osx_image: xcode9.4
153       env: CONAN_APPLE_CLANG_VERSIONS=9.1
154     - <<: *conan-osx
155       osx_image: xcode10
156       env: CONAN_APPLE_CLANG_VERSIONS=10.0
157
158     - language: android
159       sudo: true
160       android:
161         components:
162           - tools
163           - platform-tools
164           - build-tools-25.0.2
165           - android-25
166           - extra-android-m2repository
167       compiler:
168         - gcc
169
170       before_install:
171         - git clone https://github.com/urho3d/android-ndk.git $HOME/android-ndk-root
172         - export ANDROID_NDK_HOME=$HOME/android-ndk-root
173         # Setup environment for Linux build which is required to build the sample.
174         - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi
175         - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq; fi
176         - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq g++-$GCC_VERSION; fi
177         - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq gcc-$GCC_VERSION; fi
178         - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo ln -s -v -f $(which g++-$GCC_VERSION) /usr/bin/g++; fi
179         - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo ln -s -v -f $(which gcc-$GCC_VERSION) /usr/bin/gcc; fi
180       script:
181         - failed=0; for build_gradle in $(git ls-files | grep build.gradle); do ( cd "$(dirname "${build_gradle}")" && ./gradlew build ) || failed=1; done; exit $((failed))