Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Замер покрытия #98

Merged
merged 111 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 102 commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
3d63e57
add coverage
ovcharenko-di Jun 3, 2023
2658544
upd README
ovcharenko-di Jun 3, 2023
ca8c100
Update src/ru/pulsar/jenkins/library/configuration/SmokeTestOptions.g…
ovcharenko-di Jun 3, 2023
1f6c27f
fix paths
ovcharenko-di Jun 3, 2023
4930715
fix bdd
ovcharenko-di Jun 3, 2023
87cbb2c
fix paths
ovcharenko-di Jun 3, 2023
ab10d28
another fix
ovcharenko-di Jun 3, 2023
694b0d0
pick unused port for dbgs
ovcharenko-di Jun 12, 2023
3c0bb34
fix?
ovcharenko-di Jun 12, 2023
271dbf7
fix
ovcharenko-di Jun 12, 2023
5e2aedb
fix class
ovcharenko-di Jun 12, 2023
1b724e0
fix
ovcharenko-di Jun 12, 2023
85bd8e9
add class
ovcharenko-di Jun 12, 2023
48f9d26
fix returns
ovcharenko-di Jun 12, 2023
5d808f4
fix ports
ovcharenko-di Jun 12, 2023
9af1df9
make dbgs port const
ovcharenko-di Jun 12, 2023
1185844
add Coverage41C check
ovcharenko-di Jul 6, 2023
d6edb83
add lockable resources in bdd
ovcharenko-di Jul 17, 2023
ffe504b
fix
ovcharenko-di Jul 17, 2023
b5586b6
fix params
ovcharenko-di Jul 17, 2023
c956cb0
fix params
ovcharenko-di Jul 17, 2023
a527a24
finalize
ovcharenko-di Jul 17, 2023
98386df
fix type
ovcharenko-di Jul 17, 2023
41ff0eb
rm unused class
ovcharenko-di Jul 17, 2023
611dbc8
rm start return status
ovcharenko-di Aug 24, 2024
4f40096
add coverage for yaxunit, fix smoke dbgs port
ovcharenko-di Aug 25, 2024
47049ad
fix yaxunit coverage
ovcharenko-di Aug 25, 2024
d89a615
upd schema.json
ovcharenko-di Nov 17, 2024
dad3bad
upd global conf
ovcharenko-di Nov 19, 2024
d653ea0
fix
ovcharenko-di Nov 19, 2024
cc0c3fb
add coverage
ovcharenko-di Jun 3, 2023
79572e7
fix
ovcharenko-di Jun 12, 2023
8a892bc
fix class
ovcharenko-di Jun 12, 2023
29520e7
add class
ovcharenko-di Jun 12, 2023
a830c68
add lockable resources in bdd
ovcharenko-di Jul 17, 2023
f893c11
finalize
ovcharenko-di Jul 17, 2023
92f1dce
rm unused class
ovcharenko-di Jul 17, 2023
aa4aaa2
add coverage for yaxunit, fix smoke dbgs port
ovcharenko-di Aug 25, 2024
e6fdfc1
yaxunit coverage cleanup
ovcharenko-di Sep 1, 2024
5c7a6e0
fix
ovcharenko-di Sep 1, 2024
a7e4d3b
add smart cleanup in yaxunit
ovcharenko-di Sep 2, 2024
ea2b403
fix pids
ovcharenko-di Sep 2, 2024
3cbc404
fix pids
ovcharenko-di Sep 2, 2024
8c1a119
diagnostic message and fixes
ovcharenko-di Sep 2, 2024
c147ebb
toList
ovcharenko-di Sep 2, 2024
14268a1
switch pids from env to the file
ovcharenko-di Sep 3, 2024
494a535
refactor
ovcharenko-di Sep 3, 2024
7a5669e
fix merge
ovcharenko-di Nov 27, 2024
4b0bb1f
fixes
ovcharenko-di Nov 27, 2024
ab88f8f
add archive artifacts, logging, fix path to config
ovcharenko-di Nov 27, 2024
d53ae8d
fix path
ovcharenko-di Nov 27, 2024
719dac8
default info logging to console for yaxunit
ovcharenko-di Nov 27, 2024
3b87b09
fix lf
ovcharenko-di Nov 27, 2024
8c6d655
refactoring
ovcharenko-di Nov 27, 2024
a9eee5a
add coverage cleanup in bdd, smoke
ovcharenko-di Nov 27, 2024
fd5fcae
upd rm
ovcharenko-di Nov 28, 2024
d16b6ac
revert
ovcharenko-di Nov 28, 2024
6353e93
bump
ovcharenko-di Nov 28, 2024
bcd8f28
add md eol
ovcharenko-di Nov 29, 2024
0499510
simplify optional unstash
ovcharenko-di Nov 29, 2024
a7b557e
simplify lock step
ovcharenko-di Nov 29, 2024
e8e3db5
refactoring
ovcharenko-di Nov 29, 2024
77130fb
revert catchError
ovcharenko-di Nov 30, 2024
dcf3604
refactoring
ovcharenko-di Nov 30, 2024
a004277
int to Integer
ovcharenko-di Dec 1, 2024
20d0b05
refactoring
ovcharenko-di Dec 1, 2024
f758456
fixes
ovcharenko-di Dec 1, 2024
f17c9ae
Update src/ru/pulsar/jenkins/library/steps/WithCoverage.groovy
nixel2007 Dec 1, 2024
e711f86
refactoring and fixes
ovcharenko-di Dec 2, 2024
24231f9
fix bat
ovcharenko-di Dec 11, 2024
49c1f78
fix bat
ovcharenko-di Dec 11, 2024
5d8f710
fix crlf
ovcharenko-di Dec 11, 2024
91b6620
Fix returned value
nixel2007 Dec 11, 2024
6780bc6
escape caret
ovcharenko-di Dec 11, 2024
ce26f41
escape expr
ovcharenko-di Dec 11, 2024
7f4b7fa
revert ^^
ovcharenko-di Dec 11, 2024
bbd5238
fix start step
ovcharenko-di Dec 12, 2024
408bc1e
add logging in findDbgs
ovcharenko-di Dec 12, 2024
b44f4c6
find dbgs through file
ovcharenko-di Dec 12, 2024
e00e057
pass start params as is
ovcharenko-di Dec 12, 2024
89422b0
fix getPIDs commands
ovcharenko-di Dec 13, 2024
d8cd62f
revert quotes
ovcharenko-di Dec 13, 2024
0a78703
add logging to start step
ovcharenko-di Dec 13, 2024
8e4e76a
fix getPIDs again
ovcharenko-di Dec 13, 2024
1653b12
add /C
ovcharenko-di Dec 13, 2024
2126542
always exit 0
ovcharenko-di Dec 13, 2024
5327243
modify pid command
ovcharenko-di Dec 13, 2024
1376330
fix lambda
ovcharenko-di Dec 13, 2024
ad3b37e
upd README.md
ovcharenko-di Dec 15, 2024
db2f143
Apply suggestions from code review
ovcharenko-di Dec 15, 2024
326abf1
always return 0
ovcharenko-di Dec 15, 2024
9f816d6
revert deletion of tmp files, translate log messages
ovcharenko-di Dec 15, 2024
4d82101
Update src/ru/pulsar/jenkins/library/steps/CoverageContext.groovy
nixel2007 Dec 15, 2024
c7cb979
Apply suggestions from code review
nixel2007 Dec 15, 2024
c01f42d
rm exception
ovcharenko-di Dec 15, 2024
25dc5e4
fix quotes
ovcharenko-di Dec 15, 2024
ba1dd46
refactor coverage cleanup
ovcharenko-di Dec 16, 2024
28e38ba
fix stop
ovcharenko-di Dec 16, 2024
f670490
fix slug
ovcharenko-di Dec 16, 2024
ed94c84
rm archiveArtifacts
ovcharenko-di Dec 16, 2024
102ad0a
upd README.md
ovcharenko-di Dec 16, 2024
bcc368c
merge classes
ovcharenko-di Dec 16, 2024
92bff7a
Update src/ru/pulsar/jenkins/library/steps/WithCoverage.groovy
ovcharenko-di Dec 16, 2024
1650db1
Update README.md
ovcharenko-di Dec 16, 2024
8d98e1d
Update README.md
ovcharenko-di Dec 16, 2024
fd34d56
Update README.md
ovcharenko-di Dec 16, 2024
0740987
Update gdsl
nixel2007 Dec 19, 2024
917b5d7
JSON lf
nixel2007 Dec 19, 2024
62d6b3b
@Override
nixel2007 Dec 19, 2024
4d1ce54
Cleanup
nixel2007 Dec 19, 2024
42bbfc7
More tests
nixel2007 Dec 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*.groovy eol=lf
*.groovy eol=lf
*.md eol=lf
*.os eol=lf
557 changes: 311 additions & 246 deletions README.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions resources/dbgs.os
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#Использовать v8find
ovcharenko-di marked this conversation as resolved.
Show resolved Hide resolved

