1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-11 17:50:58 +00:00

refactor: export and move shared contexts into pkg/model (#931)

This commit moves the githubContext, jobContext and stepResult structs
from the runner package to the model package in preparation for #908
because the expression.go file lives in the runner package and would
introduce cyclic dependencies with the exprparser package.

Co-authored-by: Markus Wolf <markus.wolf@new-work.se>

Co-authored-by: Markus Wolf <markus.wolf@new-work.se>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Björn Brauer 2021-12-22 20:52:09 +01:00 committed by GitHub
parent 3256d7984e
commit 4920c29312
10 changed files with 132 additions and 124 deletions

View file

@ -47,24 +47,24 @@ func TestEvaluate(t *testing.T) {
"os": "Linux",
"foo": "bar",
},
StepResults: map[string]*stepResult{
StepResults: map[string]*model.StepResult{
"idwithnothing": {
Conclusion: stepStatusSuccess,
Outcome: stepStatusFailure,
Conclusion: model.StepStatusSuccess,
Outcome: model.StepStatusFailure,
Outputs: map[string]string{
"foowithnothing": "barwithnothing",
},
},
"id-with-hyphens": {
Conclusion: stepStatusSuccess,
Outcome: stepStatusFailure,
Conclusion: model.StepStatusSuccess,
Outcome: model.StepStatusFailure,
Outputs: map[string]string{
"foo-with-hyphens": "bar-with-hyphens",
},
},
"id_with_underscores": {
Conclusion: stepStatusSuccess,
Outcome: stepStatusFailure,
Conclusion: model.StepStatusSuccess,
Outcome: model.StepStatusFailure,
Outputs: map[string]string{
"foo_with_underscores": "bar_with_underscores",
},
@ -232,6 +232,7 @@ func updateTestExpressionWorkflow(t *testing.T, tables []struct {
envs += fmt.Sprintf(" %s: %s\n", k, rc.Env[k])
}
// editorconfig-checker-disable
workflow := fmt.Sprintf(`
name: "Test how expressions are handled on GitHub"
on: push
@ -244,6 +245,7 @@ jobs:
runs-on: ubuntu-latest
steps:
`, envs)
// editorconfig-checker-enable
for _, table := range tables {
expressionPattern = regexp.MustCompile(`\${{\s*(.+?)\s*}}`)