[PR #1004] [MERGED] feat: split job steps into its own files/structs #1723

Closed
opened 2026-03-01 21:52:24 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/nektos/act/pull/1004
Author: @KnisterPeter
Created: 2/17/2022
Status: Merged
Merged: 3/22/2022
Merged by: @cplee

Base: masterHead: fix-jobexecutor-refactoring


📝 Commits (10+)

  • af1c41c refactor: split step_context into separate files
  • 9f427cc refactor: introduce step factory and make steps testable
  • 23a4d32 fix: run post steps in reverse order
  • 50f8b67 test: add missing asserts for mocks
  • cc2cbc8 refactor: use local reference instead of function
  • 86c27ba refactor: correct typo in function name
  • 124d779 test: use named structs
  • 8cd1914 test: only expected valid calls
  • eb05c6a Merge branch 'master' into fix-jobexecutor-refactoring
  • 9845ab5 refactor: use step-model to get step name

📊 Changes

22 files changed (+2239 additions, -1001 deletions)

View changed files

📝 pkg/runner/action.go (+382 -4)
📝 pkg/runner/action_test.go (+83 -3)
pkg/runner/container_mock_test.go (+68 -0)
📝 pkg/runner/expression.go (+2 -3)
📝 pkg/runner/expression_test.go (+4 -4)
📝 pkg/runner/job_executor.go (+33 -10)
📝 pkg/runner/job_executor_test.go (+187 -55)
📝 pkg/runner/run_context.go (+13 -55)
pkg/runner/step.go (+145 -0)
pkg/runner/step_action_local.go (+85 -0)
pkg/runner/step_action_local_test.go (+101 -0)
pkg/runner/step_action_remote.go (+153 -0)
pkg/runner/step_action_remote_test.go (+102 -0)
pkg/runner/step_context.go (+0 -751)
pkg/runner/step_context_test.go (+0 -116)
pkg/runner/step_docker.go (+121 -0)
pkg/runner/step_docker_test.go (+106 -0)
pkg/runner/step_factory.go (+46 -0)
pkg/runner/step_factory_test.go (+81 -0)
pkg/runner/step_run.go (+166 -0)

...and 2 more files

📄 Description

To make the steps more testable, we refactored the step context
into smaller parts. Each step kind is moved into its own struct and
file.
This does help keep structure and reduce interface size. This also
allows easier testing and mocking of each step.

This prepares to integrate action pre- and post-steps.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/nektos/act/pull/1004 **Author:** [@KnisterPeter](https://github.com/KnisterPeter) **Created:** 2/17/2022 **Status:** ✅ Merged **Merged:** 3/22/2022 **Merged by:** [@cplee](https://github.com/cplee) **Base:** `master` ← **Head:** `fix-jobexecutor-refactoring` --- ### 📝 Commits (10+) - [`af1c41c`](https://github.com/nektos/act/commit/af1c41c7167770e6f5d0f6ce104eac68f6ed9225) refactor: split step_context into separate files - [`9f427cc`](https://github.com/nektos/act/commit/9f427cc267be9e49b2d6d6ca9e292d27836af958) refactor: introduce step factory and make steps testable - [`23a4d32`](https://github.com/nektos/act/commit/23a4d3215a991da5a12e0fc49a37a8e3be11d05b) fix: run post steps in reverse order - [`50f8b67`](https://github.com/nektos/act/commit/50f8b67c092683b897bfc68a087d74df17b02a40) test: add missing asserts for mocks - [`cc2cbc8`](https://github.com/nektos/act/commit/cc2cbc8b42b51d3f4ea0ad609f6ad4e5ebc8b92f) refactor: use local reference instead of function - [`86c27ba`](https://github.com/nektos/act/commit/86c27ba91db604cfca1809fdde8f43ce76ac30ad) refactor: correct typo in function name - [`124d779`](https://github.com/nektos/act/commit/124d7798cbe8de77d7cca2ebea39700978e6411e) test: use named structs - [`8cd1914`](https://github.com/nektos/act/commit/8cd1914c2d687da5786aea91fdc3ddcd023d1099) test: only expected valid calls - [`eb05c6a`](https://github.com/nektos/act/commit/eb05c6a790fa84130c578d53ac81a78d10590fa3) Merge branch 'master' into fix-jobexecutor-refactoring - [`9845ab5`](https://github.com/nektos/act/commit/9845ab5af9aef62e614c1aec8e27c16c8eb5f870) refactor: use step-model to get step name ### 📊 Changes **22 files changed** (+2239 additions, -1001 deletions) <details> <summary>View changed files</summary> 📝 `pkg/runner/action.go` (+382 -4) 📝 `pkg/runner/action_test.go` (+83 -3) ➕ `pkg/runner/container_mock_test.go` (+68 -0) 📝 `pkg/runner/expression.go` (+2 -3) 📝 `pkg/runner/expression_test.go` (+4 -4) 📝 `pkg/runner/job_executor.go` (+33 -10) 📝 `pkg/runner/job_executor_test.go` (+187 -55) 📝 `pkg/runner/run_context.go` (+13 -55) ➕ `pkg/runner/step.go` (+145 -0) ➕ `pkg/runner/step_action_local.go` (+85 -0) ➕ `pkg/runner/step_action_local_test.go` (+101 -0) ➕ `pkg/runner/step_action_remote.go` (+153 -0) ➕ `pkg/runner/step_action_remote_test.go` (+102 -0) ➖ `pkg/runner/step_context.go` (+0 -751) ➖ `pkg/runner/step_context_test.go` (+0 -116) ➕ `pkg/runner/step_docker.go` (+121 -0) ➕ `pkg/runner/step_docker_test.go` (+106 -0) ➕ `pkg/runner/step_factory.go` (+46 -0) ➕ `pkg/runner/step_factory_test.go` (+81 -0) ➕ `pkg/runner/step_run.go` (+166 -0) _...and 2 more files_ </details> ### 📄 Description To make the steps more testable, we refactored the step context into smaller parts. Each step kind is moved into its own struct and file. This does help keep structure and reduce interface size. This also allows easier testing and mocking of each step. This prepares to integrate action pre- and post-steps. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-01 21:52:24 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#1723
No description provided.