.travis.yml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. sudo: required
  2. dist: xenial
  3. language: cpp
  4. cache:
  5. - ccache
  6. addons:
  7. apt:
  8. sources:
  9. - ubuntu-toolchain-r-test
  10. packages:
  11. - cmake
  12. - valgrind
  13. - clang-8
  14. env:
  15. global:
  16. - USE_CCACHE=1
  17. - CCACHE_SLOPPINESS=pch_defines,time_macros
  18. - CCACHE_COMPRESS=1
  19. - CCACHE_MAXSIZE=100M
  20. - ARCH_FLAGS_x86='-m32' # #266: don't use SSE on 32-bit
  21. - ARCH_FLAGS_x86_64='-msse4.2' # use SSE4.2 on 64-bit
  22. - ARCH_FLAGS_aarch64='-march=armv8-a'
  23. - GITHUB_REPO='Tencent/rapidjson'
  24. - secure: "HrsaCb+N66EG1HR+LWH1u51SjaJyRwJEDzqJGYMB7LJ/bfqb9mWKF1fLvZGk46W5t7TVaXRDD5KHFx9DPWvKn4gRUVkwTHEy262ah5ORh8M6n/6VVVajeV/AYt2C0sswdkDBDO4Xq+xy5gdw3G8s1A4Inbm73pUh+6vx+7ltBbk="
  25. matrix:
  26. include:
  27. # gcc
  28. - env: CONF=release ARCH=x86 CXX11=ON
  29. compiler: gcc
  30. arch: amd64
  31. - env: CONF=release ARCH=x86_64 CXX11=ON
  32. compiler: gcc
  33. arch: amd64
  34. - env: CONF=debug ARCH=x86 CXX11=OFF
  35. compiler: gcc
  36. arch: amd64
  37. - env: CONF=debug ARCH=x86_64 CXX11=OFF
  38. compiler: gcc
  39. arch: amd64
  40. - env: CONF=release ARCH=aarch64 CXX11=ON
  41. compiler: gcc
  42. arch: arm64
  43. - env: CONF=debug ARCH=aarch64 CXX11=OFF
  44. compiler: gcc
  45. arch: arm64
  46. # clang
  47. - env: CONF=debug ARCH=x86 CXX11=ON CCACHE_CPP2=yes
  48. compiler: clang
  49. arch: amd64
  50. - env: CONF=debug ARCH=x86_64 CXX11=ON CCACHE_CPP2=yes
  51. compiler: clang
  52. arch: amd64
  53. - env: CONF=debug ARCH=x86 CXX11=OFF CCACHE_CPP2=yes
  54. compiler: clang
  55. arch: amd64
  56. - env: CONF=debug ARCH=x86_64 CXX11=OFF CCACHE_CPP2=yes
  57. compiler: clang
  58. arch: amd64
  59. - env: CONF=release ARCH=x86 CXX11=ON CCACHE_CPP2=yes
  60. compiler: clang
  61. arch: amd64
  62. - env: CONF=release ARCH=x86_64 CXX11=ON CCACHE_CPP2=yes
  63. compiler: clang
  64. arch: amd64
  65. - env: CONF=debug ARCH=aarch64 CXX11=ON CCACHE_CPP2=yes
  66. compiler: clang
  67. arch: arm64
  68. - env: CONF=debug ARCH=aarch64 CXX11=OFF CCACHE_CPP2=yes
  69. compiler: clang
  70. arch: arm64
  71. # coverage report
  72. - env: CONF=debug ARCH=x86 CXX11=ON GCOV_FLAGS='--coverage'
  73. compiler: gcc
  74. arch: amd64
  75. cache:
  76. - ccache
  77. - pip
  78. after_success:
  79. - pip install --user cpp-coveralls
  80. - coveralls -r .. --gcov-options '\-lp' -e thirdparty -e example -e test -e build/CMakeFiles -e include/rapidjson/msinttypes -e include/rapidjson/internal/meta.h -e include/rapidjson/error/en.h
  81. - env: CONF=debug ARCH=x86_64 GCOV_FLAGS='--coverage'
  82. compiler: gcc
  83. arch: amd64
  84. cache:
  85. - ccache
  86. - pip
  87. after_success:
  88. - pip install --user cpp-coveralls
  89. - coveralls -r .. --gcov-options '\-lp' -e thirdparty -e example -e test -e build/CMakeFiles -e include/rapidjson/msinttypes -e include/rapidjson/internal/meta.h -e include/rapidjson/error/en.h
  90. - env: CONF=debug ARCH=aarch64 GCOV_FLAGS='--coverage'
  91. compiler: gcc
  92. arch: arm64
  93. cache:
  94. - ccache
  95. - pip
  96. after_success:
  97. - pip install --user cpp-coveralls
  98. - coveralls -r .. --gcov-options '\-lp' -e thirdparty -e example -e test -e build/CMakeFiles -e include/rapidjson/msinttypes -e include/rapidjson/internal/meta.h -e include/rapidjson/error/en.h
  99. - script: # Documentation task
  100. - cd build
  101. - cmake .. -DRAPIDJSON_HAS_STDSTRING=ON -DCMAKE_VERBOSE_MAKEFILE=ON
  102. - make travis_doc
  103. cache: false
  104. addons:
  105. apt:
  106. packages:
  107. - doxygen
  108. before_install:
  109. - if [ "x86_64" = "$(arch)" ]; then sudo apt-get install -y g++-multilib libc6-dbg:i386 --allow-unauthenticated; fi
  110. before_script:
  111. # travis provides clang-7 for amd64 and clang-3.8 for arm64
  112. # here use clang-8 to all architectures as clang-7 is not available for arm64
  113. - if [ -f /usr/bin/clang++-8 ]; then
  114. sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-8 1000;
  115. sudo update-alternatives --config clang++;
  116. export PATH=/usr/bin:$PATH;
  117. fi
  118. - if [ "$CXX" = "clang++" ]; then export CCACHE_CPP2=yes; fi
  119. - ccache -s
  120. # hack to avoid Valgrind bug (https://bugs.kde.org/show_bug.cgi?id=326469),
  121. # exposed by merging PR#163 (using -march=native)
  122. # TODO: Since this bug is already fixed. Remove this when valgrind can be upgraded.
  123. - sed -i "s/-march=native//" CMakeLists.txt
  124. - mkdir build
  125. script:
  126. - if [ "$CXX" = "clang++" ]; then export CXXFLAGS="-stdlib=libc++ ${CXXFLAGS}"; fi
  127. - >
  128. eval "ARCH_FLAGS=\${ARCH_FLAGS_${ARCH}}" ;
  129. (cd build && cmake
  130. -DRAPIDJSON_HAS_STDSTRING=ON
  131. -DRAPIDJSON_BUILD_CXX11=$CXX11
  132. -DCMAKE_VERBOSE_MAKEFILE=ON
  133. -DCMAKE_BUILD_TYPE=$CONF
  134. -DCMAKE_CXX_FLAGS="$ARCH_FLAGS $GCOV_FLAGS"
  135. -DCMAKE_EXE_LINKER_FLAGS=$GCOV_FLAGS
  136. ..)
  137. - cd build
  138. - make tests -j 2
  139. - make examples -j 2
  140. - ctest -j 2 -V `[ "$CONF" = "release" ] || echo "-E perftest"`