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 558081242c
commit ed01f464ed
10 changed files with 132 additions and 124 deletions

View File

@@ -8,6 +8,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/nektos/act/pkg/common"
"github.com/nektos/act/pkg/model"
)
func TestSetEnv(t *testing.T) {
@@ -24,11 +25,11 @@ func TestSetOutput(t *testing.T) {
a := assert.New(t)
ctx := context.Background()
rc := new(RunContext)
rc.StepResults = make(map[string]*stepResult)
rc.StepResults = make(map[string]*model.StepResult)
handler := rc.commandHandler(ctx)
rc.CurrentStep = "my-step"
rc.StepResults[rc.CurrentStep] = &stepResult{
rc.StepResults[rc.CurrentStep] = &model.StepResult{
Outputs: make(map[string]string),
}
handler("::set-output name=x::valz\n")