本文整理汇总了Golang中github.com/bitrise-io/bitrise/models.StepInfoModel类的典型用法代码示例。如果您正苦于以下问题:Golang StepInfoModel类的具体用法?Golang StepInfoModel怎么用?Golang StepInfoModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StepInfoModel类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestGetTrimmedStepName
func TestGetTrimmedStepName(t *testing.T) {
stepInfo := models.StepInfoModel{
ID: longStr,
Version: longStr,
}
result := models.StepRunResultsModel{
StepInfo: stepInfo,
Status: models.StepRunStatusCodeSuccess,
Idx: 0,
RunTime: 10000000,
Error: errors.New(longStr),
ExitCode: 1,
}
stepName := getTrimmedStepName(result)
require.Equal(t, "This is a very ... (...s a very long string.\n)", stepName)
stepInfo.ID = ""
result = models.StepRunResultsModel{
StepInfo: stepInfo,
Status: models.StepRunStatusCodeSuccess,
Idx: 0,
RunTime: 0,
Error: nil,
ExitCode: 0,
}
stepName = getTrimmedStepName(result)
require.Equal(t, " (...s a very long string.\n)", stepName)
}
开发者ID:bazscsa,项目名称:bitrise-cli,代码行数:31,代码来源:print_test.go
示例2: TestStepResultCell
func TestStepResultCell(t *testing.T) {
stepInfo := models.StepInfoModel{
ID: longStr,
Version: longStr,
}
result := models.StepRunResultsModel{
StepInfo: stepInfo,
Status: models.StepRunStatusCodeFailed,
Idx: 0,
RunTime: 10000000,
Error: errors.New(longStr),
ExitCode: 1,
}
cell := stepResultCell(result)
require.Equal(t, "| 🚫 | \x1b[31;1m... (...s a very long string.\n) (exit code: 1)\x1b[0m| 0.01 sec |", cell)
stepInfo.ID = ""
result = models.StepRunResultsModel{
StepInfo: stepInfo,
Status: models.StepRunStatusCodeSuccess,
Idx: 0,
RunTime: 0,
Error: nil,
ExitCode: 0,
}
cell = stepResultCell(result)
require.Equal(t, "| ✅ | \x1b[32;1m (...s a very long string.\n)\x1b[0m | 0.00 sec |", cell)
}
开发者ID:bazscsa,项目名称:bitrise-cli,代码行数:31,代码来源:print_test.go
示例3: TestPrintStepStatusList
func TestPrintStepStatusList(t *testing.T) {
PrintStepStatusList("", []models.StepRunResultsModel{})
stepInfo := models.StepInfoModel{
ID: longStr,
Version: longStr,
}
result1 := models.StepRunResultsModel{
StepInfo: stepInfo,
Status: models.StepRunStatusCodeSuccess,
Idx: 0,
RunTime: 10000000,
Error: errors.New(longStr),
ExitCode: 1,
}
stepInfo.ID = ""
result2 := models.StepRunResultsModel{
StepInfo: stepInfo,
Status: models.StepRunStatusCodeSuccess,
Idx: 0,
RunTime: 0,
Error: nil,
ExitCode: 0,
}
PrintStepStatusList(longStr, []models.StepRunResultsModel{result1, result2})
}
开发者ID:bazscsa,项目名称:bitrise-cli,代码行数:28,代码来源:print_test.go
示例4: TestPrintSummary
func TestPrintSummary(t *testing.T) {
PrintSummary(models.BuildRunResultsModel{})
stepInfo := models.StepInfoModel{
ID: longStr,
Version: longStr,
}
result1 := models.StepRunResultsModel{
StepInfo: stepInfo,
Status: models.StepRunStatusCodeSuccess,
Idx: 0,
RunTime: 10000000,
Error: errors.New(longStr),
ExitCode: 1,
}
stepInfo.ID = ""
result2 := models.StepRunResultsModel{
StepInfo: stepInfo,
Status: models.StepRunStatusCodeSuccess,
Idx: 0,
RunTime: 0,
Error: nil,
ExitCode: 0,
}
buildResults := models.BuildRunResultsModel{
StartTime: time.Now(),
StepmanUpdates: map[string]int{},
SuccessSteps: []models.StepRunResultsModel{result1, result2},
}
PrintSummary(buildResults)
}
开发者ID:bazscsa,项目名称:bitrise-cli,代码行数:35,代码来源:print_test.go
示例5: TestPrintStepSummary
func TestPrintStepSummary(t *testing.T) {
stepInfo := models.StepInfoModel{
ID: longStr,
Version: longStr,
}
result := models.StepRunResultsModel{
StepInfo: stepInfo,
Status: models.StepRunStatusCodeSuccess,
Idx: 0,
RunTime: 10000000,
Error: errors.New(longStr),
ExitCode: 1,
}
PrintStepSummary(result, true)
PrintStepSummary(result, false)
stepInfo.ID = ""
result = models.StepRunResultsModel{
StepInfo: stepInfo,
Status: models.StepRunStatusCodeSuccess,
Idx: 0,
RunTime: 0,
Error: nil,
ExitCode: 0,
}
PrintStepSummary(result, true)
PrintStepSummary(result, false)
}
开发者ID:bazscsa,项目名称:bitrise-cli,代码行数:29,代码来源:print_test.go
示例6: TestPrintRunningStep
func TestPrintRunningStep(t *testing.T) {
stepInfo := models.StepInfoModel{
ID: "",
Version: "",
}
PrintRunningStep(stepInfo, 0)
stepInfo.ID = longStr
stepInfo.Version = ""
PrintRunningStep(stepInfo, 0)
stepInfo.ID = ""
stepInfo.Version = longStr
PrintRunningStep(stepInfo, 0)
stepInfo.ID = longStr
stepInfo.Version = longStr
PrintRunningStep(stepInfo, 0)
}
开发者ID:bazscsa,项目名称:bitrise-cli,代码行数:19,代码来源:print_test.go
示例7: activateAndRunSteps
func activateAndRunSteps(workflow models.WorkflowModel, defaultStepLibSource string, buildRunResults models.BuildRunResultsModel, environments *[]envmanModels.EnvironmentItemModel, isLastWorkflow bool) models.BuildRunResultsModel {
log.Debugln("[BITRISE_CLI] - Activating and running steps")
// ------------------------------------------
// In function global variables - These are global for easy use in local register step run result methods.
var stepStartTime time.Time
// Holds pointer to current step info, for easy usage in local register step run result methods.
// The value is filled with the current running step info.
var stepInfoPtr models.StepInfoModel
// ------------------------------------------
// In function method - Registration methods, for register step run results.
registerStepRunResults := func(runIf string, resultCode, exitCode int, err error, isLastStep bool) {
stepInfoCopy := models.StepInfoModel{
ID: stepInfoPtr.ID,
Version: stepInfoPtr.Version,
Latest: stepInfoPtr.Latest,
}
stepResults := models.StepRunResultsModel{
StepInfo: stepInfoCopy,
Status: resultCode,
Idx: buildRunResults.ResultsCount(),
RunTime: time.Now().Sub(stepStartTime),
Error: err,
ExitCode: exitCode,
}
switch resultCode {
case models.StepRunStatusCodeSuccess:
buildRunResults.SuccessSteps = append(buildRunResults.SuccessSteps, stepResults)
break
case models.StepRunStatusCodeFailed:
log.Errorf("Step (%s) failed, error: (%v)", stepInfoCopy.ID, err)
buildRunResults.FailedSteps = append(buildRunResults.FailedSteps, stepResults)
break
case models.StepRunStatusCodeFailedSkippable:
log.Warnf("Step (%s) failed, but was marked as skippable, error: (%v)", stepInfoCopy.ID, err)
buildRunResults.FailedSkippableSteps = append(buildRunResults.FailedSkippableSteps, stepResults)
break
case models.StepRunStatusCodeSkipped:
log.Warnf("A previous step failed, and this step (%s) was not marked as IsAlwaysRun, skipped", stepInfoCopy.ID)
buildRunResults.SkippedSteps = append(buildRunResults.SkippedSteps, stepResults)
break
case models.StepRunStatusCodeSkippedWithRunIf:
log.Warn("The step's (" + stepInfoCopy.ID + ") Run-If expression evaluated to false - skipping")
if runIf != "" {
log.Info("The Run-If expression was: ", colorstring.Blue(runIf))
}
buildRunResults.SkippedSteps = append(buildRunResults.SkippedSteps, stepResults)
break
default:
log.Error("Unkown result code")
return
}
bitrise.PrintStepSummary(stepResults, isLastStep)
}
// ------------------------------------------
// Main - Preparing & running the steps
for idx, stepListItm := range workflow.Steps {
// Per step variables
stepStartTime = time.Now()
isLastStep := isLastWorkflow && (idx == len(workflow.Steps)-1)
stepInfoPtr = models.StepInfoModel{}
// Per step cleanup
if err := bitrise.SetBuildFailedEnv(buildRunResults.IsBuildFailed()); err != nil {
log.Error("Failed to set Build Status envs")
}
if err := bitrise.CleanupStepWorkDir(); err != nil {
registerStepRunResults("", models.StepRunStatusCodeFailed, 1, err, isLastStep)
continue
}
//
// Preparing the step
// Get step id & version data
compositeStepIDStr, workflowStep, err := models.GetStepIDStepDataPair(stepListItm)
stepInfoPtr.ID = compositeStepIDStr
if workflowStep.Title != nil && *workflowStep.Title != "" {
stepInfoPtr.ID = *workflowStep.Title
}
if err != nil {
registerStepRunResults("", models.StepRunStatusCodeFailed, 1, err, isLastStep)
continue
}
stepIDData, err := models.CreateStepIDDataFromString(compositeStepIDStr, defaultStepLibSource)
stepInfoPtr.ID = stepIDData.IDorURI
if workflowStep.Title != nil && *workflowStep.Title != "" {
stepInfoPtr.ID = *workflowStep.Title
}
stepInfoPtr.Version = stepIDData.Version
if err != nil {
registerStepRunResults("", models.StepRunStatusCodeFailed, 1, err, isLastStep)
//.........这里部分代码省略.........
开发者ID:bazscsa,项目名称:bitrise-cli,代码行数:101,代码来源:run_util.go
注:本文中的github.com/bitrise-io/bitrise/models.StepInfoModel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论