From aa09f04a4757e7e7db6138b351346228e501d736 Mon Sep 17 00:00:00 2001 From: Shunsuke Suzuki Date: Thu, 15 Oct 2020 00:04:42 +0900 Subject: [PATCH] docs: add examples of configuration --- examples/main_test.go | 8 ++++++++ examples/read_file.yaml | 17 +++++++++++++++++ examples/stdin.yaml | 10 ++++++++++ 3 files changed, 35 insertions(+) create mode 100644 examples/read_file.yaml create mode 100644 examples/stdin.yaml diff --git a/examples/main_test.go b/examples/main_test.go index 5a1f4f6..3818d07 100644 --- a/examples/main_test.go +++ b/examples/main_test.go @@ -28,6 +28,14 @@ func TestBuildflow(t *testing.T) { title: "task.when is true", file: "task_when_true.yaml", }, + { + title: "read_file", + file: "read_file.yaml", + }, + { + title: "command's standard input", + file: "stdin.yaml", + }, { title: "buildflow run fails as expected", file: "fail.yaml", diff --git a/examples/read_file.yaml b/examples/read_file.yaml new file mode 100644 index 0000000..95b55b6 --- /dev/null +++ b/examples/read_file.yaml @@ -0,0 +1,17 @@ +--- +phases: +- name: main + tasks: + - name: foo + read_file: + path: read_file.yaml + - name: bar + command: + command: | + echo "$FOO" + env: + - key: FOO + value: | + {{with GetTaskByName .Tasks "foo"}}{{.File.Text}}{{end}} + dependency: + - foo diff --git a/examples/stdin.yaml b/examples/stdin.yaml new file mode 100644 index 0000000..83b66ec --- /dev/null +++ b/examples/stdin.yaml @@ -0,0 +1,10 @@ +--- +phases: +- name: main + tasks: + - name: hello + command: + stdin: | + foo + bar + command: grep bar