From 87d973b8946ab40a80e8cf93c5a8dbd7ce8e1703 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Mon, 28 Jul 2025 06:18:46 +0000 Subject: [PATCH] chore(tests): add coverage for ./pkg/runner (#202) Only changes test files. --- - remove tests specific to running on a host with no container they are the same as with the containers (TestRunEventHostEnvironment) - prefix the name of the tests with a distinctive name to more easily run them together - use code.forgejo.org/oci images whereever possible - remove some tests that are either - difficult to understand (ancient bugs) - not yet well understood (related to reusable workflows) - depend on github (generation of workflows to be run on the fly e.g. updateTestIfWorkflow) - fix the TestSanitizeNetworkAlias tests that were not run and make them easier to debug - disable tests of options that are forbidden in Forgejo Actions (testdata/container-hostname/push.yml) Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/202 Reviewed-by: Michael Kriese Co-authored-by: Earl Warren Co-committed-by: Earl Warren --- act/model/testdata/container-volumes/push.yml | 5 +- act/runner/action_cache_test.go | 2 +- act/runner/command_test.go | 16 +- act/runner/expression_test.go | 69 +----- act/runner/job_executor.go | 1 - act/runner/job_executor_test.go | 2 +- act/runner/run_context_test.go | 218 +++++++----------- act/runner/runner_test.go | 150 ++---------- act/runner/step_action_remote_test.go | 104 +-------- act/runner/step_test.go | 88 +------ .../GITHUB_ENV-use-in-env-ctx/push.yml | 4 +- act/runner/testdata/GITHUB_STATE/push.yml | 8 +- .../testdata/act-composite-env-test/push.yml | 2 +- .../push.yml | 10 +- act/runner/testdata/basic/push.yml | 2 +- act/runner/testdata/checkout/push.yml | 2 +- .../composite-fail-with-output/push.yml | 2 +- .../testdata/container-hostname/push.yml | 14 +- .../testdata/ensure-post-steps/push.yml | 2 +- act/runner/testdata/if-expressions/push.yml | 4 +- .../testdata/inputs-via-env-context/push.yml | 2 +- act/runner/testdata/issue-104/main.yaml | 2 +- act/runner/testdata/issue-1195/push.yml | 13 -- act/runner/testdata/issue-122/main.yaml | 4 +- act/runner/testdata/issue-141/main.yaml | 2 +- act/runner/testdata/issue-597/spelling.yaml | 8 +- act/runner/testdata/issue-598/spelling.yml | 8 +- .../testdata/local-action-docker-url/push.yml | 2 +- .../testdata/local-action-dockerfile/push.yml | 2 +- act/runner/testdata/local-action-js/push.yml | 6 +- .../action/action.yml | 2 +- .../push.yml | 2 +- .../config/config.yml | 3 - .../local-remote-action-overrides/push.yml | 9 - act/runner/testdata/mask-values/push.yml | 2 +- .../push.yml | 4 +- act/runner/testdata/node/push.yml | 4 +- act/runner/testdata/parallel/push.yml | 4 +- act/runner/testdata/path-handling/push.yml | 6 +- act/runner/testdata/python/main.yml | 4 +- .../push.yml | 2 +- .../push.yml | 12 +- .../testdata/remote-action-docker/push.yml | 2 +- .../remote-action-js-node-user/push.yml | 2 +- act/runner/testdata/remote-action-js/push.yml | 4 +- .../testdata/services-host-network/push.yml | 14 -- .../testdata/services-with-container/push.yml | 2 +- .../push.yml | 4 +- .../uses-and-run-in-one-step/push.yml | 2 +- .../uses-composite-with-error/push.yml | 2 +- .../composite/action.yml | 2 +- .../uses-composite-with-inputs/push.yml | 4 +- .../push.yml | 2 +- act/runner/testdata/uses-composite/push.yml | 2 +- .../testdata/uses-github-full-sha/main.yml | 2 +- .../testdata/uses-github-noref/push.yml | 2 +- act/runner/testdata/uses-github-path/push.yml | 2 +- act/runner/testdata/uses-github-root/push.yml | 2 +- .../testdata/uses-github-short-sha/main.yml | 2 +- .../composite_action2/action.yml | 2 +- .../testdata/uses-nested-composite/push.yml | 2 +- .../uses-sh-test-action-path/push.yaml | 2 +- act/runner/testdata/uses-sh/push.yaml | 2 +- act/runner/testdata/uses-workflow/push.yml | 4 +- act/runner/testdata/windows-add-env/push.yml | 2 +- 65 files changed, 218 insertions(+), 656 deletions(-) delete mode 100644 act/runner/testdata/issue-1195/push.yml delete mode 100644 act/runner/testdata/local-remote-action-overrides/config/config.yml delete mode 100644 act/runner/testdata/local-remote-action-overrides/push.yml delete mode 100644 act/runner/testdata/services-host-network/push.yml diff --git a/act/model/testdata/container-volumes/push.yml b/act/model/testdata/container-volumes/push.yml index 1ed27f22..3d06bd3a 100644 --- a/act/model/testdata/container-volumes/push.yml +++ b/act/model/testdata/container-volumes/push.yml @@ -5,15 +5,14 @@ jobs: with-volumes: runs-on: ubuntu-latest container: - image: node:16-buster-slim + image: code.forgejo.org/oci/node:22-bookworm volumes: - my_docker_volume:/path/to/volume - /path/to/nonexist/directory - /proc/sys/kernel/random/boot_id:/current/boot_id steps: - run: | - set -e + set -ex test -d /path/to/volume test "$(cat /proc/sys/kernel/random/boot_id)" = "$(cat /current/boot_id)" test -d /path/to/nonexist/directory - \ No newline at end of file diff --git a/act/runner/action_cache_test.go b/act/runner/action_cache_test.go index 58fac5bd..286336e9 100644 --- a/act/runner/action_cache_test.go +++ b/act/runner/action_cache_test.go @@ -19,7 +19,7 @@ func TestActionCache(t *testing.T) { } ctx := context.Background() cacheDir := "nektos/act-test-actions" - repo := "https://github.com/nektos/act-test-actions" + repo := "https://code.forgejo.org/forgejo/act-test-actions" refs := []struct { Name string CacheDir string diff --git a/act/runner/command_test.go b/act/runner/command_test.go index 57c7de5f..2431da49 100644 --- a/act/runner/command_test.go +++ b/act/runner/command_test.go @@ -14,7 +14,7 @@ import ( "github.com/nektos/act/pkg/model" ) -func TestSetEnv(t *testing.T) { +func TestCommandSetEnv(t *testing.T) { a := assert.New(t) ctx := context.Background() rc := new(RunContext) @@ -24,7 +24,7 @@ func TestSetEnv(t *testing.T) { a.Equal("valz", rc.Env["x"]) } -func TestSetOutput(t *testing.T) { +func TestCommandSetOutput(t *testing.T) { a := assert.New(t) ctx := context.Background() rc := new(RunContext) @@ -54,7 +54,7 @@ func TestSetOutput(t *testing.T) { a.Equal("percent2%\ntest", rc.StepResults["my-step"].Outputs["x:,\n%\r:"]) } -func TestAddpath(t *testing.T) { +func TestCommandAddpath(t *testing.T) { a := assert.New(t) ctx := context.Background() rc := new(RunContext) @@ -67,7 +67,7 @@ func TestAddpath(t *testing.T) { a.Equal("/boo", rc.ExtraPath[0]) } -func TestStopCommands(t *testing.T) { +func TestCommandStopCommands(t *testing.T) { logger, hook := test.NewNullLogger() a := assert.New(t) @@ -92,7 +92,7 @@ func TestStopCommands(t *testing.T) { a.Contains(messages, " \U00002699 ::set-env name=x::abcd\n") } -func TestAddpathADO(t *testing.T) { +func TestCommandAddpathADO(t *testing.T) { a := assert.New(t) ctx := context.Background() rc := new(RunContext) @@ -105,7 +105,7 @@ func TestAddpathADO(t *testing.T) { a.Equal("/boo", rc.ExtraPath[0]) } -func TestAddmask(t *testing.T) { +func TestCommandAddmask(t *testing.T) { logger, hook := test.NewNullLogger() a := assert.New(t) @@ -147,7 +147,7 @@ func captureOutput(t *testing.T, f func()) string { return out } -func TestAddmaskUsemask(t *testing.T) { +func TestCommandAddmaskUsemask(t *testing.T) { rc := new(RunContext) rc.StepResults = make(map[string]*model.StepResult) rc.CurrentStep = "my-step" @@ -174,7 +174,7 @@ func TestAddmaskUsemask(t *testing.T) { a.Equal("[testjob] \U00002699 ***\n[testjob] \U00002699 ::set-output:: = token=***\n", re) } -func TestSaveState(t *testing.T) { +func TestCommandSaveState(t *testing.T) { rc := &RunContext{ CurrentStep: "step", StepResults: map[string]*model.StepResult{}, diff --git a/act/runner/expression_test.go b/act/runner/expression_test.go index 5cc2f7b2..5b06b329 100644 --- a/act/runner/expression_test.go +++ b/act/runner/expression_test.go @@ -2,10 +2,6 @@ package runner import ( "context" - "fmt" - "os" - "regexp" - "sort" "testing" "github.com/nektos/act/pkg/exprparser" @@ -78,7 +74,7 @@ func createRunContext(t *testing.T) *RunContext { } } -func TestEvaluateRunContext(t *testing.T) { +func TestExpressionEvaluateRunContext(t *testing.T) { rc := createRunContext(t) ee := rc.NewExpressionEvaluator(context.Background()) @@ -101,8 +97,8 @@ func TestEvaluateRunContext(t *testing.T) { {"join(fromJSON('[\"hello\"]'),'octocat')", "hello", ""}, {"join(fromJSON('[\"hello\",\"mona\",\"the\"]'),'octocat')", "hellooctocatmonaoctocatthe", ""}, {"join('hello','mona')", "hello", ""}, - {"toJSON(env)", "{\n \"ACT\": \"true\",\n \"key\": \"value\"\n}", ""}, - {"toJson(env)", "{\n \"ACT\": \"true\",\n \"key\": \"value\"\n}", ""}, + {"toJSON(env)", "{\n \"ACT\": \"true\",\n \"ACT_SKIP_CHECKOUT\": \"true\",\n \"key\": \"value\"\n}", ""}, + {"toJson(env)", "{\n \"ACT\": \"true\",\n \"ACT_SKIP_CHECKOUT\": \"true\",\n \"key\": \"value\"\n}", ""}, {"(fromJSON('{\"foo\":\"bar\"}')).foo", "bar", ""}, {"(fromJson('{\"foo\":\"bar\"}')).foo", "bar", ""}, {"(fromJson('[\"foo\",\"bar\"]'))[1]", "bar", ""}, @@ -153,7 +149,7 @@ func TestEvaluateRunContext(t *testing.T) { } } -func TestEvaluateStep(t *testing.T) { +func TestExpressionEvaluateStep(t *testing.T) { rc := createRunContext(t) step := &stepRun{ RunContext: rc, @@ -193,7 +189,7 @@ func TestEvaluateStep(t *testing.T) { } } -func TestInterpolate(t *testing.T) { +func TestExpressionInterpolate(t *testing.T) { rc := &RunContext{ Config: &Config{ Workdir: ".", @@ -260,7 +256,6 @@ func TestInterpolate(t *testing.T) { {"${{ fromJSON('{}') < 2 }}", "false"}, } - updateTestExpressionWorkflow(t, tables, rc) for _, table := range tables { table := table t.Run("interpolate", func(t *testing.T) { @@ -271,57 +266,7 @@ func TestInterpolate(t *testing.T) { } } -func updateTestExpressionWorkflow(t *testing.T, tables []struct { - in string - out string -}, rc *RunContext) { - var envs string - keys := make([]string, 0, len(rc.Env)) - for k := range rc.Env { - keys = append(keys, k) - } - sort.Strings(keys) - for _, k := range keys { - envs += fmt.Sprintf(" %s: %s\n", k, rc.Env[k]) - } - - // editorconfig-checker-disable - workflow := fmt.Sprintf(` -name: "Test how expressions are handled on GitHub" -on: push - -env: -%s - -jobs: - test-espressions: - runs-on: ubuntu-latest - steps: -`, envs) - // editorconfig-checker-enable - for _, table := range tables { - expressionPattern := regexp.MustCompile(`\${{\s*(.+?)\s*}}`) - - expr := expressionPattern.ReplaceAllStringFunc(table.in, func(match string) string { - return fmt.Sprintf("€{{ %s }}", expressionPattern.ReplaceAllString(match, "$1")) - }) - name := fmt.Sprintf(`%s -> %s should be equal to %s`, expr, table.in, table.out) - echo := `run: echo "Done "` - workflow += fmt.Sprintf("\n - name: %s\n %s\n", name, echo) - } - - file, err := os.Create("../../.github/workflows/test-expressions.yml") - if err != nil { - t.Fatal(err) - } - - _, err = file.WriteString(workflow) - if err != nil { - t.Fatal(err) - } -} - -func TestRewriteSubExpression(t *testing.T) { +func TestExpressionRewriteSubExpression(t *testing.T) { table := []struct { in string out string @@ -351,7 +296,7 @@ func TestRewriteSubExpression(t *testing.T) { } } -func TestRewriteSubExpressionForceFormat(t *testing.T) { +func TestExpressionRewriteSubExpressionForceFormat(t *testing.T) { table := []struct { in string out string diff --git a/act/runner/job_executor.go b/act/runner/job_executor.go index ed40563f..378abeb6 100644 --- a/act/runner/job_executor.go +++ b/act/runner/job_executor.go @@ -66,7 +66,6 @@ func newJobExecutor(info jobInfo, sf stepFactory, rc *RunContext) common.Executo stepModel.Number = i step, err := sf.newStep(stepModel, rc) - if err != nil { return common.NewErrorExecutor(err) } diff --git a/act/runner/job_executor_test.go b/act/runner/job_executor_test.go index ac7725f6..5fd42efc 100644 --- a/act/runner/job_executor_test.go +++ b/act/runner/job_executor_test.go @@ -95,7 +95,7 @@ func (sfm *stepFactoryMock) newStep(model *model.Step, rc *RunContext) (step, er return args.Get(0).(step), args.Error(1) } -func TestNewJobExecutor(t *testing.T) { +func TestJobExecutorNewJobExecutor(t *testing.T) { table := []struct { name string steps []*model.Step diff --git a/act/runner/run_context_test.go b/act/runner/run_context_test.go index 8c362b3a..d5ff993e 100644 --- a/act/runner/run_context_test.go +++ b/act/runner/run_context_test.go @@ -5,10 +5,8 @@ import ( "context" "fmt" "os" - "regexp" "runtime" "slices" - "sort" "strings" "testing" @@ -158,7 +156,6 @@ func TestRunContext_EvalBool(t *testing.T) { {in: "INVALID_EXPRESSION", wantErr: true}, } - updateTestIfWorkflow(t, tables, rc) for _, table := range tables { table := table t.Run(table.in, func(t *testing.T) { @@ -173,67 +170,6 @@ func TestRunContext_EvalBool(t *testing.T) { } } -func updateTestIfWorkflow(t *testing.T, tables []struct { - in string - out bool - wantErr bool -}, rc *RunContext) { - var envs string - keys := make([]string, 0, len(rc.Env)) - for k := range rc.Env { - keys = append(keys, k) - } - sort.Strings(keys) - for _, k := range keys { - envs += fmt.Sprintf(" %s: %s\n", k, rc.Env[k]) - } - // editorconfig-checker-disable - workflow := fmt.Sprintf(` -name: "Test what expressions result in true and false on GitHub" -on: push - -env: -%s - -jobs: - test-ifs-and-buts: - runs-on: ubuntu-latest - steps: -`, envs) - // editorconfig-checker-enable - - for i, table := range tables { - if table.wantErr || strings.HasPrefix(table.in, "github.actor") { - continue - } - expressionPattern := regexp.MustCompile(`\${{\s*(.+?)\s*}}`) - - expr := expressionPattern.ReplaceAllStringFunc(table.in, func(match string) string { - return fmt.Sprintf("€{{ %s }}", expressionPattern.ReplaceAllString(match, "$1")) - }) - echo := fmt.Sprintf(`run: echo "%s should be false, but was evaluated to true;" exit 1;`, table.in) - name := fmt.Sprintf(`"❌ I should not run, expr: %s"`, expr) - if table.out { - echo = `run: echo OK` - name = fmt.Sprintf(`"✅ I should run, expr: %s"`, expr) - } - workflow += fmt.Sprintf("\n - name: %s\n id: step%d\n if: %s\n %s\n", name, i, table.in, echo) - if table.out { - workflow += fmt.Sprintf("\n - name: \"Double checking expr: %s\"\n if: steps.step%d.conclusion == 'skipped'\n run: echo \"%s should have been true, but wasn't\"\n", expr, i, table.in) - } - } - - file, err := os.Create("../../.github/workflows/test-if.yml") - if err != nil { - t.Fatal(err) - } - - _, err = file.WriteString(workflow) - if err != nil { - t.Fatal(err) - } -} - func TestRunContext_GetBindsAndMounts(t *testing.T) { rctemplate := &RunContext{ Name: "TestRCName", @@ -347,7 +283,7 @@ func TestRunContext_GetBindsAndMounts(t *testing.T) { }) } -func TestGetGitHubContext(t *testing.T) { +func TestRunContext_GetGitHubContext(t *testing.T) { log.SetLevel(log.DebugLevel) cwd, err := os.Getwd() @@ -382,12 +318,12 @@ func TestGetGitHubContext(t *testing.T) { actor = a } - repo := "nektos/act" + repo := "forgejo/act" if r := os.Getenv("ACT_REPOSITORY"); r != "" { repo = r } - owner := "nektos" + owner := "code.forgejo.org" if o := os.Getenv("ACT_OWNER"); o != "" { owner = o } @@ -396,7 +332,7 @@ func TestGetGitHubContext(t *testing.T) { assert.Equal(t, ghc.RunNumber, "1") assert.Equal(t, ghc.RetentionDays, "0") assert.Equal(t, ghc.Actor, actor) - assert.Equal(t, ghc.Repository, repo) + assert.True(t, strings.HasSuffix(ghc.Repository, repo)) assert.Equal(t, ghc.RepositoryOwner, owner) assert.Equal(t, ghc.RunnerPerflog, "/dev/null") assert.Equal(t, ghc.Token, rc.Config.Secrets["GITHUB_TOKEN"]) @@ -404,7 +340,7 @@ func TestGetGitHubContext(t *testing.T) { assert.Equal(t, ghc.Job, "job1") } -func TestGetGithubContextRef(t *testing.T) { +func TestRunContext_GetGithubContextRef(t *testing.T) { table := []struct { event string json string @@ -468,7 +404,7 @@ func createIfTestRunContext(jobs map[string]*model.Job) *RunContext { return rc } -func createJob(t *testing.T, input string, result string) *model.Job { +func createJob(t *testing.T, input, result string) *model.Job { var job *model.Job err := yaml.Unmarshal([]byte(input), &job) assert.NoError(t, err) @@ -477,7 +413,7 @@ func createJob(t *testing.T, input string, result string) *model.Job { return job } -func TestRunContextRunsOnPlatformNames(t *testing.T) { +func TestRunContext_RunsOnPlatformNames(t *testing.T) { log.SetLevel(log.DebugLevel) assertObject := assert.New(t) @@ -524,7 +460,7 @@ func TestRunContextRunsOnPlatformNames(t *testing.T) { assertObject.Equal([]string{}, rc.runsOnPlatformNames(context.Background())) } -func TestRunContextIsEnabled(t *testing.T) { +func TestRunContext_IsEnabled(t *testing.T) { log.SetLevel(log.DebugLevel) assertObject := assert.New(t) @@ -639,7 +575,7 @@ if: false`, ""), assertObject.False(rc.isEnabled(context.Background())) } -func TestRunContextGetEnv(t *testing.T) { +func TestRunContext_GetEnv(t *testing.T) { tests := []struct { description string rc *RunContext @@ -690,7 +626,7 @@ func TestRunContextGetEnv(t *testing.T) { } } -func Test_createSimpleContainerName(t *testing.T) { +func TestRunContext_CreateSimpleContainerName(t *testing.T) { tests := []struct { parts []string want string @@ -711,7 +647,7 @@ func Test_createSimpleContainerName(t *testing.T) { } } -func TestSanitizeNetworkAlias(t *testing.T) { +func TestRunContext_SanitizeNetworkAlias(t *testing.T) { same := "same" assert.Equal(t, same, sanitizeNetworkAlias(context.Background(), same)) original := "or.igin'A-L" @@ -719,7 +655,7 @@ func TestSanitizeNetworkAlias(t *testing.T) { assert.Equal(t, sanitized, sanitizeNetworkAlias(context.Background(), original)) } -func TestPrepareJobContainer(t *testing.T) { +func TestRunContext_PrepareJobContainer(t *testing.T) { yaml := ` on: push: @@ -773,63 +709,7 @@ jobs: }, inputs: []container.NewContainerInput{ { - Name: "WORKFLOW-JOB-service1-24d1b6963554cd6e1a2f9bfcd21b822bf5b42547db24667196ac45f89072fdd9", - Image: "service1:image", - Username: "service1username", - Password: "service1password", - Entrypoint: nil, - Cmd: []string{}, - WorkingDir: "", - Env: []string{}, - ToolCache: "/opt/hostedtoolcache", - Binds: []string{"/var/run/docker.sock:/var/run/docker.sock"}, - Mounts: map[string]string{}, - NetworkMode: "WORKFLOW_JOB-job-network", - Privileged: false, - UsernsMode: "", - Platform: "", - NetworkAliases: []string{"service1"}, - ExposedPorts: nat.PortSet{}, - PortBindings: nat.PortMap{}, - ConfigOptions: "", - JobOptions: "", - AutoRemove: false, - ValidVolumes: []string{ - "WORKFLOW_JOB", - "WORKFLOW_JOB-env", - "/var/run/docker.sock", - }, - }, - { - Name: "WORKFLOW-JOB-service2-7137cecabbdb942ae7bbfc8953de8f2a68e8dc9c92ad98cd6d095481b216f979", - Image: "service2:image", - Username: "service2username", - Password: "service2password", - Entrypoint: nil, - Cmd: []string{}, - WorkingDir: "", - Env: []string{}, - ToolCache: "/opt/hostedtoolcache", - Binds: []string{"/var/run/docker.sock:/var/run/docker.sock"}, - Mounts: map[string]string{}, - NetworkMode: "WORKFLOW_JOB-job-network", - Privileged: false, - UsernsMode: "", - Platform: "", - NetworkAliases: []string{"service2"}, - ExposedPorts: nat.PortSet{}, - PortBindings: nat.PortMap{}, - ConfigOptions: "", - JobOptions: "", - AutoRemove: false, - ValidVolumes: []string{ - "WORKFLOW_JOB", - "WORKFLOW_JOB-env", - "/var/run/docker.sock", - }, - }, - { - Name: "WORKFLOW_JOB", + Name: "WORKFLOW-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855_JOB", Image: "some:image", Username: "containerusername", Password: "containerpassword", @@ -840,10 +720,10 @@ jobs: ToolCache: "/opt/hostedtoolcache", Binds: []string{"/var/run/docker.sock:/var/run/docker.sock"}, Mounts: map[string]string{ - "WORKFLOW_JOB": "/my/workdir", - "WORKFLOW_JOB-env": "/var/run/act", + "WORKFLOW-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855_JOB": "/my/workdir", + "WORKFLOW-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855_JOB-env": "/var/run/act", }, - NetworkMode: "WORKFLOW_JOB-job-network", + NetworkMode: "WORKFLOW-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855_JOB-job-network", Privileged: false, UsernsMode: "", Platform: "", @@ -854,8 +734,64 @@ jobs: JobOptions: "", AutoRemove: false, ValidVolumes: []string{ - "WORKFLOW_JOB", - "WORKFLOW_JOB-env", + "WORKFLOW-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855_JOB", + "WORKFLOW-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855_JOB-env", + "/var/run/docker.sock", + }, + }, + { + Name: "WORKFLOW-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca49599-fe7f4c0058dbd2161ebe4aafa71cd83bd96ee19d3ca8043d5e4bc477a664a80c", + Image: "service1:image", + Username: "service1username", + Password: "service1password", + Entrypoint: nil, + Cmd: []string{}, + WorkingDir: "", + Env: []string{}, + ToolCache: "/opt/hostedtoolcache", + Binds: []string{"/var/run/docker.sock:/var/run/docker.sock"}, + Mounts: map[string]string{}, + NetworkMode: "WORKFLOW-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855_JOB-job-network", + Privileged: false, + UsernsMode: "", + Platform: "", + NetworkAliases: []string{"service1"}, + ExposedPorts: nat.PortSet{}, + PortBindings: nat.PortMap{}, + ConfigOptions: "", + JobOptions: "", + AutoRemove: false, + ValidVolumes: []string{ + "WORKFLOW-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855_JOB", + "WORKFLOW-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855_JOB-env", + "/var/run/docker.sock", + }, + }, + { + Name: "WORKFLOW-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca49599-c233cf913e1d0c90cc1404ee09917e625f9cb82156ca3d7cb10b729d563728ea", + Image: "service2:image", + Username: "service2username", + Password: "service2password", + Entrypoint: nil, + Cmd: []string{}, + WorkingDir: "", + Env: []string{}, + ToolCache: "/opt/hostedtoolcache", + Binds: []string{"/var/run/docker.sock:/var/run/docker.sock"}, + Mounts: map[string]string{}, + NetworkMode: "WORKFLOW-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855_JOB-job-network", + Privileged: false, + UsernsMode: "", + Platform: "", + NetworkAliases: []string{"service2"}, + ExposedPorts: nat.PortSet{}, + PortBindings: nat.PortMap{}, + ConfigOptions: "", + JobOptions: "", + AutoRemove: false, + ValidVolumes: []string{ + "WORKFLOW-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855_JOB", + "WORKFLOW-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855_JOB-env", "/var/run/docker.sock", }, }, @@ -881,8 +817,10 @@ jobs: rc.ExprEval = rc.NewExpressionEvaluator(ctx) require.NoError(t, rc.prepareJobContainer(ctx)) - slices.SortFunc(containerInputs, func(a, b container.NewContainerInput) int { return cmp.Compare(a.Name, b.Name) }) - assert.EqualValues(t, testCase.inputs, containerInputs) + slices.SortFunc(containerInputs, func(a, b container.NewContainerInput) int { return cmp.Compare(a.Username, b.Username) }) + for i := 0; i < len(containerInputs); i++ { + assert.EqualValues(t, testCase.inputs[i], containerInputs[i], containerInputs[i].Username) + } }) } } diff --git a/act/runner/runner_test.go b/act/runner/runner_test.go index 303b6c08..bdf36a8a 100644 --- a/act/runner/runner_test.go +++ b/act/runner/runner_test.go @@ -8,7 +8,6 @@ import ( "os" "path" "path/filepath" - "runtime" "strings" "testing" @@ -51,7 +50,7 @@ func init() { secrets = map[string]string{} } -func TestNoWorkflowsFoundByPlanner(t *testing.T) { +func TestRunner_NoWorkflowsFoundByPlanner(t *testing.T) { planner, err := model.NewWorkflowPlanner("res", true, false) assert.NoError(t, err) @@ -71,7 +70,7 @@ func TestNoWorkflowsFoundByPlanner(t *testing.T) { log.SetOutput(out) } -func TestGraphMissingEvent(t *testing.T) { +func TestRunner_GraphMissingEvent(t *testing.T) { planner, err := model.NewWorkflowPlanner("testdata/issue-1595/no-event.yml", true, false) assert.NoError(t, err) @@ -89,7 +88,7 @@ func TestGraphMissingEvent(t *testing.T) { log.SetOutput(out) } -func TestGraphMissingFirst(t *testing.T) { +func TestRunner_GraphMissingFirst(t *testing.T) { planner, err := model.NewWorkflowPlanner("testdata/issue-1595/no-first.yml", true, false) assert.NoError(t, err) @@ -99,7 +98,7 @@ func TestGraphMissingFirst(t *testing.T) { assert.Equal(t, 0, len(plan.Stages)) } -func TestGraphWithMissing(t *testing.T) { +func TestRunner_GraphWithMissing(t *testing.T) { planner, err := model.NewWorkflowPlanner("testdata/issue-1595/missing.yml", true, false) assert.NoError(t, err) @@ -116,7 +115,7 @@ func TestGraphWithMissing(t *testing.T) { log.SetOutput(out) } -func TestGraphWithSomeMissing(t *testing.T) { +func TestRunner_GraphWithSomeMissing(t *testing.T) { log.SetLevel(log.DebugLevel) planner, err := model.NewWorkflowPlanner("testdata/issue-1595/", true, false) @@ -136,7 +135,7 @@ func TestGraphWithSomeMissing(t *testing.T) { log.SetOutput(out) } -func TestGraphEvent(t *testing.T) { +func TestRunner_GraphEvent(t *testing.T) { planner, err := model.NewWorkflowPlanner("testdata/basic", true, false) assert.NoError(t, err) @@ -207,7 +206,7 @@ func (j *TestJobFileInfo) runTest(ctx context.Context, t *testing.T, cfg *Config if err == nil && plan != nil { err = runner.NewPlanExecutor(plan)(ctx) if j.errorMessage == "" { - assert.Nil(t, err, fullWorkflowPath) + assert.NoError(t, err, fullWorkflowPath) } else { assert.Error(t, err, j.errorMessage) } @@ -222,7 +221,7 @@ type TestConfig struct { Env map[string]string `yaml:"env,omitempty"` } -func TestRunEvent(t *testing.T) { +func TestRunner_RunEvent(t *testing.T) { if testing.Short() { t.Skip("skipping integration test") } @@ -249,10 +248,11 @@ func TestRunEvent(t *testing.T) { {workdir, "uses-composite", "push", "", platforms, secrets}, {workdir, "uses-composite-with-error", "push", "Job 'failing-composite-action' failed", platforms, secrets}, {workdir, "uses-nested-composite", "push", "", platforms, secrets}, - {workdir, "remote-action-composite-js-pre-with-defaults", "push", "", platforms, secrets}, + // {workdir, "remote-action-composite-js-pre-with-defaults", "push", "", platforms, secrets}, {workdir, "remote-action-composite-action-ref", "push", "", platforms, secrets}, - {workdir, "uses-workflow", "push", "", platforms, map[string]string{"secret": "keep_it_private"}}, - {workdir, "uses-workflow", "pull_request", "", platforms, map[string]string{"secret": "keep_it_private"}}, + // reusable workflow not fully implemented yet + // {workdir, "uses-workflow", "push", "", platforms, map[string]string{"secret": "keep_it_private"}}, + // {workdir, "uses-workflow", "pull_request", "", platforms, map[string]string{"secret": "keep_it_private"}}, {workdir, "uses-docker-url", "push", "", platforms, secrets}, {workdir, "act-composite-env-test", "push", "", platforms, secrets}, @@ -262,7 +262,6 @@ func TestRunEvent(t *testing.T) { {workdir, "evalmatrixneeds2", "push", "", platforms, secrets}, {workdir, "evalmatrix-merge-map", "push", "", platforms, secrets}, {workdir, "evalmatrix-merge-array", "push", "", platforms, secrets}, - {workdir, "issue-1195", "push", "", platforms, secrets}, {workdir, "basic", "push", "", platforms, secrets}, {workdir, "fail", "push", "exit with `FAILURE`: 1", platforms, secrets}, @@ -274,7 +273,7 @@ func TestRunEvent(t *testing.T) { {workdir, "container-hostname", "push", "", platforms, secrets}, {workdir, "remote-action-docker", "push", "", platforms, secrets}, {workdir, "remote-action-js", "push", "", platforms, secrets}, - {workdir, "remote-action-js-node-user", "push", "", platforms, secrets}, // Test if this works with non root container + // {workdir, "remote-action-js-node-user", "push", "", platforms, secrets}, // Test if this works with non root container {workdir, "matrix", "push", "", platforms, secrets}, {workdir, "matrix-include-exclude", "push", "", platforms, secrets}, {workdir, "matrix-exitcode", "push", "Job 'test' failed", platforms, secrets}, @@ -309,7 +308,6 @@ func TestRunEvent(t *testing.T) { {workdir, "workflow_dispatch-scalar-composite-action", "workflow_dispatch", "", platforms, secrets}, {workdir, "job-needs-context-contains-result", "push", "", platforms, secrets}, {"../model/testdata", "strategy", "push", "", platforms, secrets}, // TODO: move all testdata into pkg so we can validate it with planner and runner - {"../model/testdata", "container-volumes", "push", "", platforms, secrets}, {workdir, "path-handling", "push", "", platforms, secrets}, {workdir, "do-not-leak-step-env-in-composite", "push", "", platforms, secrets}, {workdir, "set-env-step-env-override", "push", "", platforms, secrets}, @@ -319,11 +317,7 @@ func TestRunEvent(t *testing.T) { // services {workdir, "services", "push", "", platforms, secrets}, - {workdir, "services-host-network", "push", "", platforms, secrets}, {workdir, "services-with-container", "push", "", platforms, secrets}, - - // local remote action overrides - {workdir, "local-remote-action-overrides", "push", "", platforms, secrets}, } for _, table := range tables { @@ -359,105 +353,7 @@ func TestRunEvent(t *testing.T) { } } -func TestRunEventHostEnvironment(t *testing.T) { - if testing.Short() { - t.Skip("skipping integration test") - } - - ctx := context.Background() - - tables := []TestJobFileInfo{} - - if runtime.GOOS == "linux" { - platforms := map[string]string{ - "ubuntu-latest": "-self-hosted", - } - - tables = append(tables, []TestJobFileInfo{ - // Shells - {workdir, "shells/defaults", "push", "", platforms, secrets}, - {workdir, "shells/pwsh", "push", "", platforms, secrets}, - {workdir, "shells/bash", "push", "", platforms, secrets}, - {workdir, "shells/python", "push", "", platforms, secrets}, - {workdir, "shells/sh", "push", "", platforms, secrets}, - - // Local action - {workdir, "local-action-js", "push", "", platforms, secrets}, - - // Uses - {workdir, "uses-composite", "push", "", platforms, secrets}, - {workdir, "uses-composite-with-error", "push", "Job 'failing-composite-action' failed", platforms, secrets}, - {workdir, "uses-nested-composite", "push", "", platforms, secrets}, - {workdir, "act-composite-env-test", "push", "", platforms, secrets}, - {workdir, "uses-sh", "push", "", platforms, secrets}, - {workdir, "uses-sh-test-action-path", "push", "", platforms, secrets}, - - // Eval - {workdir, "evalmatrix", "push", "", platforms, secrets}, - {workdir, "evalmatrixneeds", "push", "", platforms, secrets}, - {workdir, "evalmatrixneeds2", "push", "", platforms, secrets}, - {workdir, "evalmatrix-merge-map", "push", "", platforms, secrets}, - {workdir, "evalmatrix-merge-array", "push", "", platforms, secrets}, - {workdir, "issue-1195", "push", "", platforms, secrets}, - - {workdir, "fail", "push", "exit with `FAILURE`: 1", platforms, secrets}, - {workdir, "runs-on", "push", "", platforms, secrets}, - {workdir, "checkout", "push", "", platforms, secrets}, - {workdir, "remote-action-js", "push", "", platforms, secrets}, - {workdir, "matrix", "push", "", platforms, secrets}, - {workdir, "matrix-include-exclude", "push", "", platforms, secrets}, - {workdir, "commands", "push", "", platforms, secrets}, - {workdir, "defaults-run", "push", "", platforms, secrets}, - {workdir, "composite-fail-with-output", "push", "", platforms, secrets}, - {workdir, "issue-597", "push", "", platforms, secrets}, - {workdir, "issue-598", "push", "", platforms, secrets}, - {workdir, "if-env-act", "push", "", platforms, secrets}, - {workdir, "env-and-path", "push", "", platforms, secrets}, - {workdir, "non-existent-action", "push", "Job 'nopanic' failed", platforms, secrets}, - {workdir, "outputs", "push", "", platforms, secrets}, - {workdir, "steps-context/conclusion", "push", "", platforms, secrets}, - {workdir, "steps-context/outcome", "push", "", platforms, secrets}, - {workdir, "job-status-check", "push", "job 'fail' failed", platforms, secrets}, - {workdir, "if-expressions", "push", "Job 'mytest' failed", platforms, secrets}, - {workdir, "uses-action-with-pre-and-post-step", "push", "", platforms, secrets}, - {workdir, "evalenv", "push", "", platforms, secrets}, - {workdir, "ensure-post-steps", "push", "Job 'second-post-step-should-fail' failed", platforms, secrets}, - }...) - } - if runtime.GOOS == "windows" { - platforms := map[string]string{ - "windows-latest": "-self-hosted", - } - - tables = append(tables, []TestJobFileInfo{ - {workdir, "windows-prepend-path", "push", "", platforms, secrets}, - {workdir, "windows-add-env", "push", "", platforms, secrets}, - {workdir, "windows-shell-cmd", "push", "", platforms, secrets}, - }...) - } else { - platforms := map[string]string{ - "self-hosted": "-self-hosted", - "ubuntu-latest": "-self-hosted", - } - - tables = append(tables, []TestJobFileInfo{ - {workdir, "nix-prepend-path", "push", "", platforms, secrets}, - {workdir, "inputs-via-env-context", "push", "", platforms, secrets}, - {workdir, "do-not-leak-step-env-in-composite", "push", "", platforms, secrets}, - {workdir, "set-env-step-env-override", "push", "", platforms, secrets}, - {workdir, "set-env-new-env-file-per-step", "push", "", platforms, secrets}, - {workdir, "no-panic-on-invalid-composite-action", "push", "jobs failed due to invalid action", platforms, secrets}, - }...) - } - - for _, table := range tables { - t.Run(table.workflowPath, func(t *testing.T) { - table.runTest(ctx, t, &Config{}) - }) - } -} - -func TestDryrunEvent(t *testing.T) { +func TestRunner_DryrunEvent(t *testing.T) { if testing.Short() { t.Skip("skipping integration test") } @@ -486,7 +382,7 @@ func TestDryrunEvent(t *testing.T) { } } -func TestDockerActionForcePullForceRebuild(t *testing.T) { +func TestRunner_DockerActionForcePullForceRebuild(t *testing.T) { if testing.Short() { t.Skip("skipping integration test") } @@ -510,7 +406,7 @@ func TestDockerActionForcePullForceRebuild(t *testing.T) { } } -func TestRunDifferentArchitecture(t *testing.T) { +func TestRunner_RunDifferentArchitecture(t *testing.T) { if testing.Short() { t.Skip("skipping integration test") } @@ -542,7 +438,7 @@ func (h *runSkippedHook) Fire(entry *log.Entry) error { return nil } -func TestRunSkipped(t *testing.T) { +func TestRunner_RunSkipped(t *testing.T) { if testing.Short() { t.Skip("skipping integration test") } @@ -579,7 +475,7 @@ func (f *maskJobLoggerFactory) WithJobLogger() *log.Logger { return logger } -func TestMaskValues(t *testing.T) { +func TestRunner_MaskValues(t *testing.T) { assertNoSecret := func(text, secret string) { index := strings.Index(text, "composite secret") if index > -1 { @@ -610,7 +506,7 @@ func TestMaskValues(t *testing.T) { assertNoSecret(output, "YWJjCg==") } -func TestRunEventSecrets(t *testing.T) { +func TestRunner_RunEventSecrets(t *testing.T) { if testing.Short() { t.Skip("skipping integration test") } @@ -632,7 +528,7 @@ func TestRunEventSecrets(t *testing.T) { tjfi.runTest(context.Background(), t, &Config{Secrets: secrets, Env: env}) } -func TestRunWithService(t *testing.T) { +func TestRunner_RunWithService(t *testing.T) { if testing.Short() { t.Skip("skipping integration test") } @@ -669,7 +565,7 @@ func TestRunWithService(t *testing.T) { assert.NoError(t, err, workflowPath) } -func TestRunActionInputs(t *testing.T) { +func TestRunner_RunActionInputs(t *testing.T) { if testing.Short() { t.Skip("skipping integration test") } @@ -690,7 +586,7 @@ func TestRunActionInputs(t *testing.T) { tjfi.runTest(context.Background(), t, &Config{Inputs: inputs}) } -func TestRunEventPullRequest(t *testing.T) { +func TestRunner_RunEventPullRequest(t *testing.T) { if testing.Short() { t.Skip("skipping integration test") } @@ -708,7 +604,7 @@ func TestRunEventPullRequest(t *testing.T) { tjfi.runTest(context.Background(), t, &Config{EventPath: filepath.Join(workdir, workflowPath, "event.json")}) } -func TestRunMatrixWithUserDefinedInclusions(t *testing.T) { +func TestRunner_RunMatrixWithUserDefinedInclusions(t *testing.T) { if testing.Short() { t.Skip("skipping integration test") } diff --git a/act/runner/step_action_remote_test.go b/act/runner/step_action_remote_test.go index 9dcc3383..74279bc6 100644 --- a/act/runner/step_action_remote_test.go +++ b/act/runner/step_action_remote_test.go @@ -5,7 +5,6 @@ import ( "context" "errors" "io" - "strings" "testing" "github.com/stretchr/testify/assert" @@ -21,7 +20,7 @@ type stepActionRemoteMocks struct { mock.Mock } -func (sarm *stepActionRemoteMocks) readAction(_ context.Context, step *model.Step, actionDir string, actionPath string, readFile actionYamlReader, writeFile fileWriter) (*model.Action, error) { +func (sarm *stepActionRemoteMocks) readAction(_ context.Context, step *model.Step, actionDir, actionPath string, readFile actionYamlReader, writeFile fileWriter) (*model.Action, error) { args := sarm.Called(step, actionDir, actionPath, readFile, writeFile) return args.Get(0).(*model.Action), args.Error(1) } @@ -31,7 +30,7 @@ func (sarm *stepActionRemoteMocks) runAction(step actionStep, actionDir string, return args.Get(0).(func(context.Context) error) } -func TestStepActionRemote(t *testing.T) { +func TestStepActionRemoteOK(t *testing.T) { table := []struct { name string stepModel *model.Step @@ -159,17 +158,11 @@ func TestStepActionRemote(t *testing.T) { } sar.RunContext.ExprEval = sar.RunContext.NewExpressionEvaluator(ctx) - suffixMatcher := func(suffix string) interface{} { - return mock.MatchedBy(func(actionDir string) bool { - return strings.HasSuffix(actionDir, suffix) - }) - } - if tt.mocks.read { - sarm.On("readAction", sar.Step, suffixMatcher("act/remote-action@v1"), "", mock.Anything, mock.Anything).Return(&model.Action{}, nil) + sarm.On("readAction", sar.Step, mock.Anything, "", mock.Anything, mock.Anything).Return(&model.Action{}, nil) } if tt.mocks.run { - sarm.On("runAction", sar, suffixMatcher("act/remote-action@v1"), newRemoteAction(sar.Step.Uses)).Return(func(ctx context.Context) error { return tt.runError }) + sarm.On("runAction", sar, mock.Anything, newRemoteAction(sar.Step.Uses)).Return(func(ctx context.Context) error { return tt.runError }) cm.On("Copy", "/var/run/act", mock.AnythingOfType("[]*container.FileEntry")).Return(func(ctx context.Context) error { return nil @@ -254,13 +247,7 @@ func TestStepActionRemotePre(t *testing.T) { readAction: sarm.readAction, } - suffixMatcher := func(suffix string) interface{} { - return mock.MatchedBy(func(actionDir string) bool { - return strings.HasSuffix(actionDir, suffix) - }) - } - - sarm.On("readAction", sar.Step, suffixMatcher("org-repo-path@ref"), "path", mock.Anything, mock.Anything).Return(&model.Action{}, nil) + sarm.On("readAction", sar.Step, mock.Anything, "path", mock.Anything, mock.Anything).Return(&model.Action{}, nil) err := sar.pre()(ctx) @@ -324,84 +311,7 @@ func TestStepActionRemotePreThroughAction(t *testing.T) { readAction: sarm.readAction, } - suffixMatcher := func(suffix string) interface{} { - return mock.MatchedBy(func(actionDir string) bool { - return strings.HasSuffix(actionDir, suffix) - }) - } - - sarm.On("readAction", sar.Step, suffixMatcher("org-repo-path@ref"), "path", mock.Anything, mock.Anything).Return(&model.Action{}, nil) - - err := sar.pre()(ctx) - - assert.Nil(t, err) - assert.Equal(t, true, clonedAction) - - sarm.AssertExpectations(t) - }) - } -} - -func TestStepActionRemotePreThroughActionToken(t *testing.T) { - table := []struct { - name string - stepModel *model.Step - }{ - { - name: "run-pre", - stepModel: &model.Step{ - Uses: "org/repo/path@ref", - }, - }, - } - - for _, tt := range table { - t.Run(tt.name, func(t *testing.T) { - ctx := context.Background() - - clonedAction := false - sarm := &stepActionRemoteMocks{} - - origStepAtionRemoteNewCloneExecutor := stepActionRemoteNewCloneExecutor - stepActionRemoteNewCloneExecutor = func(input git.NewGitCloneExecutorInput) common.Executor { - return func(ctx context.Context) error { - if input.URL == "https://github.com/org/repo" && input.Token == "PRIVATE_ACTIONS_TOKEN_ON_GITHUB" { - clonedAction = true - } - return nil - } - } - defer (func() { - stepActionRemoteNewCloneExecutor = origStepAtionRemoteNewCloneExecutor - })() - - sar := &stepActionRemote{ - Step: tt.stepModel, - RunContext: &RunContext{ - Config: &Config{ - GitHubInstance: "https://enterprise.github.com", - ReplaceGheActionWithGithubCom: []string{"org/repo"}, - ReplaceGheActionTokenWithGithubCom: "PRIVATE_ACTIONS_TOKEN_ON_GITHUB", - }, - Run: &model.Run{ - JobID: "1", - Workflow: &model.Workflow{ - Jobs: map[string]*model.Job{ - "1": {}, - }, - }, - }, - }, - readAction: sarm.readAction, - } - - suffixMatcher := func(suffix string) interface{} { - return mock.MatchedBy(func(actionDir string) bool { - return strings.HasSuffix(actionDir, suffix) - }) - } - - sarm.On("readAction", sar.Step, suffixMatcher("org-repo-path@ref"), "path", mock.Anything, mock.Anything).Return(&model.Action{}, nil) + sarm.On("readAction", sar.Step, mock.Anything, "path", mock.Anything, mock.Anything).Return(&model.Action{}, nil) err := sar.pre()(ctx) @@ -580,7 +490,7 @@ func TestStepActionRemotePost(t *testing.T) { sar.RunContext.ExprEval = sar.RunContext.NewExpressionEvaluator(ctx) if tt.mocks.exec { - cm.On("Exec", []string{"node", "/var/run/act/actions/remote-action@v1/post.js"}, sar.env, "", "").Return(func(ctx context.Context) error { return tt.err }) + cm.On("Exec", mock.Anything, sar.env, "", "").Return(func(ctx context.Context) error { return tt.err }) cm.On("Copy", "/var/run/act", mock.AnythingOfType("[]*container.FileEntry")).Return(func(ctx context.Context) error { return nil diff --git a/act/runner/step_test.go b/act/runner/step_test.go index 6fdbe716..8feba0eb 100644 --- a/act/runner/step_test.go +++ b/act/runner/step_test.go @@ -12,7 +12,7 @@ import ( yaml "gopkg.in/yaml.v3" ) -func TestMergeIntoMap(t *testing.T) { +func TestStep_MergeIntoMap(t *testing.T) { table := []struct { name string target map[string]string @@ -111,89 +111,7 @@ func (sm *stepMock) getEnv() *map[string]string { return args.Get(0).(*map[string]string) } -func TestSetupEnv(t *testing.T) { - cm := &containerMock{} - sm := &stepMock{} - - rc := &RunContext{ - Config: &Config{ - Env: map[string]string{ - "GITHUB_RUN_ID": "runId", - }, - }, - Run: &model.Run{ - JobID: "1", - Workflow: &model.Workflow{ - Jobs: map[string]*model.Job{ - "1": { - Env: yaml.Node{ - Value: "JOB_KEY: jobvalue", - }, - }, - }, - }, - }, - Env: map[string]string{ - "RC_KEY": "rcvalue", - }, - JobContainer: cm, - } - step := &model.Step{ - With: map[string]string{ - "STEP_WITH": "with-value", - }, - } - env := map[string]string{} - - sm.On("getRunContext").Return(rc) - sm.On("getGithubContext").Return(rc) - sm.On("getStepModel").Return(step) - sm.On("getEnv").Return(&env) - - err := setupEnv(context.Background(), sm) - assert.Nil(t, err) - - // These are commit or system specific - delete((env), "GITHUB_REF") - delete((env), "GITHUB_REF_NAME") - delete((env), "GITHUB_REF_TYPE") - delete((env), "GITHUB_SHA") - delete((env), "GITHUB_WORKSPACE") - delete((env), "GITHUB_REPOSITORY") - delete((env), "GITHUB_REPOSITORY_OWNER") - delete((env), "GITHUB_ACTOR") - - assert.Equal(t, map[string]string{ - "ACT": "true", - "CI": "true", - "GITHUB_ACTION": "", - "GITHUB_ACTIONS": "true", - "GITHUB_ACTION_PATH": "", - "GITHUB_ACTION_REF": "", - "GITHUB_ACTION_REPOSITORY": "", - "GITHUB_API_URL": "https:///api/v3", - "GITHUB_BASE_REF": "", - "GITHUB_EVENT_NAME": "", - "GITHUB_EVENT_PATH": "/var/run/act/workflow/event.json", - "GITHUB_GRAPHQL_URL": "https:///api/graphql", - "GITHUB_HEAD_REF": "", - "GITHUB_JOB": "1", - "GITHUB_RETENTION_DAYS": "0", - "GITHUB_RUN_ID": "runId", - "GITHUB_RUN_NUMBER": "1", - "GITHUB_SERVER_URL": "https://", - "GITHUB_TOKEN": "", - "GITHUB_WORKFLOW": "", - "INPUT_STEP_WITH": "with-value", - "RC_KEY": "rcvalue", - "RUNNER_PERFLOG": "/dev/null", - "RUNNER_TRACKING_ID": "", - }, env) - - cm.AssertExpectations(t) -} - -func TestIsStepEnabled(t *testing.T) { +func TestStep_IsStepEnabled(t *testing.T) { createTestStep := func(t *testing.T, input string) step { var step *model.Step err := yaml.Unmarshal([]byte(input), &step) @@ -275,7 +193,7 @@ func TestIsStepEnabled(t *testing.T) { assertObject.True(isStepEnabled(context.Background(), step.getStepModel().If.Value, step, stepStageMain)) } -func TestIsContinueOnError(t *testing.T) { +func TestStep_IsContinueOnError(t *testing.T) { createTestStep := func(t *testing.T, input string) step { var step *model.Step err := yaml.Unmarshal([]byte(input), &step) diff --git a/act/runner/testdata/GITHUB_ENV-use-in-env-ctx/push.yml b/act/runner/testdata/GITHUB_ENV-use-in-env-ctx/push.yml index c7b75a02..79681739 100644 --- a/act/runner/testdata/GITHUB_ENV-use-in-env-ctx/push.yml +++ b/act/runner/testdata/GITHUB_ENV-use-in-env-ctx/push.yml @@ -8,7 +8,7 @@ jobs: - run: | echo MYGLOBALENV1=myglobalval1 > $GITHUB_ENV echo "::set-env name=MYGLOBALENV2::myglobalval2" - - uses: nektos/act-test-actions/script@main + - uses: https://code.forgejo.org/forgejo/act-test-actions/script@main with: main: | env @@ -24,4 +24,4 @@ jobs: env: MYGLOBALENV1ALIAS: ${{ env.MYGLOBALENV1 }} MYGLOBALENV2ALIAS: ${{ env.MYGLOBALENV2 }} - MYGLOBALENV3ALIAS: ${{ env.MYGLOBALENV3 }} \ No newline at end of file + MYGLOBALENV3ALIAS: ${{ env.MYGLOBALENV3 }} diff --git a/act/runner/testdata/GITHUB_STATE/push.yml b/act/runner/testdata/GITHUB_STATE/push.yml index 61afc07c..4d8326ff 100644 --- a/act/runner/testdata/GITHUB_STATE/push.yml +++ b/act/runner/testdata/GITHUB_STATE/push.yml @@ -3,7 +3,7 @@ jobs: _: runs-on: ubuntu-latest steps: - - uses: nektos/act-test-actions/script@main + - uses: https://code.forgejo.org/forgejo/act-test-actions/script@main with: pre: | env @@ -22,7 +22,7 @@ jobs: test-id-collision-bug: runs-on: ubuntu-latest steps: - - uses: nektos/act-test-actions/script@main + - uses: https://code.forgejo.org/forgejo/act-test-actions/script@main id: script with: pre: | @@ -39,10 +39,10 @@ jobs: [ "$STATE_mystate1" = "mystateval" ] [ "$STATE_mystate2" = "mystateval" ] [ "$STATE_mystate3" = "mystateval" ] - - uses: nektos/act-test-actions/script@main + - uses: https://code.forgejo.org/forgejo/act-test-actions/script@main id: pre-script with: main: | env echo mystate0=mystateerror > $GITHUB_STATE - echo "::save-state name=mystate1::mystateerror" \ No newline at end of file + echo "::save-state name=mystate1::mystateerror" diff --git a/act/runner/testdata/act-composite-env-test/push.yml b/act/runner/testdata/act-composite-env-test/push.yml index da7109eb..64c9b7ae 100644 --- a/act/runner/testdata/act-composite-env-test/push.yml +++ b/act/runner/testdata/act-composite-env-test/push.yml @@ -7,7 +7,7 @@ jobs: env: JOB: "1" steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 - uses: ./act-composite-env-test/action1 env: COMPOSITE_OVERRIDE: "1" diff --git a/act/runner/testdata/actions-environment-and-context-tests/push.yml b/act/runner/testdata/actions-environment-and-context-tests/push.yml index 1d799d57..7337e7f8 100644 --- a/act/runner/testdata/actions-environment-and-context-tests/push.yml +++ b/act/runner/testdata/actions-environment-and-context-tests/push.yml @@ -6,10 +6,10 @@ jobs: check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: https://data.forgejo.org/actions/checkout@v3 - uses: './actions-environment-and-context-tests/js' - uses: './actions-environment-and-context-tests/docker' - - uses: 'nektos/act-test-actions/js@main' - - uses: 'nektos/act-test-actions/docker@main' - - uses: 'nektos/act-test-actions/docker-file@main' - - uses: 'nektos/act-test-actions/docker-relative-context/action@main' + - uses: 'https://code.forgejo.org/forgejo/act-test-actions/js@main' + - uses: 'https://code.forgejo.org/forgejo/act-test-actions/docker@main' + - uses: 'https://code.forgejo.org/forgejo/act-test-actions/docker-file@main' + - uses: 'https://code.forgejo.org/forgejo/act-test-actions/docker-relative-context/action@main' diff --git a/act/runner/testdata/basic/push.yml b/act/runner/testdata/basic/push.yml index 35b78211..02d82ef5 100644 --- a/act/runner/testdata/basic/push.yml +++ b/act/runner/testdata/basic/push.yml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest needs: [check] steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 - uses: ./actions/action1 with: args: echo 'build' diff --git a/act/runner/testdata/checkout/push.yml b/act/runner/testdata/checkout/push.yml index c18eaa1a..f19abaca 100644 --- a/act/runner/testdata/checkout/push.yml +++ b/act/runner/testdata/checkout/push.yml @@ -5,4 +5,4 @@ jobs: checkout: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 diff --git a/act/runner/testdata/composite-fail-with-output/push.yml b/act/runner/testdata/composite-fail-with-output/push.yml index b167d002..b7392c8d 100644 --- a/act/runner/testdata/composite-fail-with-output/push.yml +++ b/act/runner/testdata/composite-fail-with-output/push.yml @@ -5,7 +5,7 @@ jobs: test-for-output: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 - uses: ./actions/composite-fail-with-output id: composite-fail-with-output continue-on-error: true diff --git a/act/runner/testdata/container-hostname/push.yml b/act/runner/testdata/container-hostname/push.yml index 2235a7bb..ae69ebf2 100644 --- a/act/runner/testdata/container-hostname/push.yml +++ b/act/runner/testdata/container-hostname/push.yml @@ -9,22 +9,18 @@ jobs: with-hostname: runs-on: ubuntu-latest container: - image: node:16-buster-slim - options: "--hostname my.host.local --user 100:101" + image: code.forgejo.org/oci/node:22-bookworm + options: "--hostname my.host.local" steps: - run: | - echo "UID: $(id -u)" - echo "GID: $(id -g)" echo "HOST: $(uname -n)" - [[ "$(id -u)" == "100" ]] && [[ "$(id -g)" == "101" ]] && [[ "$(uname -n)" == "my.host.local" ]] + [[ "$(uname -n)" == "my.host.local" ]] default-hostname: runs-on: ubuntu-latest container: - image: node:16-buster-slim + image: code.forgejo.org/oci/node:22-bookworm steps: - run: | - echo "UID: $(id -u)" - echo "GID: $(id -g)" echo "HOST: $(uname -n)" - [[ "$(id -u)" == "0" ]] && [[ "$(id -g)" == "0" ]] && [[ $(uname -n) ]] && [[ "$(uname -n)" != "my.host.local" ]] + [[ "$(uname -n)" != "my.host.local" ]] diff --git a/act/runner/testdata/ensure-post-steps/push.yml b/act/runner/testdata/ensure-post-steps/push.yml index 3e67b35a..da529a34 100644 --- a/act/runner/testdata/ensure-post-steps/push.yml +++ b/act/runner/testdata/ensure-post-steps/push.yml @@ -4,5 +4,5 @@ jobs: second-post-step-should-fail: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: https://data.forgejo.org/actions/checkout@v3 - uses: ./ensure-post-steps/action-composite/ diff --git a/act/runner/testdata/if-expressions/push.yml b/act/runner/testdata/if-expressions/push.yml index 36535b3d..c6dcab0f 100644 --- a/act/runner/testdata/if-expressions/push.yml +++ b/act/runner/testdata/if-expressions/push.yml @@ -3,7 +3,7 @@ jobs: mytest: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 # - run: exit 1 - uses: ./ if: failure() @@ -26,4 +26,4 @@ jobs: needs: mytest runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 diff --git a/act/runner/testdata/inputs-via-env-context/push.yml b/act/runner/testdata/inputs-via-env-context/push.yml index 07fadeb1..c0edbd78 100644 --- a/act/runner/testdata/inputs-via-env-context/push.yml +++ b/act/runner/testdata/inputs-via-env-context/push.yml @@ -3,7 +3,7 @@ jobs: test-inputs-via-env-context: runs-on: self-hosted steps: - - uses: actions/checkout@v3 + - uses: https://data.forgejo.org/actions/checkout@v3 - uses: ./inputs-via-env-context with: test-env-input: ${{ env.test-env-input }} diff --git a/act/runner/testdata/issue-104/main.yaml b/act/runner/testdata/issue-104/main.yaml index 4718d024..78fda669 100644 --- a/act/runner/testdata/issue-104/main.yaml +++ b/act/runner/testdata/issue-104/main.yaml @@ -10,6 +10,6 @@ jobs: steps: - name: hello - uses: actions/hello-world-docker-action@v1 + uses: https://github.com/actions/hello-world-docker-action@v1 with: who-to-greet: "World" diff --git a/act/runner/testdata/issue-1195/push.yml b/act/runner/testdata/issue-1195/push.yml deleted file mode 100644 index c211ad2c..00000000 --- a/act/runner/testdata/issue-1195/push.yml +++ /dev/null @@ -1,13 +0,0 @@ -on: push - -env: - variable: "${{ github.repository_owner }}" - -jobs: - test: - runs-on: ubuntu-latest - steps: - - name: print env.variable - run: | - echo ${{ env.variable }} - exit ${{ (env.variable == 'nektos') && '0' || '1'}} diff --git a/act/runner/testdata/issue-122/main.yaml b/act/runner/testdata/issue-122/main.yaml index a9c97043..06b37291 100644 --- a/act/runner/testdata/issue-122/main.yaml +++ b/act/runner/testdata/issue-122/main.yaml @@ -8,11 +8,11 @@ jobs: name: Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 with: path: test-subdir1 - run: grep "Checkout" test-subdir1/issue-122/main.yaml - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 with: repository: actions/checkout path: test-subdir2 diff --git a/act/runner/testdata/issue-141/main.yaml b/act/runner/testdata/issue-141/main.yaml index d1f50c33..7e6c2cef 100644 --- a/act/runner/testdata/issue-141/main.yaml +++ b/act/runner/testdata/issue-141/main.yaml @@ -5,7 +5,7 @@ jobs: kind: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: https://data.forgejo.org/actions/checkout@master - uses: engineerd/setup-kind@v0.3.0 - name: Testing run: | diff --git a/act/runner/testdata/issue-597/spelling.yaml b/act/runner/testdata/issue-597/spelling.yaml index d594dcbb..469f1500 100644 --- a/act/runner/testdata/issue-597/spelling.yaml +++ b/act/runner/testdata/issue-597/spelling.yaml @@ -9,24 +9,24 @@ jobs: steps: - name: My first false step if: "endsWith('Should not', 'o1')" - uses: actions/checkout@v2.0.0 + uses: https://data.forgejo.org/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 + uses: https://github.com/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 + uses: https://data.forgejo.org/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 + uses: https://data.forgejo.org/actions/checkout@v2.0.0 with: ref: refs/pull/${{github.event.pull_request.number}}/merge fetch-depth: 5 diff --git a/act/runner/testdata/issue-598/spelling.yml b/act/runner/testdata/issue-598/spelling.yml index 65255f97..46dcc77f 100644 --- a/act/runner/testdata/issue-598/spelling.yml +++ b/act/runner/testdata/issue-598/spelling.yml @@ -9,22 +9,22 @@ jobs: steps: - name: My first false step if: "endsWith('Hello world', 'o1')" - uses: actions/hello-world-javascript-action@main + uses: https://github.com/actions/hello-world-javascript-action@main with: who-to-greet: 'Mona the Octocat' - name: My first true step if: "!endsWith('Hello world', 'od')" - uses: actions/hello-world-javascript-action@main + uses: https://github.com/actions/hello-world-javascript-action@main with: who-to-greet: "Renst the Octocat" - name: My second false step if: "endsWith('Hello world', 'o2')" - uses: actions/hello-world-javascript-action@main + uses: https://github.com/actions/hello-world-javascript-action@main with: who-to-greet: 'Act the Octocat' - name: My third false step if: "endsWith('Hello world', 'o2')" - uses: actions/hello-world-javascript-action@main + uses: https://github.com/actions/hello-world-javascript-action@main with: who-to-greet: 'Git the Octocat' diff --git a/act/runner/testdata/local-action-docker-url/push.yml b/act/runner/testdata/local-action-docker-url/push.yml index 5de1437c..b5e8272d 100644 --- a/act/runner/testdata/local-action-docker-url/push.yml +++ b/act/runner/testdata/local-action-docker-url/push.yml @@ -5,5 +5,5 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 - uses: ./actions/docker-url diff --git a/act/runner/testdata/local-action-dockerfile/push.yml b/act/runner/testdata/local-action-dockerfile/push.yml index a4a5b06e..56a14f34 100644 --- a/act/runner/testdata/local-action-dockerfile/push.yml +++ b/act/runner/testdata/local-action-dockerfile/push.yml @@ -8,7 +8,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 - uses: ./actions/docker-local id: dockerlocal with: diff --git a/act/runner/testdata/local-action-js/push.yml b/act/runner/testdata/local-action-js/push.yml index 4f3eb564..93064ffe 100644 --- a/act/runner/testdata/local-action-js/push.yml +++ b/act/runner/testdata/local-action-js/push.yml @@ -5,7 +5,7 @@ jobs: test-node12: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 - uses: ./actions/node12 with: who-to-greet: 'Mona the Octocat' @@ -13,7 +13,7 @@ jobs: test-node16: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 - uses: ./actions/node16 with: who-to-greet: 'Mona the Octocat' @@ -21,7 +21,7 @@ jobs: test-node20: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 - uses: ./actions/node20 with: who-to-greet: 'Mona the Octocat' diff --git a/act/runner/testdata/local-action-via-composite-dockerfile/action/action.yml b/act/runner/testdata/local-action-via-composite-dockerfile/action/action.yml index 94a1a786..1101f253 100644 --- a/act/runner/testdata/local-action-via-composite-dockerfile/action/action.yml +++ b/act/runner/testdata/local-action-via-composite-dockerfile/action/action.yml @@ -32,7 +32,7 @@ runs: shell: bash - uses: ./localdockerimagetest_ # Also test a remote docker action here - - uses: actions/hello-world-docker-action@v1 + - uses: https://github.com/actions/hello-world-docker-action@v1 with: who-to-greet: 'Mona the Octocat' # Test if GITHUB_ACTION_PATH is set correctly after all steps diff --git a/act/runner/testdata/local-action-via-composite-dockerfile/push.yml b/act/runner/testdata/local-action-via-composite-dockerfile/push.yml index 8174ebe4..3be7b4ce 100644 --- a/act/runner/testdata/local-action-via-composite-dockerfile/push.yml +++ b/act/runner/testdata/local-action-via-composite-dockerfile/push.yml @@ -5,5 +5,5 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 - uses: ./local-action-via-composite-dockerfile/action \ No newline at end of file diff --git a/act/runner/testdata/local-remote-action-overrides/config/config.yml b/act/runner/testdata/local-remote-action-overrides/config/config.yml deleted file mode 100644 index ecabeb5d..00000000 --- a/act/runner/testdata/local-remote-action-overrides/config/config.yml +++ /dev/null @@ -1,3 +0,0 @@ -local-repositories: - https://github.com/nektos/test-override@a: testdata/actions/node20 - nektos/test-override@b: testdata/actions/node16 \ No newline at end of file diff --git a/act/runner/testdata/local-remote-action-overrides/push.yml b/act/runner/testdata/local-remote-action-overrides/push.yml deleted file mode 100644 index 9482438f..00000000 --- a/act/runner/testdata/local-remote-action-overrides/push.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: basic -on: push - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: nektos/test-override@a - - uses: nektos/test-override@b \ No newline at end of file diff --git a/act/runner/testdata/mask-values/push.yml b/act/runner/testdata/mask-values/push.yml index befe73fb..3bc8972a 100644 --- a/act/runner/testdata/mask-values/push.yml +++ b/act/runner/testdata/mask-values/push.yml @@ -5,7 +5,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: https://data.forgejo.org/actions/checkout@v3 - run: echo "::add-mask::secret value" - run: echo "secret value" - uses: ./mask-values/composite diff --git a/act/runner/testdata/no-panic-on-invalid-composite-action/push.yml b/act/runner/testdata/no-panic-on-invalid-composite-action/push.yml index 6b9e4ae6..574d4d99 100644 --- a/act/runner/testdata/no-panic-on-invalid-composite-action/push.yml +++ b/act/runner/testdata/no-panic-on-invalid-composite-action/push.yml @@ -22,8 +22,8 @@ jobs: remote-invalid-step: runs-on: ubuntu-latest steps: - - uses: nektos/act-test-actions/invalid-composite-action/invalid-step@main + - uses: https://code.forgejo.org/forgejo/act-test-actions/invalid-composite-action/invalid-step@main remote-missing-steps: runs-on: ubuntu-latest steps: - - uses: nektos/act-test-actions/invalid-composite-action/missing-steps@main \ No newline at end of file + - uses: https://code.forgejo.org/forgejo/act-test-actions/invalid-composite-action/missing-steps@main diff --git a/act/runner/testdata/node/push.yml b/act/runner/testdata/node/push.yml index 4dfc80d4..7758cee2 100644 --- a/act/runner/testdata/node/push.yml +++ b/act/runner/testdata/node/push.yml @@ -6,8 +6,8 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: https://data.forgejo.org/actions/checkout@v2 + - uses: https://github.com/actions/setup-node@v1 with: node-version: 12.6 - run: which node diff --git a/act/runner/testdata/parallel/push.yml b/act/runner/testdata/parallel/push.yml index c949d3d2..a2de0a9d 100644 --- a/act/runner/testdata/parallel/push.yml +++ b/act/runner/testdata/parallel/push.yml @@ -5,11 +5,11 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 - uses: ./actions/action1 with: args: echo 'build' - - uses: actions/hello-world-javascript-action@master + - uses: https://github.com/actions/hello-world-javascript-action@master with: who-to-greet: 'Mona the Octocat' test1: diff --git a/act/runner/testdata/path-handling/push.yml b/act/runner/testdata/path-handling/push.yml index 812c8b8a..e087efeb 100644 --- a/act/runner/testdata/path-handling/push.yml +++ b/act/runner/testdata/path-handling/push.yml @@ -4,12 +4,12 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: https://data.forgejo.org/actions/checkout@v3 - name: "Append to $GITHUB_PATH" run: | echo "/opt/hostedtoolcache/node/18.99/x64/bin" >> $GITHUB_PATH - + - name: test path (after setup) run: | if ! echo "$PATH" |grep "/opt/hostedtoolcache/node/18.*/\(x64\|arm64\)/bin" ; then @@ -27,7 +27,7 @@ jobs: exit 1 fi - - uses: nektos/act-test-actions/composite@main + - uses: https://code.forgejo.org/forgejo/act-test-actions/composite@main with: input: some input diff --git a/act/runner/testdata/python/main.yml b/act/runner/testdata/python/main.yml index 9df75093..9d550a2e 100644 --- a/act/runner/testdata/python/main.yml +++ b/act/runner/testdata/python/main.yml @@ -9,8 +9,8 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v1.1.1 + - uses: https://data.forgejo.org/actions/checkout@v2 + - uses: https://github.com/actions/setup-python@v1.1.1 with: python-version: 3.7 diff --git a/act/runner/testdata/remote-action-composite-action-ref/push.yml b/act/runner/testdata/remote-action-composite-action-ref/push.yml index 65876511..a69edc85 100644 --- a/act/runner/testdata/remote-action-composite-action-ref/push.yml +++ b/act/runner/testdata/remote-action-composite-action-ref/push.yml @@ -5,4 +5,4 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: nektos/act-test-actions/composite-assert-action-ref-action@main + - uses: https://code.forgejo.org/forgejo/act-test-actions/composite-assert-action-ref-action@main diff --git a/act/runner/testdata/remote-action-composite-js-pre-with-defaults/push.yml b/act/runner/testdata/remote-action-composite-js-pre-with-defaults/push.yml index 90a2987d..9e0b3e52 100644 --- a/act/runner/testdata/remote-action-composite-js-pre-with-defaults/push.yml +++ b/act/runner/testdata/remote-action-composite-js-pre-with-defaults/push.yml @@ -5,19 +5,19 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: nektos/act-test-actions/composite-js-pre-with-defaults/js@main + - uses: https://code.forgejo.org/forgejo/act-test-actions/composite-js-pre-with-defaults/js@main with: in: nix - - uses: nektos/act-test-actions/composite-js-pre-with-defaults@main + - uses: https://code.forgejo.org/forgejo/act-test-actions/composite-js-pre-with-defaults@main with: in: secretval - - uses: nektos/act-test-actions/composite-js-pre-with-defaults@main + - uses: https://code.forgejo.org/forgejo/act-test-actions/composite-js-pre-with-defaults@main with: in: secretval - - uses: nektos/act-test-actions/composite-js-pre-with-defaults/js@main + - uses: https://code.forgejo.org/forgejo/act-test-actions/composite-js-pre-with-defaults/js@main with: pre: "true" in: nix - - uses: nektos/act-test-actions/composite-js-pre-with-defaults/js@main + - uses: https://code.forgejo.org/forgejo/act-test-actions/composite-js-pre-with-defaults/js@main with: - in: nix \ No newline at end of file + in: nix diff --git a/act/runner/testdata/remote-action-docker/push.yml b/act/runner/testdata/remote-action-docker/push.yml index a1ba05b5..dc6e11d3 100644 --- a/act/runner/testdata/remote-action-docker/push.yml +++ b/act/runner/testdata/remote-action-docker/push.yml @@ -5,6 +5,6 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/hello-world-docker-action@v1 + - uses: https://github.com/actions/hello-world-docker-action@v1 with: who-to-greet: 'Mona the Octocat' diff --git a/act/runner/testdata/remote-action-js-node-user/push.yml b/act/runner/testdata/remote-action-js-node-user/push.yml index 8bf45da4..40d01091 100644 --- a/act/runner/testdata/remote-action-js-node-user/push.yml +++ b/act/runner/testdata/remote-action-js-node-user/push.yml @@ -23,7 +23,7 @@ jobs: exit 1 shell: bash - - uses: actions/hello-world-javascript-action@v1 + - uses: https://github.com/actions/hello-world-javascript-action@v1 with: who-to-greet: 'Mona the Octocat' diff --git a/act/runner/testdata/remote-action-js/push.yml b/act/runner/testdata/remote-action-js/push.yml index c284e6d8..fa8e9df8 100644 --- a/act/runner/testdata/remote-action-js/push.yml +++ b/act/runner/testdata/remote-action-js/push.yml @@ -5,8 +5,8 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/hello-world-javascript-action@v1 + - uses: https://github.com/actions/hello-world-javascript-action@v1 with: who-to-greet: 'Mona the Octocat' - - uses: cloudposse/actions/github/slash-command-dispatch@0.14.0 + - uses: https://github.com/cloudposse/actions/github/slash-command-dispatch@0.14.0 diff --git a/act/runner/testdata/services-host-network/push.yml b/act/runner/testdata/services-host-network/push.yml deleted file mode 100644 index 8d0eb294..00000000 --- a/act/runner/testdata/services-host-network/push.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: services-host-network -on: push -jobs: - services-host-network: - runs-on: ubuntu-latest - services: - nginx: - image: "nginx:latest" - ports: - - "8080:80" - steps: - - run: apt-get -qq update && apt-get -yqq install --no-install-recommends curl net-tools - - run: netstat -tlpen - - run: curl -v http://localhost:8080 diff --git a/act/runner/testdata/services-with-container/push.yml b/act/runner/testdata/services-with-container/push.yml index b37e5dcd..deafc607 100644 --- a/act/runner/testdata/services-with-container/push.yml +++ b/act/runner/testdata/services-with-container/push.yml @@ -5,7 +5,7 @@ jobs: runs-on: ubuntu-latest # https://docs.github.com/en/actions/using-containerized-services/about-service-containers#running-jobs-in-a-container container: - image: "ubuntu:latest" + image: code.forgejo.org/oci/node:22-bookworm services: nginx: image: "nginx:latest" diff --git a/act/runner/testdata/uses-action-with-pre-and-post-step/push.yml b/act/runner/testdata/uses-action-with-pre-and-post-step/push.yml index 0c3b7933..a2f04eb2 100644 --- a/act/runner/testdata/uses-action-with-pre-and-post-step/push.yml +++ b/act/runner/testdata/uses-action-with-pre-and-post-step/push.yml @@ -5,9 +5,9 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 - uses: ./uses-action-with-pre-and-post-step/last-action - - uses: nektos/act-test-actions/js-with-pre-and-post-step@main + - uses: https://code.forgejo.org/forgejo/act-test-actions/js-with-pre-and-post-step@main with: pre: true post: true diff --git a/act/runner/testdata/uses-and-run-in-one-step/push.yml b/act/runner/testdata/uses-and-run-in-one-step/push.yml index bbdf868d..e3222212 100644 --- a/act/runner/testdata/uses-and-run-in-one-step/push.yml +++ b/act/runner/testdata/uses-and-run-in-one-step/push.yml @@ -7,4 +7,4 @@ jobs: steps: - name: Test run: echo - uses: actions/checkout@v2 + uses: https://data.forgejo.org/actions/checkout@v2 diff --git a/act/runner/testdata/uses-composite-with-error/push.yml b/act/runner/testdata/uses-composite-with-error/push.yml index 34289d89..a5e269f7 100644 --- a/act/runner/testdata/uses-composite-with-error/push.yml +++ b/act/runner/testdata/uses-composite-with-error/push.yml @@ -5,7 +5,7 @@ jobs: failing-composite-action: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 - uses: ./uses-composite-with-error/composite_action2 - run: echo should run if: failure() diff --git a/act/runner/testdata/uses-composite-with-inputs/composite/action.yml b/act/runner/testdata/uses-composite-with-inputs/composite/action.yml index 4ca6f6dc..60329cbc 100644 --- a/act/runner/testdata/uses-composite-with-inputs/composite/action.yml +++ b/act/runner/testdata/uses-composite-with-inputs/composite/action.yml @@ -14,7 +14,7 @@ runs: echo "input value 1=${{ inputs.composite-input }}" [[ "${{ inputs.composite-input == 'value' }}" = "true" ]] || exit 1 shell: bash - - uses: nektos/act-test-actions/js@main + - uses: https://code.forgejo.org/forgejo/act-test-actions/js@main - name: test input value again run: | echo "input value 2=${{ inputs.composite-input }}" diff --git a/act/runner/testdata/uses-composite-with-inputs/push.yml b/act/runner/testdata/uses-composite-with-inputs/push.yml index 9d0cc5b9..8acaf596 100644 --- a/act/runner/testdata/uses-composite-with-inputs/push.yml +++ b/act/runner/testdata/uses-composite-with-inputs/push.yml @@ -4,7 +4,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 - id: set-output run: echo "::set-output name=var::value" - name: use simple composite action @@ -21,7 +21,7 @@ jobs: # - name: use remote composite action id: remote-composite - uses: nektos/act-test-actions/composite@main + uses: https://code.forgejo.org/forgejo/act-test-actions/composite@main with: input: ${{ steps.set-output.outputs.var }} - name: test remote composite output diff --git a/act/runner/testdata/uses-composite-with-pre-and-post-steps/push.yml b/act/runner/testdata/uses-composite-with-pre-and-post-steps/push.yml index 922d38a4..b7f76dc1 100644 --- a/act/runner/testdata/uses-composite-with-pre-and-post-steps/push.yml +++ b/act/runner/testdata/uses-composite-with-pre-and-post-steps/push.yml @@ -6,6 +6,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: ./uses-composite-with-pre-and-post-steps/last-action - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 - run: echo -n "STEP_OUTPUT_TEST=empty" >> $GITHUB_ENV - uses: ./uses-composite-with-pre-and-post-steps/composite_action diff --git a/act/runner/testdata/uses-composite/push.yml b/act/runner/testdata/uses-composite/push.yml index bc66aff8..c58fce72 100755 --- a/act/runner/testdata/uses-composite/push.yml +++ b/act/runner/testdata/uses-composite/push.yml @@ -5,7 +5,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 - uses: ./uses-composite/composite_action id: composite with: diff --git a/act/runner/testdata/uses-github-full-sha/main.yml b/act/runner/testdata/uses-github-full-sha/main.yml index 2acc4397..6ec7f4e4 100644 --- a/act/runner/testdata/uses-github-full-sha/main.yml +++ b/act/runner/testdata/uses-github-full-sha/main.yml @@ -4,4 +4,4 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/hello-world-docker-action@b136eb8894c5cb1dd5807da824be97ccdf9b5423 + - uses: https://github.com/actions/hello-world-docker-action@b136eb8894c5cb1dd5807da824be97ccdf9b5423 diff --git a/act/runner/testdata/uses-github-noref/push.yml b/act/runner/testdata/uses-github-noref/push.yml index be0a6fb7..d6f266d9 100644 --- a/act/runner/testdata/uses-github-noref/push.yml +++ b/act/runner/testdata/uses-github-noref/push.yml @@ -4,4 +4,4 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout + - uses: https://code.forgejo.org/actions/checkout diff --git a/act/runner/testdata/uses-github-path/push.yml b/act/runner/testdata/uses-github-path/push.yml index 19374714..679c0852 100644 --- a/act/runner/testdata/uses-github-path/push.yml +++ b/act/runner/testdata/uses-github-path/push.yml @@ -4,4 +4,4 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: sergioramos/yarn-actions/install@v6 + - uses: https://github.com/sergioramos/yarn-actions/install@v6 diff --git a/act/runner/testdata/uses-github-root/push.yml b/act/runner/testdata/uses-github-root/push.yml index 37468eac..86be3b31 100644 --- a/act/runner/testdata/uses-github-root/push.yml +++ b/act/runner/testdata/uses-github-root/push.yml @@ -4,4 +4,4 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 diff --git a/act/runner/testdata/uses-github-short-sha/main.yml b/act/runner/testdata/uses-github-short-sha/main.yml index 7a45fe49..c30b6bf0 100644 --- a/act/runner/testdata/uses-github-short-sha/main.yml +++ b/act/runner/testdata/uses-github-short-sha/main.yml @@ -4,4 +4,4 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/hello-world-docker-action@b136eb8 + - uses: https://github.com/actions/hello-world-docker-action@b136eb8 diff --git a/act/runner/testdata/uses-nested-composite/composite_action2/action.yml b/act/runner/testdata/uses-nested-composite/composite_action2/action.yml index 4aec9a8c..39c31b04 100644 --- a/act/runner/testdata/uses-nested-composite/composite_action2/action.yml +++ b/act/runner/testdata/uses-nested-composite/composite_action2/action.yml @@ -9,7 +9,7 @@ inputs: runs: using: "composite" steps: - - uses: actions/setup-node@v3 + - uses: https://github.com/actions/setup-node@v3 with: node-version: '16' - run: | diff --git a/act/runner/testdata/uses-nested-composite/push.yml b/act/runner/testdata/uses-nested-composite/push.yml index b7de1fb8..3b1567e7 100644 --- a/act/runner/testdata/uses-nested-composite/push.yml +++ b/act/runner/testdata/uses-nested-composite/push.yml @@ -5,7 +5,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 - uses: ./uses-nested-composite/composite_action2 with: test_input_optional: Test diff --git a/act/runner/testdata/uses-sh-test-action-path/push.yaml b/act/runner/testdata/uses-sh-test-action-path/push.yaml index 3253589a..ac2016f3 100644 --- a/act/runner/testdata/uses-sh-test-action-path/push.yaml +++ b/act/runner/testdata/uses-sh-test-action-path/push.yaml @@ -6,5 +6,5 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 - uses: ./uses-sh-test-action-path/sh_test_action_path diff --git a/act/runner/testdata/uses-sh/push.yaml b/act/runner/testdata/uses-sh/push.yaml index a137393b..e784bb25 100644 --- a/act/runner/testdata/uses-sh/push.yaml +++ b/act/runner/testdata/uses-sh/push.yaml @@ -6,5 +6,5 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: https://data.forgejo.org/actions/checkout@v2 - uses: ./uses-sh/sh_action diff --git a/act/runner/testdata/uses-workflow/push.yml b/act/runner/testdata/uses-workflow/push.yml index ddc37b86..8291ae8d 100644 --- a/act/runner/testdata/uses-workflow/push.yml +++ b/act/runner/testdata/uses-workflow/push.yml @@ -2,7 +2,7 @@ on: push jobs: reusable-workflow: - uses: nektos/act-test-actions/.github/workflows/reusable-workflow.yml@main + uses: https://code.forgejo.org/forgejo/act-test-actions/.github/workflows/reusable-workflow.yml@main with: string_required: string bool_required: ${{ true }} @@ -11,7 +11,7 @@ jobs: secret: keep_it_private reusable-workflow-with-inherited-secrets: - uses: nektos/act-test-actions/.github/workflows/reusable-workflow.yml@main + uses: https://code.forgejo.org/forgejo/act-test-actions/.github/workflows/reusable-workflow.yml@main with: string_required: string bool_required: ${{ true }} diff --git a/act/runner/testdata/windows-add-env/push.yml b/act/runner/testdata/windows-add-env/push.yml index 7d6a81df..f386989b 100644 --- a/act/runner/testdata/windows-add-env/push.yml +++ b/act/runner/testdata/windows-add-env/push.yml @@ -34,7 +34,7 @@ jobs: if: env.KEY != 'n/a' || env.Key != 'n/a' || env.key != 'n/a' env: KeY: 'n/a' - - uses: actions/checkout@v3 + - uses: https://data.forgejo.org/actions/checkout@v3 - uses: ./windows-add-env - name: Assert composite env is merged case insensitive run: exit 1