Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/actions/wasi-node-sidecar/dist/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "commonjs"
}
18 changes: 9 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions moon.mod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "mizchi/actrun",
"version": "0.30.0",
"deps": {
"moonbitlang/async": "0.16.6",
"mizchi/bitflow": "0.4.0",
"mizchi/bit": "0.39.2",
"moonbitlang/x": "0.4.40",
"moonbitlang/quickcheck": "0.9.10",
"moonbit-community/yaml": "0.0.4",
"mizchi/moomaid": "0.1.2",
"bobzhang/toml": "0.1.8",
"mizchi/jq": "0.2.1",
"mizchi/wite": "0.11.0"
},
"readme": "src/README.mbt.md",
"repository": "https://github.com/mizchi/actrun",
"license": "Apache-2.0",
"keywords": [
"github-actions",
"workflow",
"runner",
"ci"
],
"description": "MVP GitHub Actions-compatible push CI runner with bitflow lowering, native execution, and bit workspace materialization.",
"source": "src",
"preferred-target": "native"
}
10 changes: 6 additions & 4 deletions src/compat_docs_test.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,11 @@ async test "compat docs: job container fixture executes run step via docker adap
),
)
@debug.debug_inspect(
@xfs.read_file_to_string(workspace + "/out.txt"),
executor_test_strip_repo_root(
@xfs.read_file_to_string(workspace + "/out.txt"),
),
content=(
#|"from-container|/Users/mz/ghq/github.com/mizchi/actrun/_build/test-compat-docs-workspaces/job-container-basic/nested"
#|"from-container|<repo>/_build/test-compat-docs-workspaces/job-container-basic/nested"
),
)
@debug.debug_inspect(
Expand Down Expand Up @@ -2590,9 +2592,9 @@ async test "compat docs: github context is available in step script" {
),
)
@debug.debug_inspect(
task.stdout,
executor_test_strip_repo_root(task.stdout),
content=(
#|"<github-context|build|/Users/mz/ghq/github.com/mizchi/actrun/_build/test-compat-docs-workspaces/context-github-script>"
#|"<github-context|build|<repo>/_build/test-compat-docs-workspaces/context-github-script>"
),
)
}
Expand Down
68 changes: 48 additions & 20 deletions src/executor_test.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ fn ensure_dir(path : String) -> Unit raise {
}
}

///|
/// Replace the runner's cwd prefix with the placeholder `<repo>` so
/// expect snapshots stay machine-independent. Without this, expect
/// strings bake in the developer's local absolute path
/// (e.g. `/Users/me/ghq/github.com/mizchi/actrun/...`) and break on
/// CI / other machines.
fn executor_test_strip_repo_root(s : String) -> String {
let cwd = @xsys.get_env_var("PWD").unwrap_or(".")
let prefix = if cwd.has_suffix("/") { cwd } else { cwd + "/" }
s.replace_all(old=prefix, new="<repo>/")
}

