選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

.drone.jsonnet 8.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. local docker_pipeline = {
  2. kind: 'pipeline',
  3. type: 'docker',
  4. };
  5. local default_trigger_events_ex_pr = [
  6. 'push',
  7. 'tag',
  8. 'custom',
  9. ];
  10. local default_trigger = {
  11. trigger: {
  12. event: default_trigger_events_ex_pr + ['pull_request'],
  13. },
  14. };
  15. local platform(arch) = {
  16. platform: {
  17. os: 'linux',
  18. arch: arch,
  19. },
  20. };
  21. local coveralls_attribs = {
  22. branch: [
  23. 'master',
  24. ],
  25. event: [
  26. 'push',
  27. 'tag',
  28. ],
  29. };
  30. local close_coveralls_trigger = {
  31. trigger: coveralls_attribs { status: ['success', 'failure'] },
  32. };
  33. local coveralls_when = {
  34. when: coveralls_attribs,
  35. };
  36. local notify_pipeline = {
  37. name: 'notify',
  38. depends_on: [
  39. 'default-amd64',
  40. 'default-arm64',
  41. 'default-noarch',
  42. ],
  43. steps: [
  44. {
  45. name: 'notify',
  46. image: 'drillster/drone-email',
  47. pull: 'if-not-exists',
  48. settings: {
  49. from: 'noreply@rspamd.com',
  50. host: {
  51. from_secret: 'email_host',
  52. },
  53. username: {
  54. from_secret: 'email_username',
  55. },
  56. password: {
  57. from_secret: 'email_password',
  58. },
  59. },
  60. },
  61. ],
  62. trigger: {
  63. event: default_trigger_events_ex_pr,
  64. status: [
  65. 'failure',
  66. ],
  67. },
  68. } + docker_pipeline;
  69. local pipeline(arch) = {
  70. local rspamd_volumes = {
  71. volumes: [
  72. {
  73. name: 'rspamd',
  74. path: '/rspamd',
  75. },
  76. ],
  77. },
  78. local hyperscan_altroot = if (arch) == 'amd64' then '' else '-DHYPERSCAN_ROOT_DIR=/vectorscan',
  79. depends_on: [
  80. ],
  81. name: 'default-' + arch,
  82. steps: [
  83. {
  84. name: 'prepare',
  85. image: 'ubuntu:22.04',
  86. pull: 'if-not-exists',
  87. commands: [
  88. 'install -d -o nobody -g nogroup /rspamd/build /rspamd/install /rspamd/fedora/build /rspamd/fedora/install',
  89. ],
  90. } + rspamd_volumes,
  91. {
  92. name: 'build',
  93. image: 'rspamd/ci:ubuntu-build',
  94. pull: 'always',
  95. depends_on: [
  96. 'prepare',
  97. ],
  98. commands: [
  99. 'test "$(id -un)" = nobody',
  100. 'cd /rspamd/build',
  101. 'cmake -DCMAKE_INSTALL_PREFIX=/rspamd/install -DCMAKE_RULE_MESSAGES=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_COVERAGE=ON -DENABLE_LIBUNWIND=ON -DENABLE_HYPERSCAN=ON ' + hyperscan_altroot + ' -GNinja $DRONE_WORKSPACE\n',
  102. 'ncpu=$(getconf _NPROCESSORS_ONLN)',
  103. 'ninja -j $ncpu install',
  104. 'ninja -j $ncpu rspamd-test',
  105. 'ninja -j $ncpu rspamd-test-cxx',
  106. ],
  107. } + rspamd_volumes,
  108. {
  109. name: 'build-clang',
  110. image: 'rspamd/ci:fedora-build',
  111. pull: 'always',
  112. depends_on: [
  113. 'prepare',
  114. ],
  115. commands: [
  116. 'test "$(id -un)" = nobody',
  117. 'cd /rspamd/fedora/build',
  118. "export LDFLAGS='-fuse-ld=lld'",
  119. 'export ASAN_OPTIONS=detect_leaks=0',
  120. 'cmake -DCMAKE_INSTALL_PREFIX=/rspamd/fedora/install -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_RULE_MESSAGES=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_CLANG_PLUGIN=ON -DENABLE_FULL_DEBUG=ON -DENABLE_HYPERSCAN=ON ' + hyperscan_altroot + ' -DSANITIZE=address $DRONE_WORKSPACE\n',
  121. 'ncpu=$(getconf _NPROCESSORS_ONLN)',
  122. 'make -j $ncpu install',
  123. 'make -j $ncpu rspamd-test',
  124. 'make -j $ncpu rspamd-test-cxx',
  125. ],
  126. } + rspamd_volumes,
  127. {
  128. name: 'rspamd-test',
  129. image: 'rspamd/ci:ubuntu-test',
  130. pull: 'always',
  131. depends_on: [
  132. 'build',
  133. ],
  134. commands: [
  135. 'test "$(id -un)" = nobody',
  136. 'ulimit -c unlimited',
  137. 'cd /rspamd/build/test',
  138. 'set +e',
  139. 'env RSPAMD_LUA_EXPENSIVE_TESTS=1 ./rspamd-test -p /rspamd/lua; EXIT_CODE=$?',
  140. 'set -e',
  141. "if [ $EXIT_CODE -gt 128 ]; then gdb --batch -ex 'thread apply all bt full' -c /var/tmp/*.rspamd-test.core ./rspamd-test; exit $EXIT_CODE; fi; if [ $EXIT_CODE -ne 0 ]; then exit $EXIT_CODE; fi\n",
  142. 'luacov-coveralls -o /rspamd/build/unit_test_lua.json --dryrun',
  143. 'set +e',
  144. './rspamd-test-cxx -s; EXIT_CODE=$?',
  145. 'set -e',
  146. "if [ $EXIT_CODE -gt 128 ]; then gdb --batch -ex 'thread apply all bt full' -c /var/tmp/*.rspamd-test-cxx.core ./rspamd-test-cxx; exit $EXIT_CODE; fi\n",
  147. 'exit $EXIT_CODE',
  148. ],
  149. } + rspamd_volumes,
  150. {
  151. name: 'test-fedora-clang',
  152. image: 'rspamd/ci:fedora-test',
  153. pull: 'always',
  154. depends_on: [
  155. 'build-clang',
  156. ],
  157. commands: [
  158. 'test "$(id -un)" = nobody',
  159. 'ulimit -c 2097152',
  160. 'ulimit -s unlimited',
  161. 'export ASAN_OPTIONS="detect_leaks=0:print_stacktrace=1:disable_coredump=0"',
  162. 'export UBSAN_OPTIONS="print_stacktrace=1:print_summary=0:log_path=/tmp/ubsan"',
  163. 'cd /rspamd/fedora/build/test',
  164. 'set +e',
  165. 'env RSPAMD_LUA_EXPENSIVE_TESTS=1 ./rspamd-test -p /rspamd/lua; EXIT_CODE=$?',
  166. 'set -e',
  167. "if [ $EXIT_CODE -gt 128 ]; then gdb --batch -ex 'bt' -c /var/tmp/*.rspamd-test.core ./rspamd-test; fi\n",
  168. 'set +e',
  169. './rspamd-test-cxx -s; EXIT_CODE=$?',
  170. 'set -e',
  171. "if [ $EXIT_CODE -gt 128 ]; then gdb --batch -ex 'thread apply all bt full' -c /var/tmp/*.rspamd-test-cxx.core ./rspamd-test-cxx; exit $EXIT_CODE; fi\n",
  172. 'cat /tmp/ubsan.* || true',
  173. 'exit $EXIT_CODE',
  174. ],
  175. } + rspamd_volumes,
  176. {
  177. name: 'functional',
  178. image: 'rspamd/ci:ubuntu-test-func',
  179. pull: 'always',
  180. depends_on: [
  181. 'build',
  182. ],
  183. commands: [
  184. 'cd /rspamd/build',
  185. 'ulimit -c unlimited',
  186. 'ulimit -s unlimited',
  187. 'umask 0000',
  188. 'set +e',
  189. 'RSPAMD_INSTALLROOT=/rspamd/install robot --removekeywords wuks --exclude isbroken $DRONE_WORKSPACE/test/functional/cases; EXIT_CODE=$?',
  190. 'set -e',
  191. 'if [ -n "$HTTP_PUT_AUTH" ]; then $DRONE_WORKSPACE/test/tools/http_put.py log.html report.html https://$DRONE_SYSTEM_HOSTNAME/testlogs/$DRONE_REPO/${DRONE_BUILD_NUMBER}-' + arch + '/; fi\n',
  192. "core_files=$(find /var/tmp/ -name '*.core')",
  193. "for core in $core_files; do exe=$(gdb --batch -ex 'info proc mappings' -c $core | tail -1 | awk '{print $5}'); gdb --batch -ex 'bt' -c $core $exe; echo '---'; done\n",
  194. 'exit $EXIT_CODE',
  195. ],
  196. environment: {
  197. HTTP_PUT_AUTH: {
  198. from_secret: 'http_put_auth',
  199. },
  200. },
  201. } + rspamd_volumes,
  202. {
  203. name: 'send-coverage',
  204. image: 'rspamd/ci:ubuntu-test',
  205. pull: 'if-not-exists',
  206. depends_on: [
  207. 'functional',
  208. 'rspamd-test',
  209. ],
  210. commands: [
  211. 'cd /rspamd/build',
  212. '$DRONE_WORKSPACE/test/tools/gcov_coveralls.py --exclude test --prefix /rspamd/build --prefix $DRONE_WORKSPACE --out coverage.c.json',
  213. 'luacov-coveralls -o coverage.functional.lua.json --dryrun',
  214. '$DRONE_WORKSPACE/test/tools/merge_coveralls.py --parallel --root $DRONE_WORKSPACE --input coverage.c.json unit_test_lua.json coverage.functional.lua.json --token=$COVERALLS_REPO_TOKEN',
  215. ],
  216. environment: {
  217. COVERALLS_REPO_TOKEN: {
  218. from_secret: 'coveralls_repo_token',
  219. },
  220. },
  221. } + coveralls_when + rspamd_volumes,
  222. ],
  223. volumes: [
  224. {
  225. name: 'rspamd',
  226. temp: {},
  227. },
  228. ],
  229. } + platform(arch) + default_trigger + docker_pipeline;
  230. local close_coveralls = {
  231. name: 'close_coveralls',
  232. depends_on: [
  233. 'default-amd64',
  234. 'default-arm64',
  235. ],
  236. steps: [
  237. {
  238. name: 'close_coveralls',
  239. image: 'rspamd/ci:ubuntu-test-func',
  240. pull: 'always',
  241. commands: [
  242. '$DRONE_WORKSPACE/test/tools/merge_coveralls.py --parallel-close --token=$COVERALLS_REPO_TOKEN',
  243. ],
  244. environment: {
  245. COVERALLS_REPO_TOKEN: {
  246. from_secret: 'coveralls_repo_token',
  247. },
  248. },
  249. },
  250. ],
  251. } + close_coveralls_trigger + docker_pipeline;
  252. local noarch_pipeline = {
  253. name: 'default-noarch',
  254. steps: [
  255. {
  256. name: 'perl-tidyall',
  257. image: 'rspamd/ci:perl-tidyall',
  258. pull: 'if-not-exists',
  259. failure: 'ignore',
  260. commands: [
  261. 'tidyall --version',
  262. 'perltidy --version | head -1',
  263. 'tidyall --all --check-only --no-cache --data-dir /tmp/tidyall',
  264. ],
  265. },
  266. {
  267. name: 'eslint',
  268. image: 'node:18-alpine',
  269. pull: 'if-not-exists',
  270. failure: 'ignore',
  271. commands: [
  272. 'npm install',
  273. './node_modules/.bin/eslint -v',
  274. './node_modules/.bin/eslint ./',
  275. './node_modules/.bin/stylelint -v',
  276. 'npm show stylelint-config-standard version',
  277. './node_modules/.bin/stylelint ./**/*.css ./**/*.html ./**/*.js',
  278. ],
  279. },
  280. {
  281. name: 'luacheck',
  282. image: 'pipelinecomponents/luacheck',
  283. pull: 'if-not-exists',
  284. commands: [
  285. 'luacheck -q --no-color .',
  286. ],
  287. },
  288. ],
  289. } + default_trigger + docker_pipeline;
  290. local signature = {
  291. kind: 'signature',
  292. hmac: '0000000000000000000000000000000000000000000000000000000000000000',
  293. };
  294. [
  295. pipeline('amd64'),
  296. pipeline('arm64'),
  297. close_coveralls,
  298. noarch_pipeline,
  299. notify_pipeline,
  300. signature,
  301. ]