align name of job in output
Signed-off-by: Casey Lee <cplee@nektos.com>
This commit is contained in:
parent
f8fb88816a
commit
60be2d67c1
1 changed files with 22 additions and 8 deletions
|
@ -2,6 +2,7 @@ package runner
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
||||||
"github.com/nektos/act/pkg/common"
|
"github.com/nektos/act/pkg/common"
|
||||||
|
@ -49,6 +50,16 @@ func New(runnerConfig *Config) (Runner, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (runner *runnerImpl) NewPlanExecutor(plan *model.Plan) common.Executor {
|
func (runner *runnerImpl) NewPlanExecutor(plan *model.Plan) common.Executor {
|
||||||
|
maxJobNameLen := 0
|
||||||
|
for _, stage := range plan.Stages {
|
||||||
|
for _, run := range stage.Runs {
|
||||||
|
jobNameLen := len(run.String())
|
||||||
|
if jobNameLen > maxJobNameLen {
|
||||||
|
maxJobNameLen = jobNameLen
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pipeline := make([]common.Executor, 0)
|
pipeline := make([]common.Executor, 0)
|
||||||
for _, stage := range plan.Stages {
|
for _, stage := range plan.Stages {
|
||||||
stageExecutor := make([]common.Executor, 0)
|
stageExecutor := make([]common.Executor, 0)
|
||||||
|
@ -93,8 +104,17 @@ func (runner *runnerImpl) NewPlanExecutor(plan *model.Plan) common.Executor {
|
||||||
matrixes = append(matrixes, make(map[string]interface{}))
|
matrixes = append(matrixes, make(map[string]interface{}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jobName := fmt.Sprintf("%-*s", maxJobNameLen, run.String())
|
||||||
for _, matrix := range matrixes {
|
for _, matrix := range matrixes {
|
||||||
stageExecutor = append(stageExecutor, runner.NewRunExecutor(run, matrix))
|
m := matrix
|
||||||
|
runExecutor := runner.NewRunExecutor(run, matrix)
|
||||||
|
stageExecutor = append(stageExecutor, func(ctx context.Context) error {
|
||||||
|
ctx = WithJobLogger(ctx, jobName)
|
||||||
|
if len(m) > 0 {
|
||||||
|
common.Logger(ctx).Infof("\U0001F9EA Matrix: %v", m)
|
||||||
|
}
|
||||||
|
return runExecutor(ctx)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pipeline = append(pipeline, common.NewParallelExecutor(stageExecutor...))
|
pipeline = append(pipeline, common.NewParallelExecutor(stageExecutor...))
|
||||||
|
@ -120,11 +140,5 @@ func (runner *runnerImpl) NewRunExecutor(run *model.Run, matrix map[string]inter
|
||||||
rc.StepResults = make(map[string]*stepResult)
|
rc.StepResults = make(map[string]*stepResult)
|
||||||
rc.Matrix = matrix
|
rc.Matrix = matrix
|
||||||
rc.ExprEval = rc.NewExpressionEvaluator()
|
rc.ExprEval = rc.NewExpressionEvaluator()
|
||||||
return func(ctx context.Context) error {
|
return rc.Executor()
|
||||||
ctx = WithJobLogger(ctx, rc.Run.String())
|
|
||||||
if len(rc.Matrix) > 0 {
|
|
||||||
common.Logger(ctx).Infof("\U0001F9EA Matrix: %v", rc.Matrix)
|
|
||||||
}
|
|
||||||
return rc.Executor()(ctx)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue