2
0

.travis.yml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. dist: xenial
  2. language: c
  3. env:
  4. global:
  5. - secure: "QD09MuUxftXRXtz7ZrB7S0NV/3O9yVhjvIlCSbXN8B87rNSDC8wxMThKMT7iZewnqGk53m+Up19PiMw5ERlHose5tm2cmY1FO/l+c9oAyWZaAL+4XNXryq6zI5F5FX5I61NbfqV3xcnfLTI2QIJF6WqDojNxhPjTbNzQGxIDuqw="
  6. matrix:
  7. include:
  8. # linux build
  9. - os: linux
  10. env:
  11. - TEST="linux (gcc)"
  12. addons:
  13. apt:
  14. sources:
  15. - ubuntu-toolchain-r-test
  16. packages:
  17. - gcc-6
  18. - valgrind
  19. install:
  20. - pyenv global 3.7.1
  21. - pip3 install meson ninja
  22. script:
  23. - CC=gcc-6 EXTRA_CFLAGS=-Werror ./configure
  24. - make
  25. - make runtest
  26. - make runtest-valgrind
  27. - make distclean
  28. - mkdir build && cd build
  29. - cmake -DBUILD_WITH_SANITIZERS=TRUE ..
  30. - make
  31. - CTEST_OUTPUT_ON_FAILURE=1 make test
  32. - cd ..
  33. - CC=gcc-6 meson setup --werror builddir
  34. - meson compile -C builddir
  35. - meson test -v -C builddir
  36. # linux build with openssl
  37. - os: linux
  38. env:
  39. - TEST="linux openssl (gcc)"
  40. addons:
  41. apt:
  42. sources:
  43. - ubuntu-toolchain-r-test
  44. packages:
  45. - gcc-6
  46. - valgrind
  47. install:
  48. - pyenv global 3.7.1
  49. - pip3 install meson ninja
  50. script:
  51. - CC=gcc-6 EXTRA_CFLAGS=-Werror ./configure --enable-openssl
  52. - make
  53. - make runtest
  54. - make runtest-valgrind
  55. - make distclean
  56. - mkdir build && cd build
  57. - cmake -DENABLE_OPENSSL=ON -DBUILD_WITH_SANITIZERS=TRUE ..
  58. - make
  59. - CTEST_OUTPUT_ON_FAILURE=1 make test
  60. - cd ..
  61. - mkdir build_shared && cd build_shared
  62. - cmake -DENABLE_OPENSSL=ON -DBUILD_SHARED_LIBS=ON ..
  63. - make
  64. - make test
  65. - cd ..
  66. - meson setup --werror -Dcrypto-library=openssl builddir
  67. - meson compile -C builddir
  68. - meson test -v -C builddir
  69. # linux build with openssl and clang
  70. - os: linux
  71. env:
  72. - TEST="linux openssl (clang)"
  73. addons:
  74. apt:
  75. packages:
  76. - clang
  77. install:
  78. - pyenv global 3.7.1
  79. - pip3 install meson ninja
  80. script:
  81. - CC=clang EXTRA_CFLAGS=-Werror ./configure --enable-openssl
  82. - make
  83. - make runtest
  84. - CC=clang meson setup --werror -Dcrypto-library=openssl builddir
  85. - meson compile -C builddir
  86. - meson test -v -C builddir
  87. # linux build with nss
  88. - os: linux
  89. env:
  90. - TEST="linux nss (gcc / valgrind)"
  91. addons:
  92. apt:
  93. sources:
  94. - ubuntu-toolchain-r-test
  95. packages:
  96. - gcc-6
  97. - valgrind
  98. - libnss3-dev
  99. install:
  100. - pyenv global 3.7.1
  101. - pip3 install meson ninja
  102. script:
  103. - CC=gcc-6 EXTRA_CFLAGS=-Werror ./configure --enable-nss
  104. - make
  105. - make runtest
  106. - make runtest-valgrind
  107. - mkdir build && cd build
  108. - cmake -DENABLE_NSS=ON -DBUILD_WITH_SANITIZERS=TRUE ..
  109. - make
  110. - CTEST_OUTPUT_ON_FAILURE=1 make test
  111. - cd ..
  112. - CC=gcc-6 meson setup --werror -Dcrypto-library=nss builddir
  113. - meson compile -C builddir
  114. - meson test -v -C builddir
  115. # linux build with mbedtls
  116. - os: linux
  117. env:
  118. - TEST="linux mbedtls (gcc)"
  119. addons:
  120. apt:
  121. sources:
  122. - ubuntu-toolchain-r-test
  123. packages:
  124. - gcc-6
  125. - libmbedtls-dev
  126. script:
  127. - mkdir build && cd build
  128. - cmake -DENABLE_MBEDTLS=ON -DBUILD_WITH_SANITIZERS=TRUE ..
  129. - make
  130. - CTEST_OUTPUT_ON_FAILURE=1 make test
  131. - cd ..
  132. # default osx build
  133. - os: osx
  134. env:
  135. - TEST="osx"
  136. before_install:
  137. - pip3 install meson ninja
  138. script:
  139. - EXTRA_CFLAGS=-Werror ./configure
  140. - make
  141. - make runtest
  142. - make distclean
  143. - mkdir build && cd build
  144. - cmake ..
  145. - make
  146. - make test
  147. - cd ..
  148. - meson setup --werror builddir
  149. - meson compile -C builddir
  150. - meson test -v -C builddir
  151. # osx build with openssl
  152. - os: osx
  153. osx_image: xcode11.2
  154. env:
  155. - TEST="osx openssl"
  156. before_install:
  157. - pip3 install meson ninja
  158. - brew install openssl@1.1
  159. script:
  160. - PKG_CONFIG_PATH=$(brew --prefix openssl@1.1)/lib/pkgconfig EXTRA_CFLAGS=-Werror ./configure --enable-openssl
  161. - make
  162. - make runtest
  163. - make distclean
  164. - mkdir build && cd build
  165. - cmake -DOPENSSL_ROOT_DIR=$(brew --prefix openssl@1.1) -DENABLE_OPENSSL=ON ..
  166. - make
  167. - make test
  168. - cd ..
  169. - PKG_CONFIG_PATH=$(brew --prefix openssl@1.1)/lib/pkgconfig meson setup --werror -Dcrypto-library=openssl builddir
  170. - meson compile -C builddir
  171. - meson test -v -C builddir
  172. # osx build with nss
  173. - os: osx
  174. osx_image: xcode11.2
  175. env:
  176. - TEST="osx nss"
  177. before_install:
  178. - pip3 install meson ninja
  179. script:
  180. - PKG_CONFIG_PATH=$(brew --prefix nss)/lib/pkgconfig EXTRA_CFLAGS=-Werror ./configure --enable-nss
  181. - make
  182. - make runtest
  183. - PKG_CONFIG_PATH=$(brew --prefix nss)/lib/pkgconfig meson setup --werror -Dcrypto-library=nss builddir
  184. - meson compile -C builddir
  185. - meson test -v -C builddir
  186. # osx build for Apple Silicon
  187. - os: osx
  188. osx_image: xcode12u
  189. env:
  190. - TEST="osx Apple Silicon"
  191. script:
  192. - mkdir build && cd build
  193. - cmake "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64" ..
  194. - make
  195. - lipo -info srtp_driver
  196. - make test
  197. # code format check
  198. - os: linux
  199. env:
  200. - TEST="clang-format"
  201. addons:
  202. apt:
  203. packages:
  204. - clang-format-3.9
  205. script:
  206. - CLANG_FORMAT=clang-format-3.9 ./format.sh -d
  207. # big-endian
  208. - os: linux
  209. env:
  210. - TEST="big-endian"
  211. services:
  212. - docker
  213. addons:
  214. apt:
  215. packages:
  216. - qemu-user-static
  217. - qemu-system-mips
  218. before_install:
  219. - sudo docker run --volume $(pwd):/src --workdir /src --name mipsX --tty --detach ubuntu:16.04 tail
  220. - sudo docker exec --tty mipsX apt-get update
  221. - sudo docker exec --tty mipsX apt-get install build-essential -y
  222. - sudo docker exec --tty mipsX apt-get install qemu-user-static qemu-system-mips gcc-mips-linux-gnu python3-pip -y
  223. - sudo docker exec --tty mipsX pip3 install meson==0.56.2 ninja
  224. script:
  225. - sudo docker exec --tty mipsX bash -c 'EXTRA_CFLAGS=-static CC=mips-linux-gnu-gcc ./configure --host=mips-linux-gnu'
  226. - sudo docker exec --tty mipsX make
  227. - file test/srtp_driver
  228. - make runtest
  229. - |
  230. cat > mips-cross-file.txt <<EOF
  231. [host_machine]
  232. system = 'linux'
  233. cpu_family = 'mips'
  234. cpu = 'mips'
  235. endian = 'big'
  236. [properties]
  237. c_args = ['-static', '-static-libgcc']
  238. c_link_args = ['-static', '-static-libgcc']
  239. [binaries]
  240. ar = 'mips-linux-gnu-gcc-ar'
  241. c = 'mips-linux-gnu-gcc'
  242. ranlib = 'mips-linux-gnu-gcc-ranlib'
  243. exe_wrapper = 'qemu-mips-static'
  244. pkgconfig = 'false'
  245. EOF
  246. #- sudo docker exec --tty mipsX meson setup --cross-file mips-cross-file.txt -Ddefault_library=static -Db_staticpic=false builddir
  247. #- sudo docker exec --tty mipsX meson compile -C builddir
  248. #- sudo docker exec --tty mipsX meson test -v --timeout-multiplier 10 -C builddir
  249. - sudo docker kill mipsX
  250. # linux build of fuzzer
  251. - os: linux
  252. env:
  253. - TEST="fuzzer (build only)"
  254. addons:
  255. apt:
  256. packages:
  257. - clang
  258. script:
  259. - CC=clang CXX=clang++ CXXFLAGS="-fsanitize=fuzzer-no-link,address,undefined -g -O3" CFLAGS="-fsanitize=fuzzer-no-link,address,undefined -g -O3" LDFLAGS="-fsanitize=fuzzer-no-link,address,undefined" ./configure
  260. - LIBFUZZER="-fsanitize=fuzzer" make srtp-fuzzer
  261. # coverity scan
  262. - os: linux
  263. env:
  264. - TEST="Coverity Scan"
  265. addons:
  266. coverity_scan:
  267. project:
  268. name: "cisco-libSRTP"
  269. description: "Build submitted via Travis CI"
  270. version: 2
  271. notification_email: pabuhler@cisco.com
  272. build_command_prepend: "./configure"
  273. build_command: "make"
  274. branch_pattern: master
  275. script:
  276. - echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-
  277. # windows build
  278. - os: windows
  279. before_install:
  280. - choco install python --version 3.8.0
  281. - choco install ninja
  282. - pip3 install meson
  283. env:
  284. - TEST="windows"
  285. - PATH=/c/Python38:/c/Python38/Scripts:$PATH
  286. script:
  287. - export PATH="c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin":$PATH
  288. - mkdir build && cd build
  289. - cmake -G "Visual Studio 15 2017" ..
  290. - msbuild.exe libsrtp2.sln -p:Configuration=Release
  291. - msbuild.exe RUN_TESTS.vcxproj -p:Configuration=Release
  292. - cd ..
  293. - mkdir build_shared && cd build_shared
  294. - cmake -G "Visual Studio 15 2017" -DBUILD_SHARED_LIBS=ON ..
  295. - msbuild.exe libsrtp2.sln -p:Configuration=Release
  296. - msbuild.exe RUN_TESTS.vcxproj -p:Configuration=Release
  297. # Test mingw build
  298. - cd ..
  299. - meson setup builddir-gcc
  300. - meson compile -C builddir-gcc
  301. - meson test -v -C builddir-gcc
  302. # Test MSVC 64-bit build
  303. - cmd.exe //C 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat' amd64 \& set CC=cl \& meson setup --werror builddir-msvc-amd64 \& meson compile -C builddir-msvc-amd64 \& meson test -v -C builddir-msvc-amd64
  304. # Test MSVC 32-bit build
  305. - cmd.exe //C 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat' x86 \& set CC=cl \& meson setup --werror builddir-msvc-x86 \& meson compile -C builddir-msvc-x86 \& meson test -v -C builddir-msvc-x86
  306. # Test MSVC 64-bit UWP build. This is a cross build because we cannot run UWP binaries natively.
  307. - |
  308. cat > uwp-amd64-cross-file.txt <<EOF
  309. [host_machine]
  310. system = 'windows'
  311. cpu_family = 'x86_64'
  312. cpu = 'x86_64'
  313. endian = 'little'
  314. [properties]
  315. c_args = ['-DWINAPI_FAMILY=WINAPI_FAMILY_APP']
  316. c_link_args = ['-APPCONTAINER', 'WindowsApp.lib']
  317. needs_exe_wrapper = true
  318. [binaries]
  319. ar = 'lib'
  320. c = 'cl'
  321. cpp = 'cl'
  322. pkgconfig = 'false'
  323. EOF
  324. - cmd.exe //C 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat' amd64 uwp \& meson setup --werror --cross-file uwp-amd64-cross-file.txt builddir-uwp-amd64 \& meson compile -C builddir-uwp-amd64
  325. # Test MSVC ARM64 UWP build. This is a cross build.
  326. - |
  327. cat > uwp-arm64-cross-file.txt <<EOF
  328. [host_machine]
  329. system = 'windows'
  330. cpu_family = 'aarch64'
  331. cpu = 'aarch64'
  332. endian = 'little'
  333. [properties]
  334. c_args = ['-DWINAPI_FAMILY=WINAPI_FAMILY_APP']
  335. c_link_args = ['-APPCONTAINER', 'WindowsApp.lib']
  336. needs_exe_wrapper = true
  337. [binaries]
  338. ar = 'lib'
  339. c = 'cl'
  340. cpp = 'cl'
  341. pkgconfig = 'false'
  342. EOF
  343. - cmd.exe //C 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat' amd64_arm64 uwp \& meson setup --werror --cross-file uwp-arm64-cross-file.txt builddir-uwp-arm64 \& meson compile -C builddir-uwp-arm64
  344. # android build
  345. - os: linux
  346. env:
  347. - TEST="android"
  348. install:
  349. - pyenv global 3.7.1
  350. - pip3 install meson ninja
  351. script:
  352. - wget -q https://dl.google.com/android/repository/android-ndk-r20b-linux-x86_64.zip
  353. - unzip -qq android-ndk-r20b-linux-x86_64.zip
  354. - ANDROID_NDK=`pwd`/android-ndk-r20b
  355. - mkdir build_android
  356. - cd build_android
  357. - cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a ..
  358. - make
  359. - cd ..
  360. - TOOLCHAIN=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64
  361. - AR=$TOOLCHAIN/bin/aarch64-linux-android-ar
  362. AS=$TOOLCHAIN/bin/aarch64-linux-android-as
  363. CC=$TOOLCHAIN/bin/aarch64-linux-android21-clang
  364. CXX=$TOOLCHAIN/bin/aarch64-linux-android21-clang++
  365. LD=$TOOLCHAIN/bin/aarch64-linux-android-ld
  366. RANLIB=$TOOLCHAIN/bin/aarch64-linux-android-ranlib
  367. STRIP=$TOOLCHAIN/bin/aarch64-linux-android-strip
  368. ./configure --host aarch64-linux-android
  369. - make
  370. - |
  371. cat > android-cross-file.txt <<EOF
  372. [host_machine]
  373. system = 'android'
  374. cpu_family = 'aarch64'
  375. cpu = 'aarch64'
  376. endian = 'little'
  377. [properties]
  378. sys_root = '$ANDROID_NDK/sysroot'
  379. [binaries]
  380. ar = '$TOOLCHAIN/bin/aarch64-linux-android-ar'
  381. c = '$TOOLCHAIN/bin/aarch64-linux-android21-clang'
  382. cpp = '$TOOLCHAIN/bin/aarch64-linux-android21-clang++'
  383. ranlib = '$TOOLCHAIN/bin/aarch64-linux-android-ranlib'
  384. strip = '$TOOLCHAIN/bin/aarch64-linux-android-strip'
  385. pkgconfig = 'false'
  386. EOF
  387. - meson setup --werror --cross-file android-cross-file.txt builddir
  388. - meson compile -C builddir
  389. # ios build
  390. - os: osx
  391. osx_image: xcode11.2
  392. env:
  393. - TEST="ios"
  394. before_install:
  395. - pip3 install meson ninja
  396. script:
  397. - wget -q https://raw.githubusercontent.com/leetal/ios-cmake/master/ios.toolchain.cmake
  398. - mkdir build && cd build
  399. - cmake -DCMAKE_TOOLCHAIN_FILE=../ios.toolchain.cmake -DPLATFORM=OS64 ..
  400. - make
  401. - cd ..
  402. - CFLAGS="-arch arm64 --sysroot=$(xcrun --sdk iphoneos --show-sdk-path) -miphoneos-version-min=8.0 -fembed-bitcode"
  403. LDFLAGS="-arch arm64 --sysroot=$(xcrun --sdk iphoneos --show-sdk-path) -miphoneos-version-min=8.0 -fembed-bitcode"
  404. AR="$(xcrun --find --sdk iphoneos ar)"
  405. AS="$(xcrun --find --sdk iphoneos as)"
  406. CC="$(xcrun --find --sdk iphoneos clang)"
  407. CXX="$(xcrun --find --sdk iphoneos clang++)"
  408. LD="$(xcrun --find --sdk iphoneos ld)"
  409. RANLIB="$(xcrun --find --sdk iphoneos ranlib)"
  410. STRIP="$(xcrun --find --sdk iphoneos strip)"
  411. ./configure --host arm-apple-darwin
  412. - make
  413. - make shared_library
  414. - |
  415. cat > ios-cross-file.txt <<EOF
  416. [host_machine]
  417. system = 'darwin'
  418. cpu_family = 'aarch64'
  419. cpu = 'aarch64'
  420. endian = 'little'
  421. [properties]
  422. c_args = ['-arch', 'arm64', '--sysroot=$(xcrun --sdk iphoneos --show-sdk-path)', '-miphoneos-version-min=8.0']
  423. c_link_args = ['-arch', 'arm64', '--sysroot=$(xcrun --sdk iphoneos --show-sdk-path)', '-miphoneos-version-min=8.0']
  424. [binaries]
  425. ar = '$(xcrun --find --sdk iphoneos ar)'
  426. c = '$(xcrun --find --sdk iphoneos clang)'
  427. cpp = '$(xcrun --find --sdk iphoneos clang++)'
  428. ranlib = '$(xcrun --find --sdk iphoneos ranlib)'
  429. strip = '$(xcrun --find --sdk iphoneos strip)'
  430. pkgconfig = 'false'
  431. EOF
  432. - meson setup --werror -Db_bitcode=true --cross-file ios-cross-file.txt builddir
  433. - meson compile -C builddir