rspamd/.drone.yml

193 lines
7.8 KiB
YAML
Raw Normal View 히스토리

Drone speedup (#2588) * Start switchind test to custom Docker images Using Docker images with pre-installed delendencies will speedup testing. * Debug build in drone.io * Use variable instead hardcoded path to the source * Debug variable substitution by drone Also according to comments in code DRONE_WORKSPACE is deprecated and CI_WORKSPACE is a new form. * One more try to use variables. It looks like drone uses same rules as docker-compose: https://docs.docker.com/compose/compose-file/#variable-substitution * Cleanup debug * Less verbose make output * Be consistent in variable escaping It works without escaping only becuse ${VAR} currently expanded by drone, but $VAR is not. * Use alpine base image for nodejs It is smaller. * Return rspamd-test * Revert variable escaping Wihtout escaping it is more easy to copy-past command for testing. Just don't use ${var} when var should be expanded by shell and not drone. * Add debug * Fix yaml parsing error * Fix exit code capture It should be done on the same line, because drone insert 'echo + cmd' between commands. * Remove debug * Readability No functional changes. * Return functional tests * Be consistent * Add git stub for coveralls * Send coverage * Fix yaml parsing error * Add links to Dockerfiles * Send test log in case of test failure XXX if rspamd-test failed, but functional was successful robot log will be attached (but not useful). * Don't run rspamd-test and functional tests in parallel It looks like there is a race condition in writing coverage files. * Try to run tests in parallel * Add debug * Fix parallel test run test/rspamd-test and functional test both use luacov.stats.out file in current directory. Run ./rspamd-test from anther directory. * Use drone condition for sending coveralls report Also don't send report if empty tocken was provided. * Add mininal python3 compatibility
2018-10-13 12:16:34 +02:00
---
2018-10-09 18:17:04 +02:00
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:
2018-10-30 01:51:31 +01:00
- install -d -o nobody -g nogroup /rspamd/build /rspamd/install /rspamd/fedora/build /rspamd/fedora/install
# lua-torch CMakeLists writes to src dir
- chown nobody $CI_WORKSPACE/contrib/lua-torch/nn
Fix coverage (#2603) * Add utility to prepare C coverage for upload to coveralls.io It turned out that it is more easy to write own script then debug and fix coveralls utility (https://github.com/eddyxu/cpp-coveralls). gcov-coveralls.py can be used as a replacement for coveralls. * Save coverage data from .gcda files only once Coverage data in .gcda files is merged after each binary invocation, so we can run all test and then gather coverage data. If we dump them two times execution counts will be more then they be. * Switch from coveralls (cpp-coveralls) to own script Problem with coveralls was, that coverage for source files outside build directory was not added to the report. * Add tool to dump info from json for coveralls.io * Add debug * Fix: don't die if there is no service_job_id in json * Debug * Fix dump_coveralls.py * Rename to gcov_coveralls.py (s/-/_/) For most files in this repo '_' is used as separator. * Don't add source code to coveralls JSON According to https://docs.coveralls.io/api-introduction Coverals don't need source code, only MD5 digest to tracks changes. Anyway source code is already added by luacov-coveralls and source_digest is added by cpp-coveralls and gcov_coveralls.py Both options seems to work for now. * Provide path to source directory to merge_coveralls.py merge_coveralls.py has code to filter files and remove prefixes. When --root points to source directory merge_coveralls.py can strip prefix from absolute path in JSONs generated by luacov-coveralls. * Style Don't add parameters with default values. * Make --output optional It useful mainly for debugging. We can send report without saving it. * Log CI_COMMIT_AUTHOR env var It is not clear from drone.io source how CI_COMMIT_AUTHOR variable is set. Log it to see what it means. * Move merge_coveralls.py to test/tools This script is used not only for funcional test coverage, but for rspamd-test coverage too. * Remove debug * Style Use more compact formatting. * Write comment about parallel tests running [SKIP CI] Document why running tests in parallel may be bad idea (but still do so). * Fix typo [SKIP CI]
2018-10-20 10:15:40 +02:00
# for debug
- echo $CI_COMMIT_AUTHOR
2018-10-09 18:17:04 +02:00
build:
Drone speedup (#2588) * Start switchind test to custom Docker images Using Docker images with pre-installed delendencies will speedup testing. * Debug build in drone.io * Use variable instead hardcoded path to the source * Debug variable substitution by drone Also according to comments in code DRONE_WORKSPACE is deprecated and CI_WORKSPACE is a new form. * One more try to use variables. It looks like drone uses same rules as docker-compose: https://docs.docker.com/compose/compose-file/#variable-substitution * Cleanup debug * Less verbose make output * Be consistent in variable escaping It works without escaping only becuse ${VAR} currently expanded by drone, but $VAR is not. * Use alpine base image for nodejs It is smaller. * Return rspamd-test * Revert variable escaping Wihtout escaping it is more easy to copy-past command for testing. Just don't use ${var} when var should be expanded by shell and not drone. * Add debug * Fix yaml parsing error * Fix exit code capture It should be done on the same line, because drone insert 'echo + cmd' between commands. * Remove debug * Readability No functional changes. * Return functional tests * Be consistent * Add git stub for coveralls * Send coverage * Fix yaml parsing error * Add links to Dockerfiles * Send test log in case of test failure XXX if rspamd-test failed, but functional was successful robot log will be attached (but not useful). * Don't run rspamd-test and functional tests in parallel It looks like there is a race condition in writing coverage files. * Try to run tests in parallel * Add debug * Fix parallel test run test/rspamd-test and functional test both use luacov.stats.out file in current directory. Run ./rspamd-test from anther directory. * Use drone condition for sending coveralls report Also don't send report if empty tocken was provided. * Add mininal python3 compatibility
2018-10-13 12:16:34 +02:00
# https://github.com/rspamd/rspamd-build-docker/blob/master/ubuntu-build/Dockerfile
image: rspamd/ci-ubuntu-build
2018-10-09 18:17:04 +02:00
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
Drone speedup (#2588) * Start switchind test to custom Docker images Using Docker images with pre-installed delendencies will speedup testing. * Debug build in drone.io * Use variable instead hardcoded path to the source * Debug variable substitution by drone Also according to comments in code DRONE_WORKSPACE is deprecated and CI_WORKSPACE is a new form. * One more try to use variables. It looks like drone uses same rules as docker-compose: https://docs.docker.com/compose/compose-file/#variable-substitution * Cleanup debug * Less verbose make output * Be consistent in variable escaping It works without escaping only becuse ${VAR} currently expanded by drone, but $VAR is not. * Use alpine base image for nodejs It is smaller. * Return rspamd-test * Revert variable escaping Wihtout escaping it is more easy to copy-past command for testing. Just don't use ${var} when var should be expanded by shell and not drone. * Add debug * Fix yaml parsing error * Fix exit code capture It should be done on the same line, because drone insert 'echo + cmd' between commands. * Remove debug * Readability No functional changes. * Return functional tests * Be consistent * Add git stub for coveralls * Send coverage * Fix yaml parsing error * Add links to Dockerfiles * Send test log in case of test failure XXX if rspamd-test failed, but functional was successful robot log will be attached (but not useful). * Don't run rspamd-test and functional tests in parallel It looks like there is a race condition in writing coverage files. * Try to run tests in parallel * Add debug * Fix parallel test run test/rspamd-test and functional test both use luacov.stats.out file in current directory. Run ./rspamd-test from anther directory. * Use drone condition for sending coveralls report Also don't send report if empty tocken was provided. * Add mininal python3 compatibility
2018-10-13 12:16:34 +02:00
- 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
2018-10-09 18:17:04 +02:00
2018-10-30 01:51:31 +01:00
build-clang:
# https://github.com/rspamd/rspamd-build-docker/blob/master/fedora-build/Dockerfile
image: rspamd/ci-fedora-build
pull: true
2018-10-30 01:51:31 +01:00
group: build
commands:
- test "$(id -un)" = nobody
- cd /rspamd/fedora/build
- export LDFLAGS='-fuse-ld=lld'
2018-11-14 01:41:52 +01:00
- export CFLAGS='-fsanitize=address,undefined,implicit-integer-truncation'
- export ASAN_OPTIONS=detect_leaks=0
2018-10-30 01:51:31 +01:00
- >
cmake
-DENABLE_CLANG_PLUGIN=ON
-DLLVM_CONFIG_BINARY=/usr/bin/llvm-config
-DENABLE_TORCH=OFF
2018-10-30 01:51:31 +01:00
-DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++
-DCMAKE_INSTALL_PREFIX=/rspamd/fedora/install
-DENABLE_FULL_DEBUG=ON
2018-10-30 01:51:31 +01:00
-DCMAKE_RULE_MESSAGES=OFF
$CI_WORKSPACE
- ncpu=$(getconf _NPROCESSORS_ONLN)
- make -j $ncpu install
- make -j $ncpu rspamd-test
2018-10-09 18:17:04 +02:00
eslint:
Drone speedup (#2588) * Start switchind test to custom Docker images Using Docker images with pre-installed delendencies will speedup testing. * Debug build in drone.io * Use variable instead hardcoded path to the source * Debug variable substitution by drone Also according to comments in code DRONE_WORKSPACE is deprecated and CI_WORKSPACE is a new form. * One more try to use variables. It looks like drone uses same rules as docker-compose: https://docs.docker.com/compose/compose-file/#variable-substitution * Cleanup debug * Less verbose make output * Be consistent in variable escaping It works without escaping only becuse ${VAR} currently expanded by drone, but $VAR is not. * Use alpine base image for nodejs It is smaller. * Return rspamd-test * Revert variable escaping Wihtout escaping it is more easy to copy-past command for testing. Just don't use ${var} when var should be expanded by shell and not drone. * Add debug * Fix yaml parsing error * Fix exit code capture It should be done on the same line, because drone insert 'echo + cmd' between commands. * Remove debug * Readability No functional changes. * Return functional tests * Be consistent * Add git stub for coveralls * Send coverage * Fix yaml parsing error * Add links to Dockerfiles * Send test log in case of test failure XXX if rspamd-test failed, but functional was successful robot log will be attached (but not useful). * Don't run rspamd-test and functional tests in parallel It looks like there is a race condition in writing coverage files. * Try to run tests in parallel * Add debug * Fix parallel test run test/rspamd-test and functional test both use luacov.stats.out file in current directory. Run ./rspamd-test from anther directory. * Use drone condition for sending coveralls report Also don't send report if empty tocken was provided. * Add mininal python3 compatibility
2018-10-13 12:16:34 +02:00
image: node:10-alpine
2018-10-09 18:17:04 +02:00
group: build
commands:
- npm install
Drone speedup (#2588) * Start switchind test to custom Docker images Using Docker images with pre-installed delendencies will speedup testing. * Debug build in drone.io * Use variable instead hardcoded path to the source * Debug variable substitution by drone Also according to comments in code DRONE_WORKSPACE is deprecated and CI_WORKSPACE is a new form. * One more try to use variables. It looks like drone uses same rules as docker-compose: https://docs.docker.com/compose/compose-file/#variable-substitution * Cleanup debug * Less verbose make output * Be consistent in variable escaping It works without escaping only becuse ${VAR} currently expanded by drone, but $VAR is not. * Use alpine base image for nodejs It is smaller. * Return rspamd-test * Revert variable escaping Wihtout escaping it is more easy to copy-past command for testing. Just don't use ${var} when var should be expanded by shell and not drone. * Add debug * Fix yaml parsing error * Fix exit code capture It should be done on the same line, because drone insert 'echo + cmd' between commands. * Remove debug * Readability No functional changes. * Return functional tests * Be consistent * Add git stub for coveralls * Send coverage * Fix yaml parsing error * Add links to Dockerfiles * Send test log in case of test failure XXX if rspamd-test failed, but functional was successful robot log will be attached (but not useful). * Don't run rspamd-test and functional tests in parallel It looks like there is a race condition in writing coverage files. * Try to run tests in parallel * Add debug * Fix parallel test run test/rspamd-test and functional test both use luacov.stats.out file in current directory. Run ./rspamd-test from anther directory. * Use drone condition for sending coveralls report Also don't send report if empty tocken was provided. * Add mininal python3 compatibility
2018-10-13 12:16:34 +02:00
- ./node_modules/.bin/eslint -v
- ./node_modules/.bin/eslint ./
2018-10-09 18:17:04 +02:00
# Run checks on perl source using tidyall
perl-tidyall:
# https://github.com/rspamd/rspamd-build-docker/blob/master/perl-tidyall/Dockerfile
image: rspamd/ci-perl-tidyall
group: build
commands:
# checks are configured in .tidyallrc at the top of rspamd repo
- tidyall --all --check-only --no-cache --data-dir /tmp/tidyall
Fix coverage (#2603) * Add utility to prepare C coverage for upload to coveralls.io It turned out that it is more easy to write own script then debug and fix coveralls utility (https://github.com/eddyxu/cpp-coveralls). gcov-coveralls.py can be used as a replacement for coveralls. * Save coverage data from .gcda files only once Coverage data in .gcda files is merged after each binary invocation, so we can run all test and then gather coverage data. If we dump them two times execution counts will be more then they be. * Switch from coveralls (cpp-coveralls) to own script Problem with coveralls was, that coverage for source files outside build directory was not added to the report. * Add tool to dump info from json for coveralls.io * Add debug * Fix: don't die if there is no service_job_id in json * Debug * Fix dump_coveralls.py * Rename to gcov_coveralls.py (s/-/_/) For most files in this repo '_' is used as separator. * Don't add source code to coveralls JSON According to https://docs.coveralls.io/api-introduction Coverals don't need source code, only MD5 digest to tracks changes. Anyway source code is already added by luacov-coveralls and source_digest is added by cpp-coveralls and gcov_coveralls.py Both options seems to work for now. * Provide path to source directory to merge_coveralls.py merge_coveralls.py has code to filter files and remove prefixes. When --root points to source directory merge_coveralls.py can strip prefix from absolute path in JSONs generated by luacov-coveralls. * Style Don't add parameters with default values. * Make --output optional It useful mainly for debugging. We can send report without saving it. * Log CI_COMMIT_AUTHOR env var It is not clear from drone.io source how CI_COMMIT_AUTHOR variable is set. Log it to see what it means. * Move merge_coveralls.py to test/tools This script is used not only for funcional test coverage, but for rspamd-test coverage too. * Remove debug * Style Use more compact formatting. * Write comment about parallel tests running [SKIP CI] Document why running tests in parallel may be bad idea (but still do so). * Fix typo [SKIP CI]
2018-10-20 10:15:40 +02:00
# We run rspamd-test (unit test) and functional test (runned by robot) in
# parallel to save time. To avoid conflict in saving lua coverage we run them
# from different directories. For C code coverage counters is saved to .gcda
# files and binary contain absolute path to them, so rspamd-test and
# processes started by functional test are writing to the same files. On
# process exit new coverage data merged with existing content of .gcda file.
# Race is possible if rspamd-test and some rspamd process in functional test
# will try to write .gcda file simultaneous. But it is very unlikely and
# performance is more important then correct coverage data.
2018-10-09 18:17:04 +02:00
rspamd-test:
Drone speedup (#2588) * Start switchind test to custom Docker images Using Docker images with pre-installed delendencies will speedup testing. * Debug build in drone.io * Use variable instead hardcoded path to the source * Debug variable substitution by drone Also according to comments in code DRONE_WORKSPACE is deprecated and CI_WORKSPACE is a new form. * One more try to use variables. It looks like drone uses same rules as docker-compose: https://docs.docker.com/compose/compose-file/#variable-substitution * Cleanup debug * Less verbose make output * Be consistent in variable escaping It works without escaping only becuse ${VAR} currently expanded by drone, but $VAR is not. * Use alpine base image for nodejs It is smaller. * Return rspamd-test * Revert variable escaping Wihtout escaping it is more easy to copy-past command for testing. Just don't use ${var} when var should be expanded by shell and not drone. * Add debug * Fix yaml parsing error * Fix exit code capture It should be done on the same line, because drone insert 'echo + cmd' between commands. * Remove debug * Readability No functional changes. * Return functional tests * Be consistent * Add git stub for coveralls * Send coverage * Fix yaml parsing error * Add links to Dockerfiles * Send test log in case of test failure XXX if rspamd-test failed, but functional was successful robot log will be attached (but not useful). * Don't run rspamd-test and functional tests in parallel It looks like there is a race condition in writing coverage files. * Try to run tests in parallel * Add debug * Fix parallel test run test/rspamd-test and functional test both use luacov.stats.out file in current directory. Run ./rspamd-test from anther directory. * Use drone condition for sending coveralls report Also don't send report if empty tocken was provided. * Add mininal python3 compatibility
2018-10-13 12:16:34 +02:00
# https://github.com/rspamd/rspamd-build-docker/blob/master/ubuntu-test/Dockerfile
image: rspamd/ci-ubuntu-test
pull: true
2018-10-09 18:17:04 +02:00
group: tests
commands:
- test "$(id -un)" = nobody
2018-10-16 18:42:16 +02:00
- ulimit -c unlimited
Drone speedup (#2588) * Start switchind test to custom Docker images Using Docker images with pre-installed delendencies will speedup testing. * Debug build in drone.io * Use variable instead hardcoded path to the source * Debug variable substitution by drone Also according to comments in code DRONE_WORKSPACE is deprecated and CI_WORKSPACE is a new form. * One more try to use variables. It looks like drone uses same rules as docker-compose: https://docs.docker.com/compose/compose-file/#variable-substitution * Cleanup debug * Less verbose make output * Be consistent in variable escaping It works without escaping only becuse ${VAR} currently expanded by drone, but $VAR is not. * Use alpine base image for nodejs It is smaller. * Return rspamd-test * Revert variable escaping Wihtout escaping it is more easy to copy-past command for testing. Just don't use ${var} when var should be expanded by shell and not drone. * Add debug * Fix yaml parsing error * Fix exit code capture It should be done on the same line, because drone insert 'echo + cmd' between commands. * Remove debug * Readability No functional changes. * Return functional tests * Be consistent * Add git stub for coveralls * Send coverage * Fix yaml parsing error * Add links to Dockerfiles * Send test log in case of test failure XXX if rspamd-test failed, but functional was successful robot log will be attached (but not useful). * Don't run rspamd-test and functional tests in parallel It looks like there is a race condition in writing coverage files. * Try to run tests in parallel * Add debug * Fix parallel test run test/rspamd-test and functional test both use luacov.stats.out file in current directory. Run ./rspamd-test from anther directory. * Use drone condition for sending coveralls report Also don't send report if empty tocken was provided. * Add mininal python3 compatibility
2018-10-13 12:16:34 +02:00
# 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=$?
2018-10-09 18:17:04 +02:00
- set -e
2018-10-16 20:53:21 +02:00
# shell sets exit status of a process terminated by a signal to '128 + signal-number'
# if rspamd-test was terminated by a signal it should be SIGSEGV or SIGABRT, try to examine core
2018-10-16 18:19:25 +02:00
- >
2018-10-16 21:14:50 +02:00
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;
2018-10-16 18:19:25 +02:00
fi
# luacov-coveralls reads luacov.stats.out written by rspamd-test using luacov module
# and writes json report for coveralls.io service
Drone speedup (#2588) * Start switchind test to custom Docker images Using Docker images with pre-installed delendencies will speedup testing. * Debug build in drone.io * Use variable instead hardcoded path to the source * Debug variable substitution by drone Also according to comments in code DRONE_WORKSPACE is deprecated and CI_WORKSPACE is a new form. * One more try to use variables. It looks like drone uses same rules as docker-compose: https://docs.docker.com/compose/compose-file/#variable-substitution * Cleanup debug * Less verbose make output * Be consistent in variable escaping It works without escaping only becuse ${VAR} currently expanded by drone, but $VAR is not. * Use alpine base image for nodejs It is smaller. * Return rspamd-test * Revert variable escaping Wihtout escaping it is more easy to copy-past command for testing. Just don't use ${var} when var should be expanded by shell and not drone. * Add debug * Fix yaml parsing error * Fix exit code capture It should be done on the same line, because drone insert 'echo + cmd' between commands. * Remove debug * Readability No functional changes. * Return functional tests * Be consistent * Add git stub for coveralls * Send coverage * Fix yaml parsing error * Add links to Dockerfiles * Send test log in case of test failure XXX if rspamd-test failed, but functional was successful robot log will be attached (but not useful). * Don't run rspamd-test and functional tests in parallel It looks like there is a race condition in writing coverage files. * Try to run tests in parallel * Add debug * Fix parallel test run test/rspamd-test and functional test both use luacov.stats.out file in current directory. Run ./rspamd-test from anther directory. * Use drone condition for sending coveralls report Also don't send report if empty tocken was provided. * Add mininal python3 compatibility
2018-10-13 12:16:34 +02:00
- luacov-coveralls -o /rspamd/build/unit_test_lua.json --dryrun
- exit $EXIT_CODE
2018-10-09 18:17:04 +02:00
2018-11-13 22:45:09 +01:00
test-fedora-clang:
# https://github.com/rspamd/rspamd-build-docker/blob/master/fedora-test/Dockerfile
image: rspamd/ci-fedora-test
pull: true
group: tests
commands:
- test "$(id -un)" = nobody
2018-11-14 01:41:52 +01:00
# Asan reserves 20Tb of virtual memory, limit core size to 2 Gb to avoid writing huge core
- ulimit -c 2097152
# disable leak sanitizer: too many leaks detected, most of them probably FP
- export ASAN_OPTIONS="detect_leaks=0:print_stacktrace=1:disable_coredump=0"
- export UBSAN_OPTIONS="print_stacktrace=1:print_summary=0:log_path=/tmp/ubsan"
2018-11-13 22:45:09 +01:00
- cd /rspamd/fedora/build/test
- set +e
- ./rspamd-test -p /rspamd/lua; EXIT_CODE=$?
- set -e
# shell sets exit status of a process terminated by a signal to '128 + signal-number'
# if rspamd-test was terminated by a signal it should be SIGSEGV or SIGABRT, try to examine core
- >
if [ $EXIT_CODE -gt 128 ]; then
gdb --batch -ex 'bt' -c /var/tmp/*.rspamd-test.core ./rspamd-test;
fi
2018-11-14 01:41:52 +01:00
- cat /tmp/ubsan.*
2018-11-13 22:45:09 +01:00
- exit $EXIT_CODE
2018-10-09 18:17:04 +02:00
functional:
Drone speedup (#2588) * Start switchind test to custom Docker images Using Docker images with pre-installed delendencies will speedup testing. * Debug build in drone.io * Use variable instead hardcoded path to the source * Debug variable substitution by drone Also according to comments in code DRONE_WORKSPACE is deprecated and CI_WORKSPACE is a new form. * One more try to use variables. It looks like drone uses same rules as docker-compose: https://docs.docker.com/compose/compose-file/#variable-substitution * Cleanup debug * Less verbose make output * Be consistent in variable escaping It works without escaping only becuse ${VAR} currently expanded by drone, but $VAR is not. * Use alpine base image for nodejs It is smaller. * Return rspamd-test * Revert variable escaping Wihtout escaping it is more easy to copy-past command for testing. Just don't use ${var} when var should be expanded by shell and not drone. * Add debug * Fix yaml parsing error * Fix exit code capture It should be done on the same line, because drone insert 'echo + cmd' between commands. * Remove debug * Readability No functional changes. * Return functional tests * Be consistent * Add git stub for coveralls * Send coverage * Fix yaml parsing error * Add links to Dockerfiles * Send test log in case of test failure XXX if rspamd-test failed, but functional was successful robot log will be attached (but not useful). * Don't run rspamd-test and functional tests in parallel It looks like there is a race condition in writing coverage files. * Try to run tests in parallel * Add debug * Fix parallel test run test/rspamd-test and functional test both use luacov.stats.out file in current directory. Run ./rspamd-test from anther directory. * Use drone condition for sending coveralls report Also don't send report if empty tocken was provided. * Add mininal python3 compatibility
2018-10-13 12:16:34 +02:00
# https://github.com/rspamd/rspamd-build-docker/blob/master/ubuntu-test-func/Dockerfile
image: rspamd/ci-ubuntu-test-func
pull: true
2018-10-09 18:17:04 +02:00
group: tests
commands:
- cd /rspamd/build
- ulimit -c unlimited
# 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 --removekeywords wuks --exclude isbroken $CI_WORKSPACE/test/functional/cases; EXIT_CODE=$?
- set -e
# upload test results to nginx frontent using WebDAV PUT
- >
if [ -n "$HTTP_PUT_AUTH" ]; then
$CI_WORKSPACE/test/tools/http_put.py log.html report.html $CI_SYSTEM_LINK/testlogs/$CI_REPO_NAME/$CI_BUILD_NUMBER/;
fi
# core_pattern=/var/tmp/%u.%e.core so one or two cores can be saved for each binary
- core_files=$(find /var/tmp/ -name '*.core')
# use 'info proc mappings' to find path to executable file for given core
# first mapping is usually program executable
- >
for core in $core_files;
do
exe=$(gdb --batch -ex 'info proc mappings' -c $core | awk 'h {print $5; exit}; /objfile/ {h=1}');
gdb --batch -ex 'bt' -c $core $exe; echo '---';
done
- exit $EXIT_CODE
secrets: [http_put_auth]
2018-10-09 18:17:04 +02:00
send-coverage:
Drone speedup (#2588) * Start switchind test to custom Docker images Using Docker images with pre-installed delendencies will speedup testing. * Debug build in drone.io * Use variable instead hardcoded path to the source * Debug variable substitution by drone Also according to comments in code DRONE_WORKSPACE is deprecated and CI_WORKSPACE is a new form. * One more try to use variables. It looks like drone uses same rules as docker-compose: https://docs.docker.com/compose/compose-file/#variable-substitution * Cleanup debug * Less verbose make output * Be consistent in variable escaping It works without escaping only becuse ${VAR} currently expanded by drone, but $VAR is not. * Use alpine base image for nodejs It is smaller. * Return rspamd-test * Revert variable escaping Wihtout escaping it is more easy to copy-past command for testing. Just don't use ${var} when var should be expanded by shell and not drone. * Add debug * Fix yaml parsing error * Fix exit code capture It should be done on the same line, because drone insert 'echo + cmd' between commands. * Remove debug * Readability No functional changes. * Return functional tests * Be consistent * Add git stub for coveralls * Send coverage * Fix yaml parsing error * Add links to Dockerfiles * Send test log in case of test failure XXX if rspamd-test failed, but functional was successful robot log will be attached (but not useful). * Don't run rspamd-test and functional tests in parallel It looks like there is a race condition in writing coverage files. * Try to run tests in parallel * Add debug * Fix parallel test run test/rspamd-test and functional test both use luacov.stats.out file in current directory. Run ./rspamd-test from anther directory. * Use drone condition for sending coveralls report Also don't send report if empty tocken was provided. * Add mininal python3 compatibility
2018-10-13 12:16:34 +02:00
image: rspamd/ci-ubuntu-test
2018-10-09 18:17:04 +02:00
secrets: [ coveralls_repo_token ]
Drone speedup (#2588) * Start switchind test to custom Docker images Using Docker images with pre-installed delendencies will speedup testing. * Debug build in drone.io * Use variable instead hardcoded path to the source * Debug variable substitution by drone Also according to comments in code DRONE_WORKSPACE is deprecated and CI_WORKSPACE is a new form. * One more try to use variables. It looks like drone uses same rules as docker-compose: https://docs.docker.com/compose/compose-file/#variable-substitution * Cleanup debug * Less verbose make output * Be consistent in variable escaping It works without escaping only becuse ${VAR} currently expanded by drone, but $VAR is not. * Use alpine base image for nodejs It is smaller. * Return rspamd-test * Revert variable escaping Wihtout escaping it is more easy to copy-past command for testing. Just don't use ${var} when var should be expanded by shell and not drone. * Add debug * Fix yaml parsing error * Fix exit code capture It should be done on the same line, because drone insert 'echo + cmd' between commands. * Remove debug * Readability No functional changes. * Return functional tests * Be consistent * Add git stub for coveralls * Send coverage * Fix yaml parsing error * Add links to Dockerfiles * Send test log in case of test failure XXX if rspamd-test failed, but functional was successful robot log will be attached (but not useful). * Don't run rspamd-test and functional tests in parallel It looks like there is a race condition in writing coverage files. * Try to run tests in parallel * Add debug * Fix parallel test run test/rspamd-test and functional test both use luacov.stats.out file in current directory. Run ./rspamd-test from anther directory. * Use drone condition for sending coveralls report Also don't send report if empty tocken was provided. * Add mininal python3 compatibility
2018-10-13 12:16:34 +02:00
commands:
- cd /rspamd/build
Fix coverage (#2603) * Add utility to prepare C coverage for upload to coveralls.io It turned out that it is more easy to write own script then debug and fix coveralls utility (https://github.com/eddyxu/cpp-coveralls). gcov-coveralls.py can be used as a replacement for coveralls. * Save coverage data from .gcda files only once Coverage data in .gcda files is merged after each binary invocation, so we can run all test and then gather coverage data. If we dump them two times execution counts will be more then they be. * Switch from coveralls (cpp-coveralls) to own script Problem with coveralls was, that coverage for source files outside build directory was not added to the report. * Add tool to dump info from json for coveralls.io * Add debug * Fix: don't die if there is no service_job_id in json * Debug * Fix dump_coveralls.py * Rename to gcov_coveralls.py (s/-/_/) For most files in this repo '_' is used as separator. * Don't add source code to coveralls JSON According to https://docs.coveralls.io/api-introduction Coverals don't need source code, only MD5 digest to tracks changes. Anyway source code is already added by luacov-coveralls and source_digest is added by cpp-coveralls and gcov_coveralls.py Both options seems to work for now. * Provide path to source directory to merge_coveralls.py merge_coveralls.py has code to filter files and remove prefixes. When --root points to source directory merge_coveralls.py can strip prefix from absolute path in JSONs generated by luacov-coveralls. * Style Don't add parameters with default values. * Make --output optional It useful mainly for debugging. We can send report without saving it. * Log CI_COMMIT_AUTHOR env var It is not clear from drone.io source how CI_COMMIT_AUTHOR variable is set. Log it to see what it means. * Move merge_coveralls.py to test/tools This script is used not only for funcional test coverage, but for rspamd-test coverage too. * Remove debug * Style Use more compact formatting. * Write comment about parallel tests running [SKIP CI] Document why running tests in parallel may be bad idea (but still do so). * Fix typo [SKIP CI]
2018-10-20 10:15:40 +02:00
# extract coverage data for C code from .gcda files and save it in a format suitable for coveralls.io
- $CI_WORKSPACE/test/tools/gcov_coveralls.py --exclude test --prefix /rspamd/build --prefix $CI_WORKSPACE --out coverage.c.json
# luacov-coveralls reads luacov.stats.out generated by functional tests
# (see collect_lua_coverage() in test/functional/lib/rspamd.py)
# and writes json report for coveralls.io
- luacov-coveralls -o coverage.functional.lua.json --dryrun
Fix coverage (#2603) * Add utility to prepare C coverage for upload to coveralls.io It turned out that it is more easy to write own script then debug and fix coveralls utility (https://github.com/eddyxu/cpp-coveralls). gcov-coveralls.py can be used as a replacement for coveralls. * Save coverage data from .gcda files only once Coverage data in .gcda files is merged after each binary invocation, so we can run all test and then gather coverage data. If we dump them two times execution counts will be more then they be. * Switch from coveralls (cpp-coveralls) to own script Problem with coveralls was, that coverage for source files outside build directory was not added to the report. * Add tool to dump info from json for coveralls.io * Add debug * Fix: don't die if there is no service_job_id in json * Debug * Fix dump_coveralls.py * Rename to gcov_coveralls.py (s/-/_/) For most files in this repo '_' is used as separator. * Don't add source code to coveralls JSON According to https://docs.coveralls.io/api-introduction Coverals don't need source code, only MD5 digest to tracks changes. Anyway source code is already added by luacov-coveralls and source_digest is added by cpp-coveralls and gcov_coveralls.py Both options seems to work for now. * Provide path to source directory to merge_coveralls.py merge_coveralls.py has code to filter files and remove prefixes. When --root points to source directory merge_coveralls.py can strip prefix from absolute path in JSONs generated by luacov-coveralls. * Style Don't add parameters with default values. * Make --output optional It useful mainly for debugging. We can send report without saving it. * Log CI_COMMIT_AUTHOR env var It is not clear from drone.io source how CI_COMMIT_AUTHOR variable is set. Log it to see what it means. * Move merge_coveralls.py to test/tools This script is used not only for funcional test coverage, but for rspamd-test coverage too. * Remove debug * Style Use more compact formatting. * Write comment about parallel tests running [SKIP CI] Document why running tests in parallel may be bad idea (but still do so). * Fix typo [SKIP CI]
2018-10-20 10:15:40 +02:00
# * merge coverage for C and Lua code
# * remove prefixes from absolute paths (in luacov-coveralls files), filter test, contrib, e. t.c
# * upload report to coveralls.io
- $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
Drone speedup (#2588) * Start switchind test to custom Docker images Using Docker images with pre-installed delendencies will speedup testing. * Debug build in drone.io * Use variable instead hardcoded path to the source * Debug variable substitution by drone Also according to comments in code DRONE_WORKSPACE is deprecated and CI_WORKSPACE is a new form. * One more try to use variables. It looks like drone uses same rules as docker-compose: https://docs.docker.com/compose/compose-file/#variable-substitution * Cleanup debug * Less verbose make output * Be consistent in variable escaping It works without escaping only becuse ${VAR} currently expanded by drone, but $VAR is not. * Use alpine base image for nodejs It is smaller. * Return rspamd-test * Revert variable escaping Wihtout escaping it is more easy to copy-past command for testing. Just don't use ${var} when var should be expanded by shell and not drone. * Add debug * Fix yaml parsing error * Fix exit code capture It should be done on the same line, because drone insert 'echo + cmd' between commands. * Remove debug * Readability No functional changes. * Return functional tests * Be consistent * Add git stub for coveralls * Send coverage * Fix yaml parsing error * Add links to Dockerfiles * Send test log in case of test failure XXX if rspamd-test failed, but functional was successful robot log will be attached (but not useful). * Don't run rspamd-test and functional tests in parallel It looks like there is a race condition in writing coverage files. * Try to run tests in parallel * Add debug * Fix parallel test run test/rspamd-test and functional test both use luacov.stats.out file in current directory. Run ./rspamd-test from anther directory. * Use drone condition for sending coveralls report Also don't send report if empty tocken was provided. * Add mininal python3 compatibility
2018-10-13 12:16:34 +02:00
when:
branch: master
# don't send coverage report for pull request
event: [push, tag]
2018-10-09 18:17:04 +02:00
notify:
Drone speedup (#2588) * Start switchind test to custom Docker images Using Docker images with pre-installed delendencies will speedup testing. * Debug build in drone.io * Use variable instead hardcoded path to the source * Debug variable substitution by drone Also according to comments in code DRONE_WORKSPACE is deprecated and CI_WORKSPACE is a new form. * One more try to use variables. It looks like drone uses same rules as docker-compose: https://docs.docker.com/compose/compose-file/#variable-substitution * Cleanup debug * Less verbose make output * Be consistent in variable escaping It works without escaping only becuse ${VAR} currently expanded by drone, but $VAR is not. * Use alpine base image for nodejs It is smaller. * Return rspamd-test * Revert variable escaping Wihtout escaping it is more easy to copy-past command for testing. Just don't use ${var} when var should be expanded by shell and not drone. * Add debug * Fix yaml parsing error * Fix exit code capture It should be done on the same line, because drone insert 'echo + cmd' between commands. * Remove debug * Readability No functional changes. * Return functional tests * Be consistent * Add git stub for coveralls * Send coverage * Fix yaml parsing error * Add links to Dockerfiles * Send test log in case of test failure XXX if rspamd-test failed, but functional was successful robot log will be attached (but not useful). * Don't run rspamd-test and functional tests in parallel It looks like there is a race condition in writing coverage files. * Try to run tests in parallel * Add debug * Fix parallel test run test/rspamd-test and functional test both use luacov.stats.out file in current directory. Run ./rspamd-test from anther directory. * Use drone condition for sending coveralls report Also don't send report if empty tocken was provided. * Add mininal python3 compatibility
2018-10-13 12:16:34 +02:00
image: drillster/drone-email
from: noreply@rspamd.com
secrets: [email_host, email_username, email_password]
when:
status: failure