本文整理汇总了Golang中github.com/bitrise-io/stepman/models.StepInfoModel.Title方法的典型用法代码示例。如果您正苦于以下问题:Golang StepInfoModel.Title方法的具体用法?Golang StepInfoModel.Title怎么用?Golang StepInfoModel.Title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/bitrise-io/stepman/models.StepInfoModel
的用法示例。
在下文中一共展示了StepInfoModel.Title方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestPrintSummary
func TestPrintSummary(t *testing.T) {
PrintSummary(models.BuildRunResultsModel{})
stepInfo := stepmanModels.StepInfoModel{
Title: longStr,
Version: longStr,
}
result1 := models.StepRunResultsModel{
StepInfo: stepInfo,
Status: models.StepRunStatusCodeSuccess,
Idx: 0,
RunTime: 10000000,
Error: errors.New(longStr),
ExitCode: 1,
}
stepInfo.Title = ""
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)
}
示例2: TestPrintRunningStepFooter
func TestPrintRunningStepFooter(t *testing.T) {
stepInfo := stepmanModels.StepInfoModel{
Title: longStr,
Version: longStr,
}
result := models.StepRunResultsModel{
StepInfo: stepInfo,
Status: models.StepRunStatusCodeSuccess,
Idx: 0,
RunTime: 10000000,
Error: errors.New(longStr),
ExitCode: 1,
}
PrintRunningStepFooter(result, true)
PrintRunningStepFooter(result, false)
stepInfo.Title = ""
result = models.StepRunResultsModel{
StepInfo: stepInfo,
Status: models.StepRunStatusCodeSuccess,
Idx: 0,
RunTime: 0,
Error: nil,
ExitCode: 0,
}
PrintRunningStepFooter(result, true)
PrintRunningStepFooter(result, false)
}
示例3: TestGetRunningStepFooterMainSection
func TestGetRunningStepFooterMainSection(t *testing.T) {
stepInfo := stepmanModels.StepInfoModel{
Title: longStr,
Version: longStr,
}
result := models.StepRunResultsModel{
StepInfo: stepInfo,
Status: models.StepRunStatusCodeFailed,
Idx: 0,
RunTime: 10000000,
Error: errors.New(longStr),
ExitCode: 1,
}
cell := getRunningStepFooterMainSection(result)
require.Equal(t, "| 🚫 | \x1b[31;1mThis is a very long string,\nthis is a very ... (exit code: 1)\x1b[0m| 0.01 sec |", cell)
stepInfo.Title = ""
result = models.StepRunResultsModel{
StepInfo: stepInfo,
Status: models.StepRunStatusCodeSuccess,
Idx: 0,
RunTime: 0,
Error: nil,
ExitCode: 0,
}
cell = getRunningStepFooterMainSection(result)
require.Equal(t, "| ✅ | \x1b[32;1m\x1b[0m | 0.00 sec |", cell)
}
示例4: TestGetTrimmedStepName
func TestGetTrimmedStepName(t *testing.T) {
stepInfo := stepmanModels.StepInfoModel{
Title: 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 long string,\nthis is a very long string,\nth...", stepName)
stepInfo.Title = ""
result = models.StepRunResultsModel{
StepInfo: stepInfo,
Status: models.StepRunStatusCodeSuccess,
Idx: 0,
RunTime: 0,
Error: nil,
ExitCode: 0,
}
stepName = getTrimmedStepName(result)
require.Equal(t, "", stepName)
}
示例5: TestPrintRunningStepHeader
func TestPrintRunningStepHeader(t *testing.T) {
stepInfo := stepmanModels.StepInfoModel{
Title: "",
Version: "",
}
PrintRunningStepHeader(stepInfo, 0)
stepInfo.Title = longStr
stepInfo.Version = ""
PrintRunningStepHeader(stepInfo, 0)
stepInfo.Title = ""
stepInfo.Version = longStr
PrintRunningStepHeader(stepInfo, 0)
stepInfo.Title = longStr
stepInfo.Version = longStr
PrintRunningStepHeader(stepInfo, 0)
}
示例6: 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
// ------------------------------------------
// In function method - Registration methods, for register step run results.
registerStepRunResults := func(step stepmanModels.StepModel, stepInfoPtr stepmanModels.StepInfoModel,
stepIdxPtr int, runIf string, resultCode, exitCode int, err error, isLastStep, printStepHeader bool) {
if printStepHeader {
bitrise.PrintRunningStepHeader(stepInfoPtr, step, stepIdxPtr)
}
stepInfoCopy := stepmanModels.StepInfoModel{
ID: stepInfoPtr.ID,
Title: stepInfoPtr.Title,
Version: stepInfoPtr.Version,
Latest: stepInfoPtr.Latest,
SupportURL: stepInfoPtr.SupportURL,
SourceCodeURL: stepInfoPtr.SourceCodeURL,
GlobalInfo: stepInfoPtr.GlobalInfo,
}
stepResults := models.StepRunResultsModel{
StepInfo: stepInfoCopy,
Status: resultCode,
Idx: buildRunResults.ResultsCount(),
RunTime: time.Now().Sub(stepStartTime),
Error: err,
ExitCode: exitCode,
}
isExitStatusError := true
if err != nil {
isExitStatusError = errorutil.IsExitStatusError(err)
}
switch resultCode {
case models.StepRunStatusCodeSuccess:
buildRunResults.SuccessSteps = append(buildRunResults.SuccessSteps, stepResults)
break
case models.StepRunStatusCodeFailed:
if !isExitStatusError {
log.Errorf("Step (%s) failed, error: %s", stepInfoCopy.Title, err)
}
buildRunResults.FailedSteps = append(buildRunResults.FailedSteps, stepResults)
break
case models.StepRunStatusCodeFailedSkippable:
if !isExitStatusError {
log.Warnf("Step (%s) failed, but was marked as skippable, error: %s", stepInfoCopy.Title, err)
} else {
log.Warnf("Step (%s) failed, but was marked as skippable", stepInfoCopy.Title)
}
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.Title)
buildRunResults.SkippedSteps = append(buildRunResults.SkippedSteps, stepResults)
break
case models.StepRunStatusCodeSkippedWithRunIf:
log.Warn("The step's (" + stepInfoCopy.Title + ") 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.PrintRunningStepFooter(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 := stepmanModels.StepInfoModel{}
stepIdxPtr := idx
// 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(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr,
"", models.StepRunStatusCodeFailed, 1, err, isLastStep, true)
continue
}
//.........这里部分代码省略.........