Remove pwsh -login and add Pwsh test (#660)
* Remove pwsh -login and add Pwsh test * Add Shell Command Test for coverage * 🧪 Move PWSH Platform definition to inline test, it can always be expanded out later Reference: https://github.com/nektos/act/pull/660#discussion_r626171728 * Test MacOS Build for transient failure Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
parent
e79379cfaa
commit
616d7fcaeb
3 changed files with 20 additions and 2 deletions
|
@ -258,7 +258,7 @@ func (s *Step) ShellCommand() string {
|
||||||
case "", "bash":
|
case "", "bash":
|
||||||
shellCommand = "bash --login --noprofile --norc -e -o pipefail {0}"
|
shellCommand = "bash --login --noprofile --norc -e -o pipefail {0}"
|
||||||
case "pwsh":
|
case "pwsh":
|
||||||
shellCommand = "pwsh -login -command . '{0}'"
|
shellCommand = "pwsh -command . '{0}'"
|
||||||
case "python":
|
case "python":
|
||||||
shellCommand = "python {0}"
|
shellCommand = "python {0}"
|
||||||
case "sh":
|
case "sh":
|
||||||
|
|
|
@ -130,3 +130,19 @@ jobs:
|
||||||
assert.Equal(t, workflow.Jobs["test"].Steps[3].Type(), StepTypeUsesDockerURL)
|
assert.Equal(t, workflow.Jobs["test"].Steps[3].Type(), StepTypeUsesDockerURL)
|
||||||
assert.Equal(t, workflow.Jobs["test"].Steps[4].Type(), StepTypeUsesActionLocal)
|
assert.Equal(t, workflow.Jobs["test"].Steps[4].Type(), StepTypeUsesActionLocal)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestStep_ShellCommand(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
shell string
|
||||||
|
want string
|
||||||
|
}{
|
||||||
|
{"pwsh", "pwsh -command . '{0}'"},
|
||||||
|
{"powershell", "powershell -command . '{0}'"},
|
||||||
|
}
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.shell, func(t *testing.T) {
|
||||||
|
got := (&Step{Shell: tt.shell}).ShellCommand()
|
||||||
|
assert.Equal(t, got, tt.want)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -83,10 +83,13 @@ func TestRunEvent(t *testing.T) {
|
||||||
platforms := map[string]string{
|
platforms := map[string]string{
|
||||||
"ubuntu-latest": "node:12.20.1-buster-slim",
|
"ubuntu-latest": "node:12.20.1-buster-slim",
|
||||||
}
|
}
|
||||||
|
|
||||||
tables := []TestJobFileInfo{
|
tables := []TestJobFileInfo{
|
||||||
{"testdata", "basic", "push", "", platforms, ""},
|
{"testdata", "basic", "push", "", platforms, ""},
|
||||||
{"testdata", "fail", "push", "exit with `FAILURE`: 1", platforms, ""},
|
{"testdata", "fail", "push", "exit with `FAILURE`: 1", platforms, ""},
|
||||||
{"testdata", "runs-on", "push", "", platforms, ""},
|
{"testdata", "runs-on", "push", "", platforms, ""},
|
||||||
|
// Pwsh is not available in default worker (yet) so we use a separate image for testing
|
||||||
|
{"testdata", "powershell", "push", "", map[string]string{"ubuntu-latest": "ghcr.io/justingrote/act-pwsh:latest"}, ""},
|
||||||
{"testdata", "job-container", "push", "", platforms, ""},
|
{"testdata", "job-container", "push", "", platforms, ""},
|
||||||
{"testdata", "job-container-non-root", "push", "", platforms, ""},
|
{"testdata", "job-container-non-root", "push", "", platforms, ""},
|
||||||
{"testdata", "uses-docker-url", "push", "", platforms, ""},
|
{"testdata", "uses-docker-url", "push", "", platforms, ""},
|
||||||
|
@ -102,7 +105,6 @@ func TestRunEvent(t *testing.T) {
|
||||||
{"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", "issue-597", "push", "", platforms, ""},
|
||||||
// {"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
|
||||||
|
|
Loading…
Reference in a new issue