-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yaml
197 lines (180 loc) · 5.97 KB
/
Taskfile.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
---
version: 3
output: prefixed
interval: 5s
vars:
root:
sh: git rev-parse --show-toplevel
bin: dashboard
# ANSI Colours
cr: '\e[1;31m'
cg: '\e[0;32m'
cw: '\e[1;37m'
cc: '\e[0m'
# Enforce the pipefail option in the Bash library to ensure that where commands
# are run through pipes, the failure of any one step in the pipeline fails the
# whole pipe. For example, terraform |& tee will not normally fail if Terraform
# fails as tee almost always will exit cleanly, unless pipefail is set.
set:
- pipefail
includes:
# Pull in Taskfiles to manage the general components of this repository, such
# as providing checks, and the linting and validation of general files
utils:
taskfile: '.taskfiles/utils.yaml'
internal: true
vars:
root: '{{ .root }}'
jsonschema:
taskfile: '.taskfiles/jsonschema.yaml'
internal: true
vars:
root: '{{ .root }}'
prettier:
taskfile: '.taskfiles/prettier.yaml'
internal: true
vars:
root: '{{ .root }}'
markdownlint:
taskfile: '.taskfiles/markdownlint.yaml'
internal: true
vars:
root: '{{ .root }}'
go:
taskfile: '.taskfiles/go.yaml'
internal: true
vars:
root: '{{ .root }}'
bin: '{{ .bin }}'
pages:
taskfile: '.taskfiles/pages.yaml'
dir: pages
vars:
root: '{{ .root }}'
helm:
taskfile: '.taskfiles/helm.yaml'
dir: charts/dashboard
vars:
root: '{{ .root }}'
tasks:
default:
desc: Run the development and integration tasks once
summary: |-
Clean the environment and then run the development and integration tasks
for all configurations, and if found, modules, by testing and checking
those code and files, but only once, not continuously.
Use the following command for additional information on the steps involved:
$ task --summary develop
silent: true
cmds:
- task: develop
develop:
aliases:
- dev
desc: Continuously run the development and integration tasks
summary: |-
The develop task is designed to perform continuous integration on code
changes within this Lamdba Function, first by cleaning the directory and
then running the following tasks when any relevant files are changed:
- Re-format all GoLang files;
- Run extensive linting tests and checks on the Go application using
golangci-lint as the interface to the tests;
- Run extensive linting checks and validations on both configuration and
documentation files;
- Run unit and integration tests of the Go application using go test;
- Build the Go application using goreleaser, providing standadised builds
both locally and during CI/CD for release;
- Run static analysis and security analysis against the Go application to
identify protential code and security issues.
silent: true
watch: true
deps:
- task: utils:pre-checks
- task: utils:pre-commit
- task: go:healthcheck
- task: clean
cmds:
- task: lint
- task: test
- task: build
- task: security
lint:
desc: Check linting of Go, JSON, YAML, and Markdown files
summary: |
Check and validate, and reformt if necessary, all the common file types in
this repository, including:
- Linting the formatting of Go files with `go fmt`;
- Check, and reformat, if necessary, Markdown documentation plus JSON and
YAML configuration files to ensure consistant layout and minimising
whitespace changes;
- Validation of the configuration of selected YAML files to ensure that
the free-form layout is syntatically valid for their purpose, including
Taskfiles, dependabot configuraiton, GitHub Workflows, and the
pre-commit configuration.
- Validate the Markdown files are valid and have a clean layout and will
render as expected.
silent: true
cmds:
- task: go:lint
- task: helm:lint
- task: pages:lint
- task: jsonschema
- task: prettier
- task: helm:documentation
- task: markdownlint
test:
desc: Run the unit tests
summary: |
Run the unit and integration tests for the Go application.
silent: true
cmds:
- task: go:test
build:
desc: Locally build the application binary and Helm Chart
summary: |-
Locally build the application binary for the testing and local development
of the Lambda function with a temporary version number based on the local
commit and file contents, as well as the Helm Chart for deployment.
silent: true
cmds:
- task: go:build
- task: helm:build
- task: pages:build
security:
desc: Run security and static code analysis checks against the application
summary: |
Run static code analysis and security analysis of the application with
tools such as Trivy and CodeQL.
silent: true
cmds:
- task: go:trivy
- task: helm:trivy
- task: go:codeql
run:
desc: Run the dashboard service
summary: |
Run the {{ .bin }} service locally as a web server to accept and process
requests for local testing and debugging of both the service and the
client.
silent: true
cmds:
- task: go:run
clean:
desc: Clean temporary directories and files from this function
summary: |-
Clean any temporary directories and files created by, or for, this Go
application, as well as this Taskfile, and the tools and applications
called from it, including:
- Remove any previously created executables used for testing;
- Remove any previously created build files and archives;
- Remove all cache files for Task to ensure that all files are
re-evaluated by Task and all tasks are re-run from scratch.
run: once
silent: true
cmds:
- task: go:clean
- task: pages:clean
- task: helm:clean
- cmd: rm -f .prettiercache
- cmd: rm -rf .task
- cmd: echo -e '{{ .cg }}Completed{{ .cc }}'