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.
Merge branch 'master' of github.com:oracle-dart/oracle.dart
- Loading branch information
Showing
7 changed files
with
127 additions
and
2 deletions.
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
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
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 |