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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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
  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. eslint:
  29. image: node:10-alpine
  30. group: build
  31. commands:
  32. - npm install
  33. - ./node_modules/.bin/eslint -v
  34. - ./node_modules/.bin/eslint ./
  35. # Run checks on perl source using tidyall
  36. perl-tidyall:
  37. # https://github.com/rspamd/rspamd-build-docker/blob/master/perl-tidyall/Dockerfile
  38. image: rspamd/ci-perl-tidyall
  39. group: build
  40. commands:
  41. # checks are configured in .tidyallrc at the top of rspamd repo
  42. - tidyall --all --root-dir $CI_WORKSPACE --check-only --no-cache --data-dir /tmp/tidyall
  43. # We run rspamd-test (unit test) and functional test (runned by robot) in
  44. # parallel to save time. To avoid conflict in saving lua coverage we run them
  45. # from different directories. For C code coverage counters is saved to .gcda
  46. # files and binary contain absolute path to them, so rspamd-test and
  47. # processes started by functional test are writing to the same files. On
  48. # process exit new coverage data merged with existing content of .gcda file.
  49. # Race is possible if rspamd-test and some rspamd process in functional test
  50. # will try to write .gcda file simultaneous. But it is very unlikely and
  51. # performance is more important then correct coverage data.
  52. rspamd-test:
  53. # https://github.com/rspamd/rspamd-build-docker/blob/master/ubuntu-test/Dockerfile
  54. image: rspamd/ci-ubuntu-test
  55. pull: true
  56. group: tests
  57. commands:
  58. - test "$(id -un)" = nobody
  59. - ulimit -c unlimited
  60. # rspamd-test and functional test both use luacov.stats.out file and should be started from
  61. # different directories (if started in parallel)
  62. - cd /rspamd/build/test
  63. - set +e
  64. - ./rspamd-test -p /rspamd/lua; EXIT_CODE=$?
  65. - set -e
  66. # shell sets exit status of a process terminated by a signal to '128 + signal-number'
  67. # if rspamd-test was terminated by a signal it should be SIGSEGV or SIGABRT, try to examine core
  68. - >
  69. if [ $EXIT_CODE -gt 128 ]; then
  70. gdb -c /var/tmp/*.rspamd-test.core ./rspamd-test -ex "set pagination 0" -ex "thread apply all bt full" --batch;
  71. exit $EXIT_CODE;
  72. fi
  73. # luacov-coveralls reads luacov.stats.out written by rspamd-test using luacov module
  74. # and writes json report for coveralls.io service
  75. - luacov-coveralls -o /rspamd/build/unit_test_lua.json --dryrun
  76. - exit $EXIT_CODE
  77. functional:
  78. # https://github.com/rspamd/rspamd-build-docker/blob/master/ubuntu-test-func/Dockerfile
  79. image: rspamd/ci-ubuntu-test-func
  80. pull: true
  81. group: tests
  82. commands:
  83. - cd /rspamd/build
  84. # some rspamd processes during this test work as root and some as nobody
  85. # use umask to create world-writable files so nobody can write to *.gcda files created by root
  86. - umask 0000
  87. - RSPAMD_INSTALLROOT=/rspamd/install robot --xunit xunit.xml --exclude isbroken $CI_WORKSPACE/test/functional/cases
  88. send-coverage:
  89. image: rspamd/ci-ubuntu-test
  90. secrets: [ coveralls_repo_token ]
  91. commands:
  92. - cd /rspamd/build
  93. # extract coverage data for C code from .gcda files and save it in a format suitable for coveralls.io
  94. - $CI_WORKSPACE/test/tools/gcov_coveralls.py --exclude test --prefix /rspamd/build --prefix $CI_WORKSPACE --out coverage.c.json
  95. # * merge coverage for C and Lua code
  96. # * remove prefixes from absolute paths (in luacov-coveralls files), filter test, contrib, e. t.c
  97. # * upload report to coveralls.io
  98. - $CI_WORKSPACE/test/tools/merge_coveralls.py --root $CI_WORKSPACE --input coverage.c.json unit_test_lua.json lua_coverage_report.json --token=$COVERALLS_REPO_TOKEN
  99. when:
  100. branch: master
  101. # don't send coverage report for pull request
  102. event: [push, tag]
  103. send-test-log:
  104. image: drillster/drone-email
  105. from: noreply@rspamd.com
  106. attachment: /rspamd/build/log.html
  107. secrets: [email_host, email_username, email_password]
  108. when:
  109. status: failure