Сообщить(Платформа1С.ПутьКDBGS(АргументыКоманднойСтроки[0]));
16 changes: 13 additions & 3 deletions resources/globalConfiguration.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
"bdd": {
"vrunnerSteps": [
"vanessa --settings ./tools/vrunner.json"
]
],
"coverage": false,
"dbgsPort": 1550
},
"sonarqube": {
"sonarQubeInstallation": "",
Expand Down Expand Up @@ -83,13 +85,21 @@
"vrunnerSettings": "./tools/vrunner.json",
"xddConfigPath": "./tools/xUnitParams.json",
"publishToAllureReport": false,
"publishToJUnitReport": true
"publishToJUnitReport": true,
"coverage": false,
"dbgsPort": 1550
ovcharenko-di marked this conversation as resolved.
Show resolved Hide resolved
},
"coverage": {
"dbgsPath": "",
"coverage41CPath": "Coverage41C"
},
"yaxunit": {
"vrunnerSettings": "./tools/vrunner.json",
"configPath": "./tools/yaxunit.json",
"publishToAllureReport": false,
"publishToJUnitReport": true
"publishToJUnitReport": true,
"coverage": false,
"dbgsPort": 1550
},
"resultsTransform": {
"transformer": "stebi",
Expand Down
46 changes: 45 additions & 1 deletion resources/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@
"bdd" : {
"type" : "object",
"properties" : {
"coverage" : {
ovcharenko-di marked this conversation as resolved.
Show resolved Hide resolved
"type" : "boolean",
"description" : "Выполнять замер покрытия",
"default" : "false"
},
"dbgsPort" : {
"type" : "integer",
"description" : "Порт, на котором будет запущен сервер отладки для замера покрытия",
"default" : "1550"
},
"vrunnerSteps" : {
"description" : "Шаги, запускаемые через vrunner.\n В каждой строке передается отдельная команда \n vrunner и ее аргументы (например, \"vanessa --settings ./tools/vrunner.json\").\n По умолчанию содержит одну команду \"vanessa --settings ./tools/vrunner.json\".\n ",
"type" : "array",
Expand All @@ -38,6 +48,20 @@
},
"description" : "Настройки шага запуска BDD сценариев"
},
"coverage" : {
ovcharenko-di marked this conversation as resolved.
Show resolved Hide resolved
"type" : "object",
"properties" : {
"coverage41CPath" : {
"type" : "string",
"description" : "Путь к исполняемому файлу Coverage41C\n По умолчанию ищется в PATH.\n "
},
"dbgsPath" : {
"type" : "string",
"description" : "Путь к исполняемому файлу dbgs.\n По умолчанию ищется с помощью v8find для указанной версии платформы (v8version).\n "
}
},
"description" : "Настройки замеров покрытия"
},
"defaultBranch" : {
"type" : "string",
"description" : "Имя ветки по умолчанию. Значение по умолчанию - main."
Expand Down Expand Up @@ -223,6 +247,16 @@
"smoke" : {
"type" : "object",
"properties" : {
"coverage" : {
"type" : "boolean",
"description" : "Выполнять замер покрытия",
"default" : "false"
},
"dbgsPort" : {
ovcharenko-di marked this conversation as resolved.
Show resolved Hide resolved
"type" : "integer",
"description" : "Порт, на котором будет запущен сервер отладки для замера покрытия",
"default" : "1550"
},
"publishToAllureReport" : {
"type" : "boolean",
"description" : "Выполнять публикацию результатов в отчет Allure.\n По умолчанию выключено.\n "
Expand All @@ -249,7 +283,7 @@
"type" : "string",
"enum" : [ "auto", "fromEnv" ],
"description" : "Вариант конфигурации branch plugin.\n Поддерживаемые варианты:\n * auto - применяется автоконфигурация sonar-scanner силами branchplugin. Так же может применяться для отключения конфигурирования, если branch plugin отсутствует;\n * fromEnv - применяется ручная конфигурация sonar-scanner на основе переменных среды.\n Значение по умолчанию: fromEnv.",
"default" : "auto"
"default" : "fromEnv"
},
"infoBaseUpdateModuleName" : {
"type" : "string",
Expand Down Expand Up @@ -432,6 +466,16 @@
"type" : "string",
"description" : "Путь к конфигурационному файлу YAXUnit.\n По умолчанию содержит значение \"./tools/yaxunit.json\".\n "
},
"coverage" : {
"type" : "boolean",
"description" : "Выполнять замер покрытия",
"default" : "false"
},
"dbgsPort" : {
"type" : "integer",
"description" : "Порт, на котором будет запущен сервер отладки для замера покрытия",
"default" : "1550"
},
"publishToAllureReport" : {
"type" : "boolean",
"description" : "Выполнять публикацию результатов в отчет Allure.\n По умолчанию выключено.\n "
Expand Down
6 changes: 3 additions & 3 deletions resources/yaxunit.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"reportFormat": "jUnit",
"showReport": false,
"logging": {
"file": "./build/out/yaxunit/log.txt",
"enable": false,
"level": "debug"
"enable": true,
"console": true,
"level": "info"
},
"exitCode": "./build/out/yaxunit/result.txt"
}
13 changes: 13 additions & 0 deletions src/ru/pulsar/jenkins/library/IStepExecutor.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import jenkins.plugins.http_request.ResponseContentSupplier
import org.jenkinsci.plugins.pipeline.utility.steps.fs.FileWrapper
import org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction
import org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper
import ru.pulsar.jenkins.library.configuration.JobConfiguration
import ru.pulsar.jenkins.library.configuration.StepCoverageOptions
import ru.pulsar.jenkins.library.steps.Coverable

interface IStepExecutor {

Expand All @@ -20,6 +23,7 @@ interface IStepExecutor {

FileWrapper[] findFiles(String glob)

@SuppressWarnings('unused')
FileWrapper[] findFiles(String glob, String excludes)

String readFile(String file)
Expand All @@ -40,6 +44,8 @@ interface IStepExecutor {

def ringCommand(String script)

void start(String executable, String params)

void tool(String toolName)

def withCredentials(List bindings, Closure body)
Expand All @@ -64,6 +70,10 @@ interface IStepExecutor {

def withEnv(List<String> strings, Closure body)

def withCoverage(JobConfiguration config, Coverable stage, StepCoverageOptions options, Closure body)

def lock(String resource, Closure<Object> body)

def archiveArtifacts(String path)

def stash(String name, String includes)
Expand All @@ -76,14 +86,17 @@ interface IStepExecutor {

def zip(String dir, String zipFile)

@SuppressWarnings('unused')
def zip(String dir, String zipFile, String glob)

def unzip(String dir, String zipFile)

@SuppressWarnings('unused')
def unzip(String dir, String zipFile, quiet)

def catchError(Closure body)

@SuppressWarnings('unused')
ResponseContentSupplier httpRequest(String url, String outputFile, String responseHandle, boolean wrapAsMultipart)

ResponseContentSupplier httpRequest(String url, HttpMode httpMode, MimeType contentType, String requestBody, String validResponseCodes, boolean consoleLogResponseBody)
Expand Down
27 changes: 27 additions & 0 deletions src/ru/pulsar/jenkins/library/StepExecutor.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import jenkins.plugins.http_request.ResponseContentSupplier
import org.jenkinsci.plugins.pipeline.utility.steps.fs.FileWrapper
import org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction
import org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper
import ru.pulsar.jenkins.library.configuration.JobConfiguration
import ru.pulsar.jenkins.library.configuration.StepCoverageOptions
import ru.pulsar.jenkins.library.steps.Coverable
import ru.yandex.qatools.allure.jenkins.config.ResultsConfig

class StepExecutor implements IStepExecutor {
Expand Down Expand Up @@ -72,6 +75,18 @@ class StepExecutor implements IStepExecutor {
return steps.ringCommand(script)
}

@Override
void start(String executable, String params) {
if (executable == null || executable.trim().isEmpty()) {
throw new IllegalArgumentException("executable не может быть пустым")
}
try {
steps.start(executable, params)
} catch (Exception e) {
throw new RuntimeException("Ошибка при запуске процесса: ${e.message}", e)
}
}

@Override
void tool(String toolName) {
steps.tool toolName
Expand Down Expand Up @@ -144,6 +159,18 @@ class StepExecutor implements IStepExecutor {
}
}

@Override
def withCoverage(JobConfiguration config, Coverable stage, StepCoverageOptions options, Closure body) {
steps.withCoverage(config, stage, options, body)
}
ovcharenko-di marked this conversation as resolved.
Show resolved Hide resolved

@Override
def lock(String resource, Closure body) {
steps.lock(resource: resource) {
body()
}
}
ovcharenko-di marked this conversation as resolved.
Show resolved Hide resolved

@Override
def archiveArtifacts(String path) {
steps.archiveArtifacts path
Expand Down
6 changes: 4 additions & 2 deletions src/ru/pulsar/jenkins/library/configuration/BddOptions.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonPropertyDescription

@JsonIgnoreProperties(ignoreUnknown = true)
class BddOptions implements Serializable {
class BddOptions extends StepCoverageOptions implements Serializable {

@JsonPropertyDescription("""Шаги, запускаемые через vrunner.
В каждой строке передается отдельная команда
Expand All @@ -21,6 +21,8 @@ class BddOptions implements Serializable {
String toString() {
return "BddOptions{" +
"vrunnerSteps=" + vrunnerSteps +
'}';
"coverage=" + coverage +
"dbgsPort=" + dbgsPort +
'}'
ovcharenko-di marked this conversation as resolved.
Show resolved Hide resolved
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ import static java.util.Collections.emptySet
class ConfigurationReader implements Serializable {

private static ObjectMapper mapper
private static BeanUtilsBean beanUtilsBean;
private static BeanUtilsBean beanUtilsBean

static {
mapper = new ObjectMapper()
mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);
mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true)

beanUtilsBean = new BeanUtilsBean(new ConvertUtilsBean() {
@Override
@NonCPS
Object convert(String value, Class clazz) {
if (clazz.isEnum()) {
return Enum.valueOf(clazz, value);
return Enum.valueOf(clazz, value)
} else {
return super.convert(value, clazz);
return super.convert(value, clazz)
}
}
});
})
}

private static final String DEFAULT_CONFIGURATION_RESOURCE = 'globalConfiguration.json'
Expand All @@ -49,7 +49,7 @@ class ConfigurationReader implements Serializable {
def globalConfiguration = create()
def jobConfiguration = mapper.readValue(config, JobConfiguration.class)

return mergeConfigurations(globalConfiguration, jobConfiguration);
return mergeConfigurations(globalConfiguration, jobConfiguration)
}

private static JobConfiguration mergeConfigurations(
Expand All @@ -65,6 +65,7 @@ class ConfigurationReader implements Serializable {
"bddOptions",
"sonarQubeOptions",
"smokeTestOptions",
"coverageOptions",
"yaxunitOptions",
"syntaxCheckOptions",
"resultsTransformOptions",
Expand All @@ -84,7 +85,7 @@ class ConfigurationReader implements Serializable {
mergeSyntaxCheckOptions(baseConfiguration.syntaxCheckOptions, configurationToMerge.syntaxCheckOptions)
mergeNotificationsOptions(baseConfiguration.notificationsOptions, configurationToMerge.notificationsOptions)

return baseConfiguration;
return baseConfiguration
}

@NonCPS
Expand All @@ -95,7 +96,7 @@ class ConfigurationReader implements Serializable {
.filter({ e -> e.getKey() != "metaClass" })
.filter({ e -> !nonMergeableSettings.contains(e.getKey()) })
.forEach { e ->
beanUtilsBean.setProperty(baseObject, e.getKey(), e.getValue());
beanUtilsBean.setProperty(baseObject, e.getKey(), e.getValue())
}

nonMergeableSettings.forEach({ key ->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package ru.pulsar.jenkins.library.configuration

import com.cloudbees.groovy.cps.NonCPS
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonPropertyDescription

@JsonIgnoreProperties(ignoreUnknown = true)
class GlobalCoverageOptions implements Serializable {
ovcharenko-di marked this conversation as resolved.
Show resolved Hide resolved

@JsonPropertyDescription('''Путь к исполняемому файлу dbgs.
По умолчанию ищется с помощью v8find для указанной версии платформы (v8version).
''')
String dbgsPath

@JsonPropertyDescription('''Путь к исполняемому файлу Coverage41C
По умолчанию ищется в PATH.
''')
String coverage41CPath
ovcharenko-di marked this conversation as resolved.
Show resolved Hide resolved

@Override
@NonCPS
String toString() {
return "coverageOptions{" +
"dbgsPath=" + dbgsPath +
", coverage41CPath=" + coverage41CPath +
'}'
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ class JobConfiguration implements Serializable {
@JsonPropertyDescription("Настройки дымового тестирования")
SmokeTestOptions smokeTestOptions

@JsonProperty("coverage")
@JsonPropertyDescription("Настройки замеров покрытия")
GlobalCoverageOptions coverageOptions

@JsonProperty("yaxunit")
@JsonPropertyDescription("Настройки YAXUnit")
YaxunitOptions yaxunitOptions
Expand Down Expand Up @@ -89,6 +93,7 @@ class JobConfiguration implements Serializable {
", sonarQubeOptions=" + sonarQubeOptions +
", syntaxCheckOptions=" + syntaxCheckOptions +
", smokeTestOptions=" + smokeTestOptions +
", coverageOptions=" + coverageOptions +
", yaxunitOptions=" + yaxunitOptions +
", resultsTransformOptions=" + resultsTransformOptions +
", notificationOptions=" + notificationsOptions +
Expand Down
Loading
Loading