Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
3dac444c
Commit
3dac444c
authored
Jun 30, 2016
by
Kamil Trzcinski
Committed by
Grzegorz Bizon
Jul 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix SimpleCov report merging
parent
070a96f5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
2 deletions
+38
-2
.gitlab-ci.yml
.gitlab-ci.yml
+2
-1
scripts/merge-simplecov
scripts/merge-simplecov
+36
-1
No files found.
.gitlab-ci.yml
View file @
3dac444c
...
@@ -74,7 +74,8 @@ update-coverage:
...
@@ -74,7 +74,8 @@ update-coverage:
artifacts
:
artifacts
:
expire_in
:
31d
expire_in
:
31d
paths
:
paths
:
-
coverage/
-
coverage/index.html
-
coverage/assets/
# Execute all testing suites
# Execute all testing suites
...
...
scripts/merge-simplecov
View file @
3dac444c
...
@@ -46,11 +46,42 @@ def all_results
...
@@ -46,11 +46,42 @@ def all_results
results
results
end
end
def
merge_resultset
(
a1
,
a2
)
return
a1
||
[]
unless
a2
return
a2
||
[]
unless
a1
new_array
=
a1
.
dup
a2
.
each_with_index
do
|
element
,
i
|
if
element
.
nil?
&&
new_array
[
i
].
nil?
new_array
[
i
]
=
nil
elsif
element
.
nil?
&&
new_array
[
i
]
==
0
||
element
==
0
&&
new_array
[
i
].
nil?
new_array
[
i
]
=
nil
else
local_value
=
element
||
0
other_value
=
new_array
[
i
]
||
0
new_array
[
i
]
=
local_value
+
other_value
end
end
new_array
end
def
merge_hashes
(
h1
,
h2
)
new_resultset
=
{}
(
h1
.
keys
+
h2
.
keys
).
each
do
|
filename
|
new_resultset
[
filename
]
=
[]
end
new_resultset
.
each_key
do
|
filename
|
new_resultset
[
filename
]
=
merge_resultset
(
h1
[
filename
],
h2
[
filename
])
end
new_resultset
end
def
merged_result
def
merged_result
merged
=
{}
merged
=
{}
results
=
all_results
results
=
all_results
results
.
each
do
|
result
|
results
.
each
do
|
result
|
merged
=
result
.
original_result
.
merge_resultset
(
merged
)
merged
=
merge_hashes
(
result
.
original_result
,
merged
)
end
end
result
=
SimpleCov
::
Result
.
new
(
merged
)
result
=
SimpleCov
::
Result
.
new
(
merged
)
# Specify the command name
# Specify the command name
...
@@ -58,6 +89,10 @@ def merged_result
...
@@ -58,6 +89,10 @@ def merged_result
result
result
end
end
# Ignore CI environment
ENV
[
'CI'
]
=
nil
ENV
[
'CI_BUILD_NAME'
]
=
nil
require_relative
'../spec/simplecov_env'
require_relative
'../spec/simplecov_env'
merged_result
.
format!
merged_result
.
format!
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment