This repository has been archived by the owner on Jun 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit f1642c8 Author: Chris Lucas <chris@chrisjlucas.com> Date: Sun Aug 16 12:55:41 2015 -0700 Added logging commit e8713e5 Author: Chris Lucas <chris@chrisjlucas.com> Date: Sun Aug 16 12:54:29 2015 -0700 Added curl call commit 73e40b9 Author: Chris Lucas <chris@chrisjlucas.com> Date: Sun Aug 16 12:47:52 2015 -0700 Added support for repo_token commit e3a7796 Author: Chris Lucas <chris@chrisjlucas.com> Date: Sun Aug 16 12:41:45 2015 -0700 Add support for writing merged json commit 608ba78 Author: Chris Lucas <chris@chrisjlucas.com> Date: Sun Aug 16 12:31:31 2015 -0700 Remove test files from dart coverage commit a809622 Author: Chris Lucas <chris@chrisjlucas.com> Date: Sun Aug 16 12:27:08 2015 -0700 fixed cpp coveralls bin name commit 348adb6 Author: Chris Lucas <chris@chrisjlucas.com> Date: Sun Aug 16 12:25:50 2015 -0700 Added python commit 3b4d28c Author: Chris Lucas <chris@chrisjlucas.com> Date: Sun Aug 16 12:25:13 2015 -0700 Added scripts commit e2a26ec Author: Chris Lucas <chris@chrisjlucas.com> Date: Sun Aug 16 12:11:24 2015 -0700 Added coveralls merge commit da81dc8 Author: Chris Lucas <chris@chrisjlucas.com> Date: Sun Aug 16 11:43:32 2015 -0700 Deleted all_test.dart commit e30842b Author: Chris Lucas <chris@chrisjlucas.com> Date: Sun Aug 16 11:43:19 2015 -0700 Added COVERAGE flag commit 63413bd Author: Chris Lucas <chris@chrisjlucas.com> Date: Sun Aug 16 01:22:00 2015 -0700 Added metadata test commit 48ce038 Author: Chris Lucas <chris@chrisjlucas.com> Date: Sun Aug 16 01:20:08 2015 -0700 Initial coverage support
- Loading branch information
Showing
5 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ dependencies: | |
grinder: any | ||
logging: any | ||
test: any | ||
dart_coveralls: any |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/usr/bin/env python | ||
|
||
# | ||
# merges multiple coverall json reports into one | ||
# | ||
|
||
import json | ||
import os | ||
import sys | ||
|
||
def find_by_name(source_files_json, name): | ||
for j in source_files_json: | ||
if j['name'] == name: | ||
return j | ||
|
||
return None | ||
|
||
def merge_source_files(master, source): | ||
for sf in source: | ||
dest_sf = find_by_name(master, sf['name']) | ||
if dest_sf is None: | ||
master.append(sf) | ||
continue | ||
|
||
assert len(dest_sf['coverage']) == len(sf['coverage']) | ||
|
||
for i, line in enumerate(sf['coverage']): | ||
if line is None: | ||
continue | ||
|
||
if dest_sf['coverage'][i] is None: | ||
dest_sf['coverage'][i] = 0 | ||
|
||
|
||
dest_sf['coverage'][i] += line | ||
|
||
def get_json_from_file(fpath): | ||
with open(fpath, 'rb') as fp: | ||
return json.load(fp) | ||
|
||
def main(): | ||
if len(sys.argv) == 1: | ||
print("Usage: {0} <file1> <file2> <outfile>") | ||
return | ||
|
||
out = {} | ||
out['source_files'] = [] | ||
out['repo_token'] = os.environ['COVERALLS_TOKEN'] | ||
|
||
if out['repo_token'] is None: | ||
print("COVERALLS_TOKEN is not set") | ||
sys.exit(1) | ||
|
||
sources = [] | ||
|
||
for f in sys.argv[1:-1]: | ||
assert os.path.isfile(f) | ||
sources.append(get_json_from_file(f)) | ||
|
||
# pull git information | ||
for s in sources: | ||
for key in ['git', 'branch', 'remotes']: | ||
if key in s: | ||
out[key] = s[key] | ||
|
||
merge_source_files(out['source_files'], s['source_files']) | ||
|
||
|
||
with open(sys.argv[-1], 'wb') as fp: | ||
json.dump(out, fp) | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env python | ||
|
||
# | ||
# Scrape json from dart_coveralls because it's terrible and only dumps json to stdout | ||
# | ||
|
||
import sys | ||
|
||
def main(): | ||
lines = sys.stdin.readlines() | ||
|
||
for i, l in enumerate(lines): | ||
if l.startswith('{'): | ||
break | ||
|
||
for l in lines[i:]: | ||
print(l.strip("\r\n")) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
rm -rf coverage > /dev/null | ||
mkdir coverage | ||
|
||
for f in test/*_test.dart; do | ||
echo "Covering $f" | ||
dart_coveralls report -T --dry-run -p $f | python tool/scrape_json.py > coverage/$(basename $f).json | ||
done | ||
|
||
echo "Covering cpp" | ||
cpp-coveralls -b lib/src -t faketoken --dump coverage/cpp_coverage.json | ||
|
||
merged_json=coverage/merged.json | ||
echo "Merging coverage files" | ||
python tool/coveralls_merge.py coverage/* $merged_json | ||
|
||
echo 'Uploading to coveralls.io...' | ||
curl -v -F json_file=@$merged_json https://coveralls.io/api/v1/jobs |