Skip to content
This repository has been archived by the owner on Sep 29, 2021. It is now read-only.

Commit

Permalink
Merge pull request #78 from suzuki-shunsuke/docs/add-example-3
Browse files Browse the repository at this point in the history
docs: add examples
  • Loading branch information
suzuki-shunsuke authored Oct 15, 2020
2 parents a28a515 + 5bc3261 commit d1febd2
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 10 deletions.
3 changes: 3 additions & 0 deletions examples/command_file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This file is read from command_file.yaml
# Go's text/teplate
echo "{{.Task.Name}}"
7 changes: 7 additions & 0 deletions examples/command_file.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
phases:
- name: main
tasks:
- name: read command from a file
command:
command_file: command_file.sh
8 changes: 6 additions & 2 deletions examples/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ func TestBuildflow(t *testing.T) { //nolint:funlen
title: "hello world",
file: "hello_world.yaml",
},
{
title: "read command from a file (task.command_file)",
file: "command_file.yaml",
},
{
title: "run tasks in parallel",
file: "parallel.yaml",
Expand All @@ -25,8 +29,8 @@ func TestBuildflow(t *testing.T) { //nolint:funlen
file: "task_dependency.yaml",
},
{
title: "task.when is true",
file: "task_when_true.yaml",
title: "task.when",
file: "task_when.yaml",
},
{
title: "read_file",
Expand Down
5 changes: 5 additions & 0 deletions examples/task_when.tengo
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Tengo script
// Define the variable "result" and this value should be true or false.
result := func(task) {
return task.Name == "when"
}(Task)
21 changes: 21 additions & 0 deletions examples/task_when.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
phases:
- name: main
tasks:
- name: "when true"
command:
command: echo "when is always true"
when: true
- name: when
command:
command: echo "use Tengo script in when"
when: |
// Tengo script
// Define the variable "result" and this value should be true or false.
result := func(task) {
return task.Name == "when"
}(Task)
- name: read task.when from a file
command:
command: echo "hello"
when_file: task_when.tengo
8 changes: 0 additions & 8 deletions examples/task_when_true.yaml

This file was deleted.

0 comments on commit d1febd2

Please sign in to comment.