2021-01-23 10:07:28 -06:00
|
|
|
package runner
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/nektos/act/pkg/common"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestStepContextExecutor(t *testing.T) {
|
|
|
|
platforms := map[string]string{
|
2021-02-23 11:49:24 -06:00
|
|
|
"ubuntu-latest": "node:12.20.1-buster-slim",
|
2021-01-23 10:07:28 -06:00
|
|
|
}
|
|
|
|
tables := []TestJobFileInfo{
|
2021-04-01 13:36:41 -05:00
|
|
|
{"testdata", "uses-and-run-in-one-step", "push", "Invalid run/uses syntax for job:test step:Test", platforms, "linux/amd64"},
|
2021-03-28 23:08:40 -05:00
|
|
|
{"testdata", "uses-github-empty", "push", "Expected format {org}/{repo}[/path]@ref", platforms, "linux/amd64"},
|
|
|
|
{"testdata", "uses-github-noref", "push", "Expected format {org}/{repo}[/path]@ref", platforms, "linux/amd64"},
|
|
|
|
{"testdata", "uses-github-root", "push", "", platforms, "linux/amd64"},
|
|
|
|
{"testdata", "uses-github-path", "push", "", platforms, "linux/amd64"},
|
2021-04-01 13:36:41 -05:00
|
|
|
|
|
|
|
{"testdata", "uses-and-run-in-one-step", "push", "Invalid run/uses syntax for job:test step:Test", platforms, "linux/arm64"},
|
2021-03-28 23:08:40 -05:00
|
|
|
{"testdata", "uses-github-empty", "push", "Expected format {org}/{repo}[/path]@ref", platforms, "linux/arm64"},
|
|
|
|
{"testdata", "uses-github-noref", "push", "Expected format {org}/{repo}[/path]@ref", platforms, "linux/arm64"},
|
|
|
|
{"testdata", "uses-github-root", "push", "", platforms, "linux/arm64"},
|
|
|
|
{"testdata", "uses-github-path", "push", "", platforms, "linux/arm64"},
|
2021-01-23 10:07:28 -06:00
|
|
|
}
|
|
|
|
// These tests are sufficient to only check syntax.
|
|
|
|
ctx := common.WithDryrun(context.Background(), true)
|
|
|
|
for _, table := range tables {
|
|
|
|
runTestJobFile(ctx, t, table)
|
|
|
|
}
|
|
|
|
}
|