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 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. # lua-torch CMakeLists writes to src dir
  12. - chown nobody $CI_WORKSPACE/contrib/lua-torch/nn
  13. # for debug
  14. - echo $CI_COMMIT_AUTHOR
  15. build:
  16. # https://github.com/rspamd/rspamd-build-docker/blob/master/ubuntu-build/Dockerfile
  17. image: rspamd/ci-ubuntu-build
  18. group: build
  19. commands:
  20. # build directories should be writable by nobody, for rspamd in functional tests
  21. # works as nobody and writes coverage files there
  22. - test "$(id -un)" = nobody
  23. - cd /rspamd/build
  24. - cmake $CI_WORKSPACE -DENABLE_COVERAGE=ON -DENABLE_LIBUNWIND=ON -DCMAKE_INSTALL_PREFIX=/rspamd/install -DCMAKE_RULE_MESSAGES=OFF
  25. - ncpu=$(getconf _NPROCESSORS_ONLN)
  26. - make -j $ncpu install
  27. - make -j $ncpu rspamd-test
  28. build-clang:
  29. # https://github.com/rspamd/rspamd-build-docker/blob/master/fedora-build/Dockerfile
  30. image: rspamd/ci-fedora-build
  31. pull: true
  32. group: build
  33. commands:
  34. - test "$(id -un)" = nobody
  35. - cd /rspamd/fedora/build
  36. - export LDFLAGS='-fuse-ld=lld'
  37. - >
  38. cmake
  39. -DENABLE_CLANG_PLUGIN=ON
  40. -DLLVM_CONFIG_BINARY=/usr/bin/llvm-config
  41. -DENABLE_TORCH=OFF
  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. $CI_WORKSPACE
  47. - ncpu=$(getconf _NPROCESSORS_ONLN)
  48. - make -j $ncpu install
  49. - make -j $ncpu rspamd-test
  50. eslint:
  51. image: node:10-alpine
  52. group: build
  53. commands:
  54. - npm install
  55. - ./node_modules/.bin/eslint -v
  56. - ./node_modules/.bin/eslint ./
  57. # Run checks on perl source using tidyall
  58. perl-tidyall:
  59. # https://github.com/rspamd/rspamd-build-docker/blob/master/perl-tidyall/Dockerfile
  60. image: rspamd/ci-perl-tidyall
  61. group: build
  62. commands:
  63. # checks are configured in .tidyallrc at the top of rspamd repo
  64. - tidyall --all --check-only --no-cache --data-dir /tmp/tidyall
  65. # We run rspamd-test (unit test) and functional test (runned by robot) in
  66. # parallel to save time. To avoid conflict in saving lua coverage we run them
  67. # from different directories. For C code coverage counters is saved to .gcda
  68. # files and binary contain absolute path to them, so rspamd-test and
  69. # processes started by functional test are writing to the same files. On
  70. # process exit new coverage data merged with existing content of .gcda file.
  71. # Race is possible if rspamd-test and some rspamd process in functional test
  72. # will try to write .gcda file simultaneous. But it is very unlikely and
  73. # performance is more important then correct coverage data.
  74. rspamd-test:
  75. # https://github.com/rspamd/rspamd-build-docker/blob/master/ubuntu-test/Dockerfile
  76. image: rspamd/ci-ubuntu-test
  77. pull: true
  78. group: tests
  79. commands:
  80. - test "$(id -un)" = nobody
  81. - ulimit -c unlimited
  82. # rspamd-test and functional test both use luacov.stats.out file and should be started from
  83. # different directories (if started in parallel)
  84. - cd /rspamd/build/test
  85. - set +e
  86. - ./rspamd-test -p /rspamd/lua; EXIT_CODE=$?
  87. - set -e
  88. # shell sets exit status of a process terminated by a signal to '128 + signal-number'
  89. # if rspamd-test was terminated by a signal it should be SIGSEGV or SIGABRT, try to examine core
  90. - >
  91. if [ $EXIT_CODE -gt 128 ]; then
  92. gdb --batch -ex 'thread apply all bt full' -c /var/tmp/*.rspamd-test.core ./rspamd-test;
  93. exit $EXIT_CODE;
  94. fi
  95. # luacov-coveralls reads luacov.stats.out written by rspamd-test using luacov module
  96. # and writes json report for coveralls.io service
  97. - luacov-coveralls -o /rspamd/build/unit_test_lua.json --dryrun
  98. - exit $EXIT_CODE
  99. functional:
  100. # https://github.com/rspamd/rspamd-build-docker/blob/master/ubuntu-test-func/Dockerfile
  101. image: rspamd/ci-ubuntu-test-func
  102. pull: true
  103. group: tests
  104. commands:
  105. - cd /rspamd/build
  106. - ulimit -c unlimited
  107. # some rspamd processes during this test work as root and some as nobody
  108. # use umask to create world-writable files so nobody can write to *.gcda files created by root
  109. - umask 0000
  110. - set +e
  111. - RSPAMD_INSTALLROOT=/rspamd/install robot --removekeywords wuks --exclude isbroken $CI_WORKSPACE/test/functional/cases; EXIT_CODE=$?
  112. - set -e
  113. # upload test results to nginx frontent using WebDAV PUT
  114. - >
  115. if [ -n "$HTTP_PUT_AUTH" ]; then
  116. $CI_WORKSPACE/test/tools/http_put.py log.html report.html $CI_SYSTEM_LINK/testlogs/$CI_REPO_NAME/$CI_BUILD_NUMBER/;
  117. fi
  118. # core_pattern=/var/tmp/%u.%e.core so one or two cores can be saved for each binary
  119. - core_files=$(find /var/tmp/ -name '*.core')
  120. # use 'info proc mappings' to find path to executable file for given core
  121. # first mapping is usually program executable
  122. - >
  123. for core in $core_files;
  124. do
  125. exe=$(gdb --batch -ex 'info proc mappings' -c $core | awk 'h {print $5; exit}; /objfile/ {h=1}');
  126. gdb --batch -ex 'bt' -c $core $exe; echo '---';
  127. done
  128. - exit $EXIT_CODE
  129. secrets: [http_put_auth]
  130. send-coverage:
  131. image: rspamd/ci-ubuntu-test
  132. secrets: [ coveralls_repo_token ]
  133. commands:
  134. - cd /rspamd/build
  135. # extract coverage data for C code from .gcda files and save it in a format suitable for coveralls.io
  136. - $CI_WORKSPACE/test/tools/gcov_coveralls.py --exclude test --prefix /rspamd/build --prefix $CI_WORKSPACE --out coverage.c.json
  137. # luacov-coveralls reads luacov.stats.out generated by functional tests
  138. # (see collect_lua_coverage() in test/functional/lib/rspamd.py)
  139. # and writes json report for coveralls.io
  140. - luacov-coveralls -o coverage.functional.lua.json --dryrun
  141. # * merge coverage for C and Lua code
  142. # * remove prefixes from absolute paths (in luacov-coveralls files), filter test, contrib, e. t.c
  143. # * upload report to coveralls.io
  144. - $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
  145. when:
  146. branch: master
  147. # don't send coverage report for pull request
  148. event: [push, tag]
  149. notify:
  150. image: drillster/drone-email
  151. from: noreply@rspamd.com
  152. secrets: [email_host, email_username, email_password]
  153. when:
  154. status: failure