diff options
author | Anton Yuzhaninov <citrin+git@citrin.ru> | 2018-10-14 04:38:57 -0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-10-14 09:38:57 +0100 |
commit | ee0de908033cf7eb9b7cc1e4bee13793f61ffa24 (patch) | |
tree | ce0b7035f33523f998ea19806642d9422f9abca7 /test/functional/util/merge_coveralls.py | |
parent | 6163b64177437d39a8e329fc3bbb7347b9f8fd99 (diff) | |
download | rspamd-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 'test/functional/util/merge_coveralls.py')
-rwxr-xr-x | test/functional/util/merge_coveralls.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/test/functional/util/merge_coveralls.py b/test/functional/util/merge_coveralls.py index e1498ac01..b19aa383b 100755 --- a/test/functional/util/merge_coveralls.py +++ b/test/functional/util/merge_coveralls.py @@ -63,7 +63,6 @@ def merge_coverage_vectors(c1, c2): def normalize_name(name): - orig_name = name name = os.path.normpath(name) if not os.path.isabs(name): name = os.path.abspath(repository_root + "/" + name) @@ -130,13 +129,19 @@ if __name__ == '__main__': if not j1['service_job_id'] and 'CIRCLE_BUILD_NUM' in os.environ: j1['service_job_id'] = os.environ['CIRCLE_BUILD_NUM'] - elif not j1['service_job_id'] and 'DRONE_PREV_BUILD_NUMBER' in os.environ: - j1['service_job_id'] = os.environ['DRONE_PREV_BUILD_NUMBER'] if 'CIRCLECI' in os.environ and os.environ['CIRCLECI']: j1['service_name'] = 'circleci' - elif 'DRONE' in os.environ and os.environ['DRONE']: + elif os.getenv('CI') == 'drone': j1['service_name'] = 'drone' + j1['service_branch'] = os.getenv('CI_COMMIT_BRANCH') + j1['service_build_url'] = os.getenv('DRONE_BUILD_LINK') + j1['service_job_id'] = os.getenv('CI_JOB_NUMBER') + j1['service_number'] = os.getenv('CI_BUILD_NUMBER') + j1['commit_sha'] = os.getenv('CI_COMMIT_SHA') + if os.getenv('CI_BUILD_EVENT') == 'pull_request': + j1['service_pull_request'] = os.getenv('CI_PULL_REQUEST') + j1['source_files'] = list(files.values()) @@ -147,8 +152,10 @@ if __name__ == '__main__': j1['repo_token'] = args.token print("sending data to coveralls...") r = requests.post('https://coveralls.io/api/v1/jobs', files={"json_file": json.dumps(j1)}) - response = json.loads(r.text) - print("uploaded %s\nmessage:%s" % (response['url'], response['message'])) + response = r.json() + print("[coveralls] %s" % response['message']) + if 'url' in response: + print("[coveralls] Uploaded to %s" % response['url']) # post https://coveralls.io/api/v1/jobs # print args |