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
Léo-Paul Géneau
gitlab-ce
Commits
647da42a
Commit
647da42a
authored
Jun 30, 2016
by
Kamil Trzcinski
Committed by
Grzegorz Bizon
Jul 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge coverage report
parent
ef30678f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
5 deletions
+83
-5
.gitlab-ci.yml
.gitlab-ci.yml
+11
-0
.simplecov
.simplecov
+0
-4
lib/tasks/ci/simplecov.rake
lib/tasks/ci/simplecov.rake
+63
-0
spec/spec_helper.rb
spec/spec_helper.rb
+9
-1
No files found.
.gitlab-ci.yml
View file @
647da42a
...
@@ -61,6 +61,15 @@ update-knapsack:
...
@@ -61,6 +61,15 @@ update-knapsack:
only
:
only
:
-
master
-
master
update-coverage
:
<<
:
*knapsack-state
stage
:
post-test
script
:
-
bundle exec rake ci:simplecov:merge
artifacts
:
paths
:
-
coverage/
# Execute all testing suites
# Execute all testing suites
.use-db
:
&use-db
.use-db
:
&use-db
...
@@ -83,6 +92,7 @@ update-knapsack:
...
@@ -83,6 +92,7 @@ update-knapsack:
artifacts
:
artifacts
:
paths
:
paths
:
-
knapsack/
-
knapsack/
-
coverage/
.spinach-knapsack
:
&spinach-knapsack
.spinach-knapsack
:
&spinach-knapsack
stage
:
test
stage
:
test
...
@@ -99,6 +109,7 @@ update-knapsack:
...
@@ -99,6 +109,7 @@ update-knapsack:
artifacts
:
artifacts
:
paths
:
paths
:
-
knapsack/
-
knapsack/
-
coverage/
rspec 0 20
:
*rspec-knapsack
rspec 0 20
:
*rspec-knapsack
rspec 1 20
:
*rspec-knapsack
rspec 1 20
:
*rspec-knapsack
...
...
.simplecov
deleted
100644 → 0
View file @
ef30678f
# .simplecov
SimpleCov.start 'rails' do
merge_timeout 3600
end
lib/tasks/ci/simplecov.rake
0 → 100644
View file @
647da42a
require
'simplecov'
namespace
:ci
do
namespace
:simplecov
do
desc
'GitLab CI | Merge all coverage results and generate report'
task
merge: :environment
do
merged_result
.
format!
end
private
def
read
(
file
)
return
unless
File
.
exist?
(
file
)
data
=
File
.
read
(
file
)
return
if
data
.
nil?
||
data
.
length
<
2
data
end
def
load
(
file
)
begin
JSON
.
parse
(
read
(
file
))
rescue
{}
end
end
def
files
Dir
.
glob
(
File
.
join
(
SimpleCov
.
coverage_path
,
'*/.resultset.json'
))
end
def
resultsfiles
files
.
map
{
|
file
|
load
(
file
)
}
end
def
resultsets
resultsfiles
.
reduce
({},
:merge
)
end
def
all_results
results
=
[]
resultsets
.
each
do
|
command_name
,
data
|
result
=
SimpleCov
::
Result
.
from_hash
(
command_name
=>
data
)
# Only add result if the timeout is above the configured threshold
if
(
Time
.
now
-
result
.
created_at
)
<
SimpleCov
.
merge_timeout
results
<<
result
end
end
results
end
def
merged_result
merged
=
{}
results
=
all_results
results
.
each
do
|
result
|
merged
=
result
.
original_result
.
merge_resultset
(
merged
)
end
result
=
SimpleCov
::
Result
.
new
(
merged
)
# Specify the command name
result
.
command_name
=
results
.
map
(
&
:command_name
).
sort
.
join
(
", "
)
result
end
end
end
spec/spec_helper.rb
View file @
647da42a
if
ENV
[
'SIMPLECOV'
]
if
ENV
[
'SIMPLECOV'
]
require
'simplecov'
require
'simplecov'
SimpleCov
.
start
:rails
require
'simplecov-rcov'
SimpleCov
.
start
:rails
do
if
ENV
[
'CI_BUILD_NAME'
]
coverage_dir
"coverage/
#{
ENV
[
'CI_BUILD_NAME'
]
}
"
command_name
ENV
[
'CI_BUILD_NAME'
]
merge_timeout
7200
end
end
end
end
ENV
[
"RAILS_ENV"
]
||=
'test'
ENV
[
"RAILS_ENV"
]
||=
'test'
...
...
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