1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-09-15 18:57:01 +00:00

Add more steps context support (#887)

* feat: add more steps context support

- Add step outcome
- Remove step success in favour of conclusion

* feat: add conclusion and outcome steps context tests

Add corresponding tests and extend pkg/runner/expression.go vmSteps() to
handle steps context conclusion and outcome iota as strings.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Victor Popkov 2021-11-27 19:55:26 +02:00 committed by GitHub
parent 0c557c5d72
commit 3a14671ab0
8 changed files with 107 additions and 15 deletions

View file

@ -49,22 +49,25 @@ func TestEvaluate(t *testing.T) {
},
StepResults: map[string]*stepResult{
"idwithnothing": {
Conclusion: stepStatusSuccess,
Outcome: stepStatusFailure,
Outputs: map[string]string{
"foowithnothing": "barwithnothing",
},
Success: true,
},
"id-with-hyphens": {
Conclusion: stepStatusSuccess,
Outcome: stepStatusFailure,
Outputs: map[string]string{
"foo-with-hyphens": "bar-with-hyphens",
},
Success: true,
},
"id_with_underscores": {
Conclusion: stepStatusSuccess,
Outcome: stepStatusFailure,
Outputs: map[string]string{
"foo_with_underscores": "bar_with_underscores",
},
Success: true,
},
},
}
@ -107,8 +110,14 @@ func TestEvaluate(t *testing.T) {
{"github.run_id", "1", ""},
{"github.run_number", "1", ""},
{"job.status", "success", ""},
{"steps.idwithnothing.conclusion", "success", ""},
{"steps.idwithnothing.outcome", "failure", ""},
{"steps.idwithnothing.outputs.foowithnothing", "barwithnothing", ""},
{"steps.id-with-hyphens.conclusion", "success", ""},
{"steps.id-with-hyphens.outcome", "failure", ""},
{"steps.id-with-hyphens.outputs.foo-with-hyphens", "bar-with-hyphens", ""},
{"steps.id_with_underscores.conclusion", "success", ""},
{"steps.id_with_underscores.outcome", "failure", ""},
{"steps.id_with_underscores.outputs.foo_with_underscores", "bar_with_underscores", ""},
{"runner.os", "Linux", ""},
{"matrix.os", "Linux", ""},