(ctx context.Context, t *testing.T, cfg *Config)
| 172 | } |
| 173 | |
| 174 | func (j *TestJobFileInfo) runTest(ctx context.Context, t *testing.T, cfg *Config) { |
| 175 | fmt.Printf("::group::%s\n", j.workflowPath) |
| 176 | |
| 177 | log.SetLevel(logLevel) |
| 178 | |
| 179 | workdir, err := filepath.Abs(j.workdir) |
| 180 | assert.Nil(t, err, workdir) |
| 181 | |
| 182 | fullWorkflowPath := filepath.Join(workdir, j.workflowPath) |
| 183 | runnerConfig := &Config{ |
| 184 | Workdir: workdir, |
| 185 | BindWorkdir: false, |
| 186 | EventName: j.eventName, |
| 187 | EventPath: cfg.EventPath, |
| 188 | Platforms: j.platforms, |
| 189 | ReuseContainers: false, |
| 190 | Env: cfg.Env, |
| 191 | Secrets: cfg.Secrets, |
| 192 | Inputs: cfg.Inputs, |
| 193 | GitHubInstance: "github.com", |
| 194 | ContainerArchitecture: cfg.ContainerArchitecture, |
| 195 | Matrix: cfg.Matrix, |
| 196 | ActionCache: cfg.ActionCache, |
| 197 | } |
| 198 | |
| 199 | runner, err := New(runnerConfig) |
| 200 | assert.Nil(t, err, j.workflowPath) |
| 201 | |
| 202 | planner, err := model.NewWorkflowPlanner(fullWorkflowPath, true, false) |
| 203 | if j.errorMessage != "" && err != nil { |
| 204 | assert.Error(t, err, j.errorMessage) |
| 205 | } else if assert.Nil(t, err, fullWorkflowPath) { |
| 206 | plan, err := planner.PlanEvent(j.eventName) |
| 207 | assert.True(t, (err == nil) != (plan == nil), "PlanEvent should return either a plan or an error") |
| 208 | if err == nil && plan != nil { |
| 209 | err = runner.NewPlanExecutor(plan)(ctx) |
| 210 | if j.errorMessage == "" { |
| 211 | assert.Nil(t, err, fullWorkflowPath) |
| 212 | } else { |
| 213 | assert.Error(t, err, j.errorMessage) |
| 214 | } |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | fmt.Println("::endgroup::") |
| 219 | } |
| 220 | |
| 221 | type TestConfig struct { |
| 222 | LocalRepositories map[string]string `yaml:"local-repositories"` |
no test coverage detected