Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
RagConnect
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JastAdd
RagConnect
Commits
42afd941
Commit
42afd941
authored
4 years ago
by
René Schöne
Browse files
Options
Downloads
Patches
Plain Diff
use jacoco for coverage
parent
58ad4788
No related branches found
No related tags found
1 merge request
!9
Draft: Resolve "Add coverage"
Pipeline
#9964
failed
4 years ago
Changes
3
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+14
-1
14 additions, 1 deletion
.gitlab-ci.yml
ragconnect.tests/build.gradle
+12
-0
12 additions, 0 deletions
ragconnect.tests/build.gradle
ragconnect.tests/extract-coverage-from-report.py
+8
-0
8 additions, 0 deletions
ragconnect.tests/extract-coverage-from-report.py
with
34 additions
and
1 deletion
.gitlab-ci.yml
+
14
−
1
View file @
42afd941
...
...
@@ -37,13 +37,26 @@ test:
needs
:
-
build
script
:
-
./gradlew --console=plain --no-daemon allTests
-
./gradlew --console=plain --no-daemon allTests
jacocoTestReport
artifacts
:
when
:
always
paths
:
-
"
ragconnect.tests/build/reports/jacoco/all-tests/jacoco*Report.xml"
reports
:
junit
:
"
ragconnect.tests/build/test-results/**/TEST-*.xml"
expire_in
:
1 week
extractCoverage
:
image
:
python:3.8-buster
stage
:
test
needs
:
-
test
script
:
-
pip install --user untangle
-
cd ragconnect.tests/
-
python extract-coverage-from-report.py
coverage
:
"
/Covered
(
\\
d{1,3}
\\
.
\\
d{2}%)
of
instructions
for
all
projects
\\
./"
publish
:
image
:
openjdk:11
stage
:
publish
...
...
This diff is collapsed.
Click to expand it.
ragconnect.tests/build.gradle
+
12
−
0
View file @
42afd941
...
...
@@ -22,6 +22,7 @@ plugins {
id
'idea'
id
'com.github.ben-manes.versions'
version
'0.36.0'
id
'com.google.protobuf'
version
"0.8.14"
id
'jacoco'
}
apply
plugin:
'jastadd'
...
...
@@ -83,6 +84,17 @@ protobuf {
}
}
jacocoTestReport
{
executionData
tasks
.
withType
(
Test
).
findAll
{
it
.
state
.
executed
}
getExecutionData
().
setFrom
(
fileTree
(
buildDir
).
include
(
"/jacoco/*.exec"
))
reports
{
xml
.
enabled
true
xml
.
destination
(
file
(
"${jacoco.reportsDir}/all-tests/jacocoAllTestReport.xml"
))
html
.
enabled
false
}
}
task
allTests
(
type:
Test
,
dependsOn:
testClasses
)
{
description
=
'Run every test'
group
=
'verification'
...
...
This diff is collapsed.
Click to expand it.
ragconnect.tests/extract-coverage-from-report.py
0 → 100644
+
8
−
0
View file @
42afd941
import
os
import
untangle
print
(
'
Current path:
'
+
os
.
path
.
abspath
(
os
.
curdir
))
obj
=
untangle
.
parse
(
'
build/reports/jacoco/test/jacocoTestReport.xml
'
)
instructions
=
[
o
for
o
in
obj
.
report
.
counter
if
o
[
'
type
'
]
==
'
INSTRUCTION
'
][
0
]
missed
,
covered
=
int
(
instructions
[
'
missed
'
]),
int
(
instructions
[
'
covered
'
])
# print missed / (missed + covered)
print
(
'
Covered %.2f%% of instructions for all projects.
'
%
(
missed
*
100.0
/
(
missed
+
covered
)))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment