You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

.drone.yml 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. ---
  2. workspace:
  3. base: /rspamd
  4. pipeline:
  5. prepare:
  6. # ubuntu used as base image for build and test images
  7. # and we need to download it anyway
  8. image: ubuntu:18.04
  9. commands:
  10. - install -d -o nobody -g nogroup /rspamd/build /rspamd/install /rspamd/fedora/build /rspamd/fedora/install
  11. # for debug
  12. - echo $CI_COMMIT_AUTHOR
  13. build:
  14. # https://github.com/rspamd/rspamd-build-docker/blob/master/ubuntu-build/Dockerfile
  15. image: rspamd/ci-ubuntu-build
  16. pull: true
  17. group: build
  18. commands:
  19. # build directories should be writable by nobody, for rspamd in functional tests
  20. # works as nobody and writes coverage files there
  21. - test "$(id -un)" = nobody
  22. - cd /rspamd/build
  23. - cmake $CI_WORKSPACE -DENABLE_COVERAGE=ON -DENABLE_LIBUNWIND=ON -DCMAKE_INSTALL_PREFIX=/rspamd/install -DCMAKE_RULE_MESSAGES=OFF -DCMAKE_VERBOSE_MAKEFILE=ON
  24. - ncpu=$(getconf _NPROCESSORS_ONLN)
  25. - make -j $ncpu install
  26. - make -j $ncpu rspamd-test
  27. build-clang:
  28. # https://github.com/rspamd/rspamd-build-docker/blob/master/fedora-build/Dockerfile
  29. image: rspamd/ci-fedora-build
  30. pull: true
  31. group: build
  32. commands:
  33. - test "$(id -un)" = nobody
  34. - cd /rspamd/fedora/build
  35. - export LDFLAGS='-fuse-ld=lld'
  36. - export CFLAGS='-fsanitize=address,undefined,implicit-integer-truncation'
  37. - export ASAN_OPTIONS=detect_leaks=0
  38. - >
  39. cmake
  40. -DENABLE_CLANG_PLUGIN=ON
  41. -DLLVM_CONFIG_BINARY=/usr/bin/llvm-config
  42. -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++
  43. -DCMAKE_INSTALL_PREFIX=/rspamd/fedora/install
  44. -DENABLE_FULL_DEBUG=ON
  45. -DCMAKE_RULE_MESSAGES=OFF
  46. -DCMAKE_VERBOSE_MAKEFILE=ON
  47. $CI_WORKSPACE
  48. - ncpu=$(getconf _NPROCESSORS_ONLN)
  49. - make -j $ncpu install
  50. - make -j $ncpu rspamd-test
  51. eslint:
  52. image: node:10-alpine
  53. group: tests
  54. commands:
  55. - npm install
  56. - ./node_modules/.bin/eslint -v
  57. - ./node_modules/.bin/eslint ./
  58. # Run stylelint checks
  59. - ./node_modules/.bin/stylelint -v
  60. - npm show stylelint-config-standard version
  61. - ./node_modules/.bin/stylelint ./**/*.css ./**/*.html ./**/*.js
  62. # Run checks on perl source using tidyall
  63. perl-tidyall:
  64. # https://github.com/rspamd/rspamd-build-docker/blob/master/perl-tidyall/Dockerfile
  65. image: rspamd/ci-perl-tidyall
  66. group: tests
  67. commands:
  68. - tidyall --version
  69. - perltidy --version | head -1
  70. # checks are configured in .tidyallrc at the top of rspamd repo
  71. - tidyall --all --check-only --no-cache --data-dir /tmp/tidyall
  72. # We run rspamd-test (unit test) and functional test (runned by robot) in
  73. # parallel to save time. To avoid conflict in saving lua coverage we run them
  74. # from different directories. For C code coverage counters is saved to .gcda
  75. # files and binary contain absolute path to them, so rspamd-test and
  76. # processes started by functional test are writing to the same files. On
  77. # process exit new coverage data merged with existing content of .gcda file.
  78. # Race is possible if rspamd-test and some rspamd process in functional test
  79. # will try to write .gcda file simultaneous. But it is very unlikely and
  80. # performance is more important then correct coverage data.
  81. rspamd-test:
  82. # https://github.com/rspamd/rspamd-build-docker/blob/master/ubuntu-test/Dockerfile
  83. image: rspamd/ci-ubuntu-test
  84. pull: true
  85. group: tests
  86. commands:
  87. - test "$(id -un)" = nobody
  88. - ulimit -c unlimited
  89. - ulimit -s unlimited
  90. # rspamd-test and functional test both use luacov.stats.out file and should be started from
  91. # different directories (if started in parallel)
  92. - cd /rspamd/build/test
  93. - set +e
  94. - ./rspamd-test -p /rspamd/lua; EXIT_CODE=$?
  95. - set -e
  96. # shell sets exit status of a process terminated by a signal to '128 + signal-number'
  97. # if rspamd-test was terminated by a signal it should be SIGSEGV or SIGABRT, try to examine core
  98. - >
  99. if [ $EXIT_CODE -gt 128 ]; then
  100. gdb --batch -ex 'thread apply all bt full' -c /var/tmp/*.rspamd-test.core ./rspamd-test;
  101. exit $EXIT_CODE;
  102. fi
  103. # luacov-coveralls reads luacov.stats.out written by rspamd-test using luacov module
  104. # and writes json report for coveralls.io service
  105. - luacov-coveralls -o /rspamd/build/unit_test_lua.json --dryrun
  106. - exit $EXIT_CODE
  107. test-fedora-clang:
  108. # https://github.com/rspamd/rspamd-build-docker/blob/master/fedora-test/Dockerfile
  109. image: rspamd/ci-fedora-test
  110. pull: true
  111. group: tests
  112. commands:
  113. - test "$(id -un)" = nobody
  114. # Asan reserves 20Tb of virtual memory, limit core size to 2 Gb to avoid writing huge core
  115. - ulimit -c 2097152
  116. - ulimit -s unlimited
  117. # disable leak sanitizer: too many leaks detected, most of them probably FP
  118. - export ASAN_OPTIONS="detect_leaks=0:print_stacktrace=1:disable_coredump=0"
  119. - export UBSAN_OPTIONS="print_stacktrace=1:print_summary=0:log_path=/tmp/ubsan"
  120. - cd /rspamd/fedora/build/test
  121. - set +e
  122. - ./rspamd-test -p /rspamd/lua; EXIT_CODE=$?
  123. - set -e
  124. # shell sets exit status of a process terminated by a signal to '128 + signal-number'
  125. # if rspamd-test was terminated by a signal it should be SIGSEGV or SIGABRT, try to examine core
  126. - >
  127. if [ $EXIT_CODE -gt 128 ]; then
  128. gdb --batch -ex 'bt' -c /var/tmp/*.rspamd-test.core ./rspamd-test;
  129. fi
  130. - cat /tmp/ubsan.*
  131. - exit $EXIT_CODE
  132. functional:
  133. # https://github.com/rspamd/rspamd-build-docker/blob/master/ubuntu-test-func/Dockerfile
  134. image: rspamd/ci-ubuntu-test-func
  135. pull: true
  136. group: tests
  137. commands:
  138. - cd /rspamd/build
  139. - ulimit -c unlimited
  140. - ulimit -s unlimited
  141. # some rspamd processes during this test work as root and some as nobody
  142. # use umask to create world-writable files so nobody can write to *.gcda files created by root
  143. - umask 0000
  144. - set +e
  145. - RSPAMD_INSTALLROOT=/rspamd/install robot --removekeywords wuks --exclude isbroken $CI_WORKSPACE/test/functional/cases; EXIT_CODE=$?
  146. - set -e
  147. # upload test results to nginx frontent using WebDAV PUT
  148. - >
  149. if [ -n "$HTTP_PUT_AUTH" ]; then
  150. $CI_WORKSPACE/test/tools/http_put.py log.html report.html $CI_SYSTEM_LINK/testlogs/$CI_REPO_NAME/$CI_BUILD_NUMBER/;
  151. fi
  152. # core_pattern=/var/tmp/%u.%e.core so one or two cores can be saved for each binary
  153. - core_files=$(find /var/tmp/ -name '*.core')
  154. # use 'info proc mappings' to find path to executable file for given core
  155. # first mapping is usually program executable
  156. - >
  157. for core in $core_files;
  158. do
  159. exe=$(gdb --batch -ex 'info proc mappings' -c $core | awk 'h {print $5; exit}; /objfile/ {h=1}');
  160. gdb --batch -ex 'bt' -c $core $exe; echo '---';
  161. done
  162. - exit $EXIT_CODE
  163. secrets: [http_put_auth]
  164. send-coverage:
  165. image: rspamd/ci-ubuntu-test
  166. secrets: [ coveralls_repo_token ]
  167. commands:
  168. - cd /rspamd/build
  169. # extract coverage data for C code from .gcda files and save it in a format suitable for coveralls.io
  170. - $CI_WORKSPACE/test/tools/gcov_coveralls.py --exclude test --prefix /rspamd/build --prefix $CI_WORKSPACE --out coverage.c.json
  171. # luacov-coveralls reads luacov.stats.out generated by functional tests
  172. # (see collect_lua_coverage() in test/functional/lib/rspamd.py)
  173. # and writes json report for coveralls.io
  174. - luacov-coveralls -o coverage.functional.lua.json --dryrun
  175. # * merge coverage for C and Lua code
  176. # * remove prefixes from absolute paths (in luacov-coveralls files), filter test, contrib, e. t.c
  177. # * upload report to coveralls.io
  178. - $CI_WORKSPACE/test/tools/merge_coveralls.py --root $CI_WORKSPACE --input coverage.c.json unit_test_lua.json coverage.functional.lua.json --token=$COVERALLS_REPO_TOKEN
  179. when:
  180. branch: master
  181. # don't send coverage report for pull request
  182. event: [push, tag]
  183. notify:
  184. image: drillster/drone-email
  185. from: noreply@rspamd.com
  186. secrets: [email_host, email_username, email_password]
  187. when:
  188. status: failure