Compare commits
12 Commits
1.0.8.post
...
1.0.8.post
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e5f0de5c4 | ||
|
|
99f38741fd | ||
|
|
eee2bf551c | ||
|
|
01ce809823 | ||
|
|
4ab70409a0 | ||
|
|
7b9752a17a | ||
|
|
879a7ca03d | ||
|
|
bd3389aeb2 | ||
|
|
886a22bef2 | ||
|
|
e9355471ba | ||
|
|
3bbbe946a1 | ||
|
|
cc2f6353ac |
56
Jenkinsfile
vendored
56
Jenkinsfile
vendored
@@ -6,7 +6,13 @@
|
||||
// You should have received a copy of the license along with this
|
||||
// work. If not, see <https://creativecommons.org/licenses/by-nc-sa/4.0/>.
|
||||
|
||||
|
||||
import groovy.xml.XmlUtil
|
||||
import static javax.xml.xpath.XPathConstants.*
|
||||
import javax.xml.xpath.*
|
||||
import groovy.xml.DOMBuilder
|
||||
import groovy.xml.dom.DOMCategory
|
||||
import java.math.RoundingMode
|
||||
import java.math.BigDecimal
|
||||
|
||||
// configurable settings:
|
||||
// use to send email if workflow problem
|
||||
@@ -28,6 +34,11 @@ def _MkDocsWebURL = "dabauto--mkdocs-web.dmz.chacha.home/mkdocs-web/"
|
||||
def _MkDocsWebCredentials = "2c5b684e-3787-4b37-8aca-b3dd4a383fe2"
|
||||
def _PypiCredentials = "Pypi"
|
||||
|
||||
|
||||
def badge_coverage = addEmbeddableBadgeConfiguration(id: "coverage", subject: "coverage")
|
||||
def badge_complexity = addEmbeddableBadgeConfiguration(id: "complexity", subject: "code complexity")
|
||||
def badge_quality = addEmbeddableBadgeConfiguration(id: "quality", subject: "quality score")
|
||||
|
||||
// commands Helper: /!\ Made for GITEA /!\
|
||||
String determineRepoUserName() {
|
||||
return scm.getUserRemoteConfigs()[0].getUrl().tokenize('/')[3].split("\\.")[0]
|
||||
@@ -63,6 +74,28 @@ String ExtractBaseVersion(inVersion) {
|
||||
return matcher[0][1]
|
||||
}
|
||||
|
||||
int GetCoverageValue(String CoverageFilePath,String XPath)
|
||||
{
|
||||
//File file = new File(CoverageFilePath)
|
||||
//coverageReportRaw = file.getText('UTF-8')
|
||||
coverageReportRaw = readFile(CoverageFilePath)
|
||||
coverageReport = DOMBuilder.parse(new StringReader(coverageReportRaw), false, false)
|
||||
coverageReportRoot = coverageReport.documentElement
|
||||
|
||||
def xpath = XPathFactory.newInstance().newXPath()
|
||||
res = xpath.evaluate(XPath,coverageReportRoot,NUMBER)
|
||||
return res
|
||||
}
|
||||
|
||||
int GetCoverageValue_lines_valid(String CoverageFilePath) { return GetCoverageValue(CoverageFilePath,"/coverage/@lines-valid") }
|
||||
int GetCoverageValue_lines_covered(String CoverageFilePath) { return GetCoverageValue(CoverageFilePath,"/coverage/@lines-covered") }
|
||||
int GetCoverageValue_line_rate(String CoverageFilePath) { return GetCoverageValue(CoverageFilePath,"/coverage/@line-rate") }
|
||||
int GetCoverageValue_branches_valid(String CoverageFilePath) { return GetCoverageValue(CoverageFilePath,"/coverage/@branches-valid") }
|
||||
int GetCoverageValue_branches_covered(String CoverageFilePath) { return GetCoverageValue(CoverageFilePath,"/coverage/@branches-covered") }
|
||||
int GetCoverageValue_branch_rate(String CoverageFilePath) { return GetCoverageValue(CoverageFilePath,"/coverage/@branch-rate") }
|
||||
int GetCoverageValue_complexity(String CoverageFilePath) { return GetCoverageValue(CoverageFilePath,"/coverage/@complexity") }
|
||||
|
||||
|
||||
pipeline {
|
||||
|
||||
// for Docker based build (preferable)
|
||||
@@ -334,6 +367,10 @@ pipeline {
|
||||
steps {
|
||||
dir("gitrepo") {
|
||||
sh(". ~/TEST_ENV/bin/activate && python -m helpers --type-check --quality-check")
|
||||
script {
|
||||
def jsonObj = readJSON file: "helpers-results/quality_check/metrics.json"
|
||||
badge_quality.setStatus(Float.toString(jsonObj["GlobalScore"]))
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
@@ -400,6 +437,23 @@ pipeline {
|
||||
println unit_test_full_name__html
|
||||
unit_test_full_name__xml=findFiles(glob: "helpers-results/unit_test_full/*.xml")[0].getName()
|
||||
println unit_test_full_name__xml
|
||||
|
||||
coverage_report_path = "helpers-results/unit_test_coverage/test_coverage.xml"
|
||||
println GetCoverageValue_lines_valid(coverage_report_path)
|
||||
println GetCoverageValue_lines_covered(coverage_report_path)
|
||||
println GetCoverageValue_line_rate(coverage_report_path)
|
||||
println GetCoverageValue_branches_valid(coverage_report_path)
|
||||
println GetCoverageValue_branches_covered(coverage_report_path)
|
||||
println GetCoverageValue_branch_rate(coverage_report_path)
|
||||
println GetCoverageValue_complexity(coverage_report_path)
|
||||
|
||||
full_rate = new BigDecimal( (GetCoverageValue_line_rate(coverage_report_path) + GetCoverageValue_branch_rate(coverage_report_path)) / 2 )
|
||||
sz_full_rate = Float.toString(full_rate.setScale(2, RoundingMode.HALF_EVEN))
|
||||
badge_coverage.setStatus(sz_full_rate)
|
||||
|
||||
complexity = new BigDecimal( GetCoverageValue_complexity(coverage_report_path))
|
||||
sz_complexity =Float.toString(complexity.setScale(2, RoundingMode.HALF_EVEN))
|
||||
badge_complexity.setStatus(sz_complexity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
Reference in New Issue
Block a user