1
+ name: build_tasks
2
+ description: Choria Build Tasks
3
+
4
+ commands:
5
+ - name: dependencies
6
+ type: parent
7
+ description: Manage dependencies
8
+ aliases: [d]
9
+ commands:
10
+ - name: update
11
+ description: Update dependencies
12
+ type: exec
13
+ aliases: [up]
14
+ dir: "{{ AppDir }}"
15
+ flags:
16
+ - name: verbose
17
+ description: Log verbosely
18
+ short: v
19
+ bool: true
20
+ - name: proxy
21
+ description: Enable using go proxy
22
+ bool: true
23
+ default: "true"
24
+ script: |
25
+ . "{{ BashHelperPath }}"
26
+
27
+ ab_announce Updating all dependencies
28
+ echo
29
+
30
+ {{ if eq .Flags.proxy false }}
31
+ export GOPROXY=direct
32
+ ab_say Disabling go mod proxy
33
+ {{ end }}
34
+
35
+ go get -u -n -a -t {{- if .Flags.verbose }} -d -x {{ end }} ./...
36
+
37
+ ab_say Running go mod tidy
38
+
39
+ go mod tidy
40
+
41
+ - name: test
42
+ type: parent
43
+ aliases: [t]
44
+ description: Perform various tests
45
+ commands:
46
+ - name: unit
47
+ type: exec
48
+ description: Run ginkgo unit tests
49
+ aliases: [u]
50
+ arguments:
51
+ - name: dir
52
+ description: Directory to test
53
+ default: .
54
+ flags:
55
+ - name: update
56
+ description: Updates the ginkgo runtime
57
+ bool: true
58
+ script: |
59
+ set -e
60
+
61
+ . "{{ BashHelperPath }}"
62
+
63
+ {{ if .Flags.update }}
64
+ ab_say Updating ginkgo binary
65
+ go install github.com/onsi/ginkgo/v2/ginkgo
66
+ {{ end }}
67
+
68
+ ginkgo -r --skip Integration {{ .Arguments.dir | escape }}
69
+
70
+ - name: lint
71
+ type: exec
72
+ dir: "{{ AppDir }}"
73
+ flags:
74
+ - name: vet
75
+ description: Perform go vet
76
+ bool: true
77
+ default: true
78
+ - name: staticcheck
79
+ description: Perform staticcheck
80
+ bool: true
81
+ default: true
82
+ - name: update
83
+ description: Updates lint dependencies
84
+ bool: true
85
+ script: |
86
+ set -e
87
+
88
+ . "{{ BashHelperPath }}"
89
+
90
+ {{ if .Flags.update }}
91
+ ab_say Updating linting tools
92
+ go install github.com/client9/misspell/cmd/misspell@latest
93
+ go install honnef.co/go/tools/cmd/staticcheck@latest
94
+ {{ else }}
95
+ echo ">>> Run with --update to install required commands"
96
+ echo
97
+ {{ end }}
98
+
99
+ ab_say Formatting source files
100
+ go fmt ./...
101
+
102
+ ab_say Tidying go mod
103
+ go mod tidy
104
+
105
+ ab_say Checking spelling
106
+ find . -type f -name "*.go" | xargs misspell -error -locale US -i flavour
107
+
108
+ {{ if .Flags.vet }}
109
+ ab_say Performing go vet
110
+ go vet ./...
111
+ {{ end }}
112
+
113
+ {{ if .Flags.staticcheck }}
114
+ ab_say Running staticcheck
115
+ staticcheck ./...
116
+ {{ end }}
0 commit comments