///|
fn executor_test_absolute_path(path : String) -> String {
if path.has_prefix("/") {
Expand Down Expand Up @@ -563,9 +575,9 @@ async test "executor: injects basic github runner env" {
),
)
@debug.debug_inspect(
task.stdout,
executor_test_strip_repo_root(task.stdout),
content=(
#|"/Users/mz/ghq/github.com/mizchi/actrun/_build/test-workspaces/executor-github-env|ci|build|true|true"
#|"<repo>/_build/test-workspaces/executor-github-env|ci|build|true|true"
),
)
}
Expand Down Expand Up @@ -1768,9 +1780,11 @@ async test "executor: cached github repo composite action runs inner steps" {
)
let verify = expect_task_report(report, "build/verify")
@debug.debug_inspect(
verify.stdout.trim(chars=" \n\r\t").to_owned(),
executor_test_strip_repo_root(
verify.stdout.trim(chars=" \n\r\t").to_owned(),
),
content=(
#|"write|mizchi-test/demo-action|v1|write|/Users/mz/ghq/github.com/mizchi/actrun/_build/actrun/github_actions/mizchi-test/demo-action/v1/composite"
#|"write|mizchi-test/demo-action|v1|write|<repo>/_build/actrun/github_actions/mizchi-test/demo-action/v1/composite"
),
)
}
Expand Down Expand Up @@ -1831,9 +1845,11 @@ async test "executor: cached github repo node action runs main entrypoint" {
)
let verify = expect_task_report(report, "build/verify")
@debug.debug_inspect(
verify.stdout.trim(chars=" \n\r\t").to_owned(),
executor_test_strip_repo_root(
verify.stdout.trim(chars=" \n\r\t").to_owned(),
),
content=(
#|"from-input|mizchitestnodeactionaction|/Users/mz/ghq/github.com/mizchi/actrun/_build/actrun/github_actions/mizchi-test/node-action/v1/action|mizchi-test/node-action|v1"
#|"from-input|mizchitestnodeactionaction|<repo>/_build/actrun/github_actions/mizchi-test/node-action/v1/action|mizchi-test/node-action|v1"
),
)
let node_log = @xfs.read_file_to_string(node_log_path)
Expand Down Expand Up @@ -1896,9 +1912,11 @@ async test "executor: job container runs github repo node action via docker adap
),
)
@debug.debug_inspect(
@xfs.read_file_to_string(workspace + "/node.txt"),
executor_test_strip_repo_root(
@xfs.read_file_to_string(workspace + "/node.txt"),
),
content=(
#|"from-container|/Users/mz/ghq/github.com/mizchi/actrun/_build/test-workspaces/executor-job-container-node-action|/Users/mz/ghq/github.com/mizchi/actrun/_build/actrun/github_actions/mizchi-test/node-action-container/v1/action"
#|"from-container|<repo>/_build/test-workspaces/executor-job-container-node-action|<repo>/_build/actrun/github_actions/mizchi-test/node-action-container/v1/action"
),
)
let docker_log = @xfs.read_file_to_string(docker_log_path)
Expand Down Expand Up @@ -3613,16 +3631,18 @@ async test "executor: local composite action runs inner steps" {
)
let show = expect_task_report(report, "build/setup__show")
@debug.debug_inspect(
show.stdout.trim(chars=" \n\r\t").to_owned(),
executor_test_strip_repo_root(show.stdout.trim(chars=" \n\r\t").to_owned()),
content=(
#|"from-local-action|/Users/mz/ghq/github.com/mizchi/actrun/_build/test-workspaces/executor-local-action/.github/actions/setup"
#|"from-local-action|<repo>/_build/test-workspaces/executor-local-action/.github/actions/setup"
),
)
let verify = expect_task_report(report, "build/verify")
@debug.debug_inspect(
verify.stdout.trim(chars=" \n\r\t").to_owned(),
executor_test_strip_repo_root(
verify.stdout.trim(chars=" \n\r\t").to_owned(),
),
content=(
#|"from-local-action|/Users/mz/ghq/github.com/mizchi/actrun/_build/test-workspaces/executor-local-action/.github/actions/setup"
#|"from-local-action|<repo>/_build/test-workspaces/executor-local-action/.github/actions/setup"
),
)
}
Expand Down Expand Up @@ -3854,9 +3874,11 @@ async test "executor: github action_path context is available in local composite
),
)
@debug.debug_inspect(
@xfs.read_file_to_string(workspace + "/action-path.txt"),
executor_test_strip_repo_root(
@xfs.read_file_to_string(workspace + "/action-path.txt"),
),
content=(
#|"/Users/mz/ghq/github.com/mizchi/actrun/_build/test-workspaces/executor-local-action-github-action-path/.github/actions/setup"
#|"<repo>/_build/test-workspaces/executor-local-action-github-action-path/.github/actions/setup"
),
)
}
Expand Down Expand Up @@ -5368,9 +5390,11 @@ async test "executor: job container runs run steps via docker adapter" {
),
)
@debug.debug_inspect(
expect_task_report(report, "build/show").stdout,
executor_test_strip_repo_root(
expect_task_report(report, "build/show").stdout,
),
content=(
#|"from-container|from-step|/Users/mz/ghq/github.com/mizchi/actrun/_build/test-workspaces/executor-job-container/nested"
#|"from-container|from-step|<repo>/_build/test-workspaces/executor-job-container/nested"
),
)
let docker_log = @xfs.read_file_to_string(docker_log_path)
Expand Down Expand Up @@ -5743,9 +5767,11 @@ async test "executor: github repo node action lifecycle shares GITHUB_STATE acro
),
)
@debug.debug_inspect(
@xfs.read_file_to_string(workspace + "/post.txt"),
executor_test_strip_repo_root(
@xfs.read_file_to_string(workspace + "/post.txt"),
),
content=(
#|"main|/Users/mz/ghq/github.com/mizchi/actrun/_build/test-workspaces/executor-github-node-lifecycle"
#|"main|<repo>/_build/test-workspaces/executor-github-node-lifecycle"
),
)
}
Expand Down Expand Up @@ -5821,9 +5847,11 @@ async test "executor: github repo docker action lifecycle shares GITHUB_STATE ac
),
)
@debug.debug_inspect(
@xfs.read_file_to_string(workspace + "/post.txt"),
executor_test_strip_repo_root(
@xfs.read_file_to_string(workspace + "/post.txt"),
),
content=(
#|"main|/Users/mz/ghq/github.com/mizchi/actrun/_build/test-workspaces/executor-github-docker-lifecycle"
#|"main|<repo>/_build/test-workspaces/executor-github-docker-lifecycle"
),
)
}
Expand Down
30 changes: 20 additions & 10 deletions src/lib_test.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -948,9 +948,11 @@ test "lowering: custom registry node action resolves backend from manifest" {
),
)
@debug.debug_inspect(
setup_plan.action.unwrap().entrypoint.unwrap_or(""),
executor_test_strip_repo_root(
setup_plan.action.unwrap().entrypoint.unwrap_or(""),
),
content=(
#|"/Users/mz/ghq/github.com/mizchi/actrun/_build/test-workspaces/custom-registry-node-root/bit/std/cache/v1/index.sh"
#|"<repo>/_build/test-workspaces/custom-registry-node-root/bit/std/cache/v1/index.sh"
),
)
@debug.debug_inspect(
Expand Down Expand Up @@ -1685,15 +1687,19 @@ test "lowering: cached github repo node action becomes node task" {
),
)
@debug.debug_inspect(
remote_plan.action.unwrap().entrypoint.unwrap_or(""),
executor_test_strip_repo_root(
remote_plan.action.unwrap().entrypoint.unwrap_or(""),
),
content=(
#|"/Users/mz/ghq/github.com/mizchi/actrun/_build/actrun/github_actions/mizchi-test/node-action/v1/action/main.sh"
#|"<repo>/_build/actrun/github_actions/mizchi-test/node-action/v1/action/main.sh"
),
)
@debug.debug_inspect(
remote_plan.action.unwrap().action_path.unwrap_or(""),
executor_test_strip_repo_root(
remote_plan.action.unwrap().action_path.unwrap_or(""),
),
content=(
#|"/Users/mz/ghq/github.com/mizchi/actrun/_build/actrun/github_actions/mizchi-test/node-action/v1/action"
#|"<repo>/_build/actrun/github_actions/mizchi-test/node-action/v1/action"
),
)
@debug.debug_inspect(
Expand All @@ -1715,9 +1721,11 @@ test "lowering: cached github repo node action becomes node task" {
),
)
@debug.debug_inspect(
remote_plan.env.get("GITHUB_ACTION_PATH").unwrap_or(""),
executor_test_strip_repo_root(
remote_plan.env.get("GITHUB_ACTION_PATH").unwrap_or(""),
),
content=(
#|"/Users/mz/ghq/github.com/mizchi/actrun/_build/actrun/github_actions/mizchi-test/node-action/v1/action"
#|"<repo>/_build/actrun/github_actions/mizchi-test/node-action/v1/action"
),
)
}
Expand Down Expand Up @@ -1832,9 +1840,11 @@ test "lowering: cached github repo docker action becomes docker task" {
),
)
@debug.debug_inspect(
remote_plan.action.unwrap().image.unwrap_or(""),
executor_test_strip_repo_root(
remote_plan.action.unwrap().image.unwrap_or(""),
),
content=(
#|"/Users/mz/ghq/github.com/mizchi/actrun/_build/actrun/github_actions/mizchi-test/docker-action/v1/action/Dockerfile"
#|"<repo>/_build/actrun/github_actions/mizchi-test/docker-action/v1/action/Dockerfile"
),
)
@debug.debug_inspect(
Expand Down