aboutsummaryrefslogtreecommitdiffstats
path: root/.drone.yml
blob: 78f585fab0148939fd948e4161d037f6b41e07e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
workspace:
  base: /rspamd

pipeline:

  prepare:
    # ubuntu used as base image for build and test images
    # and we need to download it anyway
    image: ubuntu:18.04
    commands:
      - install -d -o nobody -g nogroup /rspamd/build /rspamd/install
      # lua-torch CMakeLists writes to src dir
      - chown nobody $CI_WORKSPACE/contrib/lua-torch/nn

  build:
    # https://github.com/rspamd/rspamd-build-docker/blob/master/ubuntu-build/Dockerfile
    image: rspamd/ci-ubuntu-build
    group: build
    commands:
      # build directories should be writable by nobody, for rspamd in functional tests
      # works as nobody and writes coverage files there
      - test "$(id -un)" = nobody
      - cd /rspamd/build
      - cmake $CI_WORKSPACE -DENABLE_COVERAGE=ON -DENABLE_LIBUNWIND=ON -DCMAKE_INSTALL_PREFIX=/rspamd/install -DCMAKE_RULE_MESSAGES=OFF
      - ncpu=$(getconf _NPROCESSORS_ONLN)
      - make -j $ncpu install
      - make -j $ncpu rspamd-test

  eslint:
    image: node:10-alpine
    group: build
    commands:
      - npm install
      - ./node_modules/.bin/eslint -v
      - ./node_modules/.bin/eslint ./

  rspamd-test:
    # https://github.com/rspamd/rspamd-build-docker/blob/master/ubuntu-test/Dockerfile
    image: rspamd/ci-ubuntu-test
    pull: true
    group: tests
    commands:
      - test "$(id -un)" = nobody
      # rspamd-test and functional test both use luacov.stats.out file and should be started from
      # different directories (if started in parallel)
      - cd /rspamd/build/test
      - set +e
      - ./rspamd-test -p /rspamd/lua; EXIT_CODE=$?
      - set -e
      # luacov-coveralls reads luacov.stats.out written by rspamd-test using luacov module
      # and writes json report for coveralls.io service
      - luacov-coveralls -o /rspamd/build/unit_test_lua.json --dryrun
      - cd /rspamd/build
      - coveralls --dump coverage.rspamd-test.dump
      - exit $EXIT_CODE

  functional:
    # https://github.com/rspamd/rspamd-build-docker/blob/master/ubuntu-test-func/Dockerfile
    image: rspamd/ci-ubuntu-test-func
    pull: true
    group: tests
    commands:
      - cd /rspamd/build
      # some rspamd processes during this test work as root and some as nobody
      # use umask to create world-writable files so nobody can write to *.gcda files created by root
      - umask 0000
      - set +e
      - RSPAMD_INSTALLROOT=/rspamd/install robot --xunit xunit.xml --exclude isbroken $CI_WORKSPACE/test/functional/cases; EXIT_CODE=$?
      - set -e
      - coveralls --dump coverage.functional.dump
      - exit $EXIT_CODE

  send-coverage:
    image: rspamd/ci-ubuntu-test
    secrets: [ coveralls_repo_token ]
    commands:
      - cd /rspamd/build
      - $CI_WORKSPACE/test/functional/util/merge_coveralls.py --input coverage.functional.dump coverage.rspamd-test.dump unit_test_lua.json lua_coverage_report.json --output out.josn --token=$COVERALLS_REPO_TOKEN
    when:
      branch: master
      # don't send coverage report for pull request
      event: [push, tag]

  send-test-log:
    image: drillster/drone-email
    from: noreply@rspamd.com
    attachment: /rspamd/build/log.html
    secrets: [email_host, email_username, email_password]
    when:
      status: failure