package engine import ( "context" "errors" "io" "os/exec" "syscall" "time" ) // Spec is one action execution. type Spec struct { Root string // main checkout: where the devenv shell is activated Dir string // absolute working directory for the command Command string Env []string Stdout io.Writer Stderr io.Writer } // Executor runs an action's command and returns its exit code. An error // means the command could not be run at all (or was cancelled). type Executor interface { Exec(ctx context.Context, s Spec) (int, error) } // script runs the command in its working directory under bash's strict mode. // The directory comes in through CI_ACTION_DIR so it needs no quoting. func script(command string) string { return "cd -- \"$CI_ACTION_DIR\"\n" + command } // Devenv runs actions in the main checkout's devenv shell: `devenv shell // bash -euo pipefail -c