aboutsummaryrefslogtreecommitdiffstats
path: root/.drone.yml
diff options
context:
space:
mode:
authorAnton Yuzhaninov <citrin+git@citrin.ru>2018-10-14 04:38:57 -0400
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-10-14 09:38:57 +0100
commitee0de908033cf7eb9b7cc1e4bee13793f61ffa24 (patch)
treece0b7035f33523f998ea19806642d9422f9abca7 /.drone.yml
parent6163b64177437d39a8e329fc3bbb7347b9f8fd99 (diff)
downloadrspamd-ee0de908033cf7eb9b7cc1e4bee13793f61ffa24.tar.gz
rspamd-ee0de908033cf7eb9b7cc1e4bee13793f61ffa24.zip
Drone coverage fix (#2592)
* Build as nobody This showld fix coverage files writing. At least some coverage files (*.gcda, *.gcno) are written by rspamd running as nobody. * Comment luacov-coveralls * Run rspamd-test as nobody too * Run coveralls from build root (/rspamd/build) It need to find all `.gcda` files. * Hack for coveralls was moved to Docker image * Add test debug * More debug * Workaround to writing *.gcda from different users *.gcda files written in parallel by root and by nobody * Remove debug * Use current build number instead of previous * Remove unused variable * Add more parameters - If CI detected we don't need to check if service_job_id and other fields in json already filled - this info anyway comes from environment - coveralls.io API is not documented. Code from: https://github.com/lemurheavy/coveralls-ruby/ and https://github.com/coveralls-clients/coveralls-python/ was used as an example. * In case of error there is no url in json respnse Print message field anyway - it can contain useful error message. * Add debug * Simplify * Fix: for pull request CI_BUILD_EVENT set to 'pull_request' * Remove debug
Diffstat (limited to '.drone.yml')
-rw-r--r--.drone.yml29
1 files changed, 22 insertions, 7 deletions
diff --git a/.drone.yml b/.drone.yml
index d3ee6bafb..78f585fab 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -4,12 +4,23 @@ workspace:
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:
- - mkdir /rspamd/build /rspamd/install
+ # 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)
@@ -27,32 +38,36 @@ pipeline:
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
- # coveralls dosn't support layout when object files are located outside git repo root
- # add hack to disable searching for git
- - ln -s /bin/true /usr/local/bin/git
- - coveralls --dump /rspamd/build/coverage.rspamd-test.dump
+ - 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 will not find git repo anyway, see above
- - ln -s /bin/true /usr/local/bin/git
- coveralls --dump coverage.functional.dump
- exit $EXIT_CODE