@@ -5,11 +5,11 @@ import (
5
5
"encoding/json"
6
6
"fmt"
7
7
"os"
8
+ "runtime"
8
9
9
10
log "github.com/sirupsen/logrus"
10
11
11
12
"github.com/nektos/act/pkg/common"
12
- "github.com/nektos/act/pkg/container"
13
13
"github.com/nektos/act/pkg/model"
14
14
)
15
15
@@ -103,15 +103,45 @@ func (runner *runnerImpl) NewPlanExecutor(plan *model.Plan) common.Executor {
103
103
maxJobNameLen := 0
104
104
105
105
stagePipeline := make ([]common.Executor , 0 )
106
+ log .Debugf ("Plan Stages: %v" , plan .Stages )
107
+
106
108
for i := range plan .Stages {
107
109
stage := plan .Stages [i ]
108
110
stagePipeline = append (stagePipeline , func (ctx context.Context ) error {
109
111
pipeline := make ([]common.Executor , 0 )
110
112
for _ , run := range stage .Runs {
113
+ log .Debugf ("Stages Runs: %v" , stage .Runs )
111
114
stageExecutor := make ([]common.Executor , 0 )
112
115
job := run .Job ()
116
+ log .Debugf ("Job.Name: %v" , job .Name )
117
+ log .Debugf ("Job.RawNeeds: %v" , job .RawNeeds )
118
+ log .Debugf ("Job.RawRunsOn: %v" , job .RawRunsOn )
119
+ log .Debugf ("Job.Env: %v" , job .Env )
120
+ log .Debugf ("Job.If: %v" , job .If )
121
+ for step := range job .Steps {
122
+ if nil != job .Steps [step ] {
123
+ log .Debugf ("Job.Steps: %v" , job .Steps [step ].String ())
124
+ }
125
+ }
126
+ log .Debugf ("Job.TimeoutMinutes: %v" , job .TimeoutMinutes )
127
+ log .Debugf ("Job.Services: %v" , job .Services )
128
+ log .Debugf ("Job.Strategy: %v" , job .Strategy )
129
+ log .Debugf ("Job.RawContainer: %v" , job .RawContainer )
130
+ log .Debugf ("Job.Defaults.Run.Shell: %v" , job .Defaults .Run .Shell )
131
+ log .Debugf ("Job.Defaults.Run.WorkingDirectory: %v" , job .Defaults .Run .WorkingDirectory )
132
+ log .Debugf ("Job.Outputs: %v" , job .Outputs )
133
+ log .Debugf ("Job.Uses: %v" , job .Uses )
134
+ log .Debugf ("Job.With: %v" , job .With )
135
+ // log.Debugf("Job.RawSecrets: %v", job.RawSecrets)
136
+ log .Debugf ("Job.Result: %v" , job .Result )
113
137
114
138
if job .Strategy != nil {
139
+ log .Debugf ("Job.Strategy.FailFast: %v" , job .Strategy .FailFast )
140
+ log .Debugf ("Job.Strategy.MaxParallel: %v" , job .Strategy .MaxParallel )
141
+ log .Debugf ("Job.Strategy.FailFastString: %v" , job .Strategy .FailFastString )
142
+ log .Debugf ("Job.Strategy.MaxParallelString: %v" , job .Strategy .MaxParallelString )
143
+ log .Debugf ("Job.Strategy.RawMatrix: %v" , job .Strategy .RawMatrix )
144
+
115
145
strategyRc := runner .newRunContext (ctx , run , nil )
116
146
if err := strategyRc .NewExpressionEvaluator (ctx ).EvaluateYamlNode (ctx , & job .Strategy .RawMatrix ); err != nil {
117
147
log .Errorf ("Error while evaluating matrix: %v" , err )
@@ -122,6 +152,8 @@ func (runner *runnerImpl) NewPlanExecutor(plan *model.Plan) common.Executor {
122
152
if m , err := job .GetMatrixes (); err != nil {
123
153
log .Errorf ("Error while get job's matrix: %v" , err )
124
154
} else {
155
+ log .Debugf ("Job Matrices: %v" , m )
156
+ log .Debugf ("Runner Matrices: %v" , runner .config .Matrix )
125
157
matrixes = selectMatrixes (m , runner .config .Matrix )
126
158
}
127
159
log .Debugf ("Final matrix after applying user inclusions '%v'" , matrixes )
@@ -152,14 +184,11 @@ func (runner *runnerImpl) NewPlanExecutor(plan *model.Plan) common.Executor {
152
184
}
153
185
pipeline = append (pipeline , common .NewParallelExecutor (maxParallel , stageExecutor ... ))
154
186
}
155
- var ncpu int
156
- info , err := container .GetHostInfo (ctx )
157
- if err != nil {
158
- log .Errorf ("failed to obtain container engine info: %s" , err )
159
- ncpu = 1 // sane default?
160
- } else {
161
- ncpu = info .NCPU
187
+ ncpu := runtime .NumCPU ()
188
+ if 1 > ncpu {
189
+ ncpu = 1
162
190
}
191
+ log .Debugf ("Detected CPUs: %d" , ncpu )
163
192
return common .NewParallelExecutor (ncpu , pipeline ... )(ctx )
164
193
})
165
194
}
0 commit comments