-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Taskfile.yml
186 lines (158 loc) · 5.21 KB
/
Taskfile.yml
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
version: "3"
silent: true
dotenv:
- .env
tasks:
default:
desc: Run a development version of the project
summary: |
Run a development version of the project locally
This task will run the local development version of the website and
setup the correct IP address and the ports to make the website accessible
on a network.
dir: ./web
cmd: pnpm dev --host
setup:precommit:
internal: true
sources:
- .pre-commit-config.yaml
generates:
- ./git/hooks/pre-commit
- ./git/hooks/commit-msg
cmds:
- pre-commit install --install-hooks
- pre-commit install --hook-type commit-msg
setup:terraform:
desc: Initialise the local development environment for Terraform
summary: |
Initialise the local development environment for Terraform.
This task will automatically setup Terraform locally on the system for
further development tasks. It'll correctly identify the directory where
the Terraform code are located and invoke the appropriate command
accordingly.
dir: ./terraform
generates:
- ".terraform/**"
sources:
- "**.tf"
cmd: terraform init
setup:pnpm:
desc: Install the "pnpm" dependencies
summary: |
Install the "pnpm" dependencies.
This task will install the "pnpm" dependencies for the Astro project and
generate the "package-lock.json" file as well if it deems necessary.
dir: ./web
sources:
- package.json
generates:
- package-lock.json
cmd: pnpm install --frozen-lockfile
setup:
desc: Setup the local development environment
summary: |
Setup the local development environment for the project.
This task will install the node_modules, Terraform providers and anything
else in preparation for starting a development environment for the project.
dir: ./web
cmds:
- task: setup:pnpm
- task: setup:precommit
- task: setup:terraform
build:
desc: Build the website statically on the local system.
summary: |
Build a local static version of the website.
The task will check for any issues in source code before generating the
static assets (the HTML, CSS and JS bundles) for the website. The command
can be used in an CI/CD environment or chained to another task.
dir: ./web
cmd: pnpm build
generates:
- "./dist"
sources:
- "./src"
- "./public"
preview:
desc: Preview the local statically build version of the website.
summary: |
Preview the local static version of the website.
This task will load the statically generated version of the website
locally. Its helpful in checking for any errors or unintended behaviours
before deploying the website to production.
deps:
- task: build
dir: ./web
cmd: pnpm preview --host
format:prettier:
internal: true
dir: ./web
cmd: pnpm format:fix
format:terraform:
internal: true
dir: ./terraform
cmd: terraform fmt
format:
desc: Run various formatters on the entire source code
summary: |
Run various formatters on the entire source code.
This task will run "prettier", "terraform fmt" and such on the entire
code to ensure each and every line follows some standard practice of
authoring code.
cmds:
- task: format:prettier
- task: format:terraform
qa-checks:pnpm:
internal: true
dir: ./web
cmd: pnpm tests
qa-checks:terraform:
internal: true
dir: ./terraform
cmd: terraform test
qa-checks:
desc: Run QA checks on the entire source code
summary: |
Run QA checks on the entire source code.
This task will run all sorts of QA checks on the source code before its
prepared to be pushed to the remote repository for further production
deployment.
cmds:
- pre-commit run --all-files
# TODO: Uncomment the line after figuring out proper Playwright usage
# - task: qa-checks:pnpm
cleanup:
desc: Perform a quick cleanup of the local development environment
summary: |
Perform a quick cleanup of the dev environment.
This task will remove the "node_modules", ".terraform" folder,
"git-hooks" and more from the local repository for a fresh start of the
project.
cmds:
- rm --recursive --force "./web/node_modules"
- rm --recursive --force "./web/.astro"
- rm --recursive --force "./web/dist"
- rm --recursive --force "./terraform/.terraform"
- rm --recursive --force "./.task"
- pre-commit clean 2&> /dev/null
terraform-apply:
internal: true
dir: ./terraform
generates:
- tfplan
sources:
- "*.tf"
cmds:
- terraform plan --var "vercel_api_token=${VERCEL_API_TOKEN}" --out=tfplan
- terraform apply tfplan
deploy:
desc: Deploy the website to production
summary: |
Deploy the website to production.
This task will invoke all the quality-assurance checks on the code
quality and then invoke Terraform to deploy it to production on Vercel.
Do note, invoking this command will bypass the automated CI/CD pipeline
setup though.
cmds:
- task: qa-checks
- task: terraform-apply