* feat:(Changed order of events, to prevent enviroment to run before if statement is run * changed issue597 to issue-597 * Added test for linux/amd64
This commit is contained in:
parent
780f60a1e6
commit
3db3d416e3
3 changed files with 51 additions and 11 deletions
|
@ -212,6 +212,23 @@ func (rc *RunContext) newStepExecutor(step *model.Step) common.Executor {
|
||||||
Success: true,
|
Success: true,
|
||||||
Outputs: make(map[string]string),
|
Outputs: make(map[string]string),
|
||||||
}
|
}
|
||||||
|
runStep, err := rc.EvalBool(sc.Step.If)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
common.Logger(ctx).Errorf(" \u274C Error in if: expression - %s", sc.Step)
|
||||||
|
exprEval, err := sc.setupEnv(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
rc.ExprEval = exprEval
|
||||||
|
rc.StepResults[rc.CurrentStep].Success = false
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if !runStep {
|
||||||
|
log.Debugf("Skipping step '%s' due to '%s'", sc.Step.String(), sc.Step.If)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
exprEval, err := sc.setupEnv(ctx)
|
exprEval, err := sc.setupEnv(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -219,17 +236,6 @@ func (rc *RunContext) newStepExecutor(step *model.Step) common.Executor {
|
||||||
}
|
}
|
||||||
rc.ExprEval = exprEval
|
rc.ExprEval = exprEval
|
||||||
|
|
||||||
runStep, err := rc.EvalBool(sc.Step.If)
|
|
||||||
if err != nil {
|
|
||||||
common.Logger(ctx).Errorf(" \u274C Error in if: expression - %s", sc.Step)
|
|
||||||
rc.StepResults[rc.CurrentStep].Success = false
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if !runStep {
|
|
||||||
log.Debugf("Skipping step '%s' due to '%s'", sc.Step.String(), sc.Step.If)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
common.Logger(ctx).Infof("\u2B50 Run %s", sc.Step)
|
common.Logger(ctx).Infof("\u2B50 Run %s", sc.Step)
|
||||||
err = sc.Executor()(ctx)
|
err = sc.Executor()(ctx)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
|
@ -96,11 +96,13 @@ func TestRunEvent(t *testing.T) {
|
||||||
{"testdata", "workdir", "push", "", platforms, ""},
|
{"testdata", "workdir", "push", "", platforms, ""},
|
||||||
{"testdata", "defaults-run", "push", "", platforms, ""},
|
{"testdata", "defaults-run", "push", "", platforms, ""},
|
||||||
{"testdata", "uses-composite", "push", "", platforms, ""},
|
{"testdata", "uses-composite", "push", "", platforms, ""},
|
||||||
|
{"testdata", "issue-597", "push", "", platforms, ""},
|
||||||
// {"testdata", "powershell", "push", "", platforms, ""}, // Powershell is not available on default act test runner (yet) but preserving here for posterity
|
// {"testdata", "powershell", "push", "", platforms, ""}, // Powershell is not available on default act test runner (yet) but preserving here for posterity
|
||||||
// {"testdata", "issue-228", "push", "", platforms, ""}, // TODO [igni]: Remove this once everything passes
|
// {"testdata", "issue-228", "push", "", platforms, ""}, // TODO [igni]: Remove this once everything passes
|
||||||
|
|
||||||
// single test for different architecture: linux/arm64
|
// single test for different architecture: linux/arm64
|
||||||
{"testdata", "basic", "push", "", platforms, "linux/arm64"},
|
{"testdata", "basic", "push", "", platforms, "linux/arm64"},
|
||||||
|
|
||||||
}
|
}
|
||||||
log.SetLevel(log.DebugLevel)
|
log.SetLevel(log.DebugLevel)
|
||||||
|
|
||||||
|
|
32
pkg/runner/testdata/issue-597/spelling.yaml
vendored
Normal file
32
pkg/runner/testdata/issue-597/spelling.yaml
vendored
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
name: issue-597
|
||||||
|
on: push
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
my_first_job:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: My first false step
|
||||||
|
if: "endsWith('Should not', 'o1')"
|
||||||
|
uses: actions/checkout@v2.0.0
|
||||||
|
with:
|
||||||
|
ref: refs/pull/${{github.event.pull_request.number}}/merge
|
||||||
|
fetch-depth: 5
|
||||||
|
- name: My first true step
|
||||||
|
if: ${{"endsWith('Hello world', 'ld')"}}
|
||||||
|
uses: actions/hello-world-javascript-action@main
|
||||||
|
with:
|
||||||
|
who-to-greet: "Renst the Octocat"
|
||||||
|
- name: My second false step
|
||||||
|
if: "endsWith('Should not evaluate', 'o2')"
|
||||||
|
uses: actions/checkout@v2.0.0
|
||||||
|
with:
|
||||||
|
ref: refs/pull/${{github.event.pull_request.number}}/merge
|
||||||
|
fetch-depth: 5
|
||||||
|
- name: My third false step
|
||||||
|
if: ${{endsWith('Should not evaluate', 'o3')}}
|
||||||
|
uses: actions/checkout@v2.0.0
|
||||||
|
with:
|
||||||
|
ref: refs/pull/${{github.event.pull_request.number}}/merge
|
||||||
|
fetch-depth: 5
|
Loading…
Reference in a new issue