-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
248 lines (218 loc) · 8.17 KB
/
Taskfile.yaml
File metadata and controls
248 lines (218 loc) · 8.17 KB
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
version: "3"
silent: true
includes:
backend:
taskfile: https://raw.githubusercontent.com/werf/common-ci/refs/heads/main/Taskfile.format_lint.yml
dir: ./backend
vars:
paths: "."
configurator:
taskfile: https://raw.githubusercontent.com/werf/common-ci/refs/heads/main/Taskfile.format_lint.yml
dir: ./bin/configurator
vars:
paths: "."
deps:
taskfile: https://raw.githubusercontent.com/werf/common-ci/refs/heads/main/Taskfile.deps.yml
flatten: true
vars:
paths: "backend"
website:
taskfile: https://raw.githubusercontent.com/werf/common-ci/refs/heads/main/Taskfile.format_lint.yml
env: {}
vars:
frameworks: "django golang java_springboot laravel nodejs rails"
languages: "ru en"
framework_template_dir: "_pages/guides/framework_id"
tasks:
format:
desc: 'Run all code formatters. Important vars: "paths".'
cmds:
- task: backend:format
- task: configurator:format
- task: website:format:prettier
lint:
desc: "Run all linters"
cmds:
- task: backend:lint
- task: configurator:lint
- task: website:lint:prettier
# TODO: specify target framework
gen:pages:
desc: "Generate pages for all existing frameworks using framework_id folder as the source data"
cmds:
- |
for framework in {{.frameworks}}
do
for lang in {{.languages}}
do
target_dir=pages_$lang/guides/$framework
echo "# Regenerate $framework pages ($lang)"
rm -rf $target_dir
cp -a {{.framework_template_dir}} $target_dir
find $target_dir -type f -exec sed -i -e "s|framework_id|$framework|g" {} \;
if [ "x$framework" = "xgolang" ]
then
echo 1>&2 "WARNING: Removing $target_dir/200_real_apps because no content available for $framework at the moment"
rm -rf $target_dir/200_real_apps*
fi
echo
done
done
- |
# FIXME: this page not available for other frameworks and languages yet
git checkout pages_ru/guides/rails/200_real_apps/60_cron.md
gen:demo:
desc: "Generate asciinema werf demos"
cmds:
- echo TODO
install:demo-tools-ubuntu:
desc: "Install tools needed to record werf demos"
cmds:
# NOTE: also we need werf itself
- sudo apt install pv asciinema
- wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
local:gen:configurator:
desc: "Regenerate configurator pages and copy to site directories"
cmds:
- |
(
echo Regenerate configurator pages...
cd bin/configurator
go run *.go
)
cp -R bin/configurator/static/* .
cp -R bin/configurator/generated/* .
dev:setup:docker-network:
desc: "Create shared docker network werfio-dev to use with werf/website"
vars:
NETWORK_NAME: werfio-dev
cmds:
- docker network create -d=bridge {{.NETWORK_NAME}}
status:
- docker network inspect {{.NETWORK_NAME}}
dev:setup:website:
desc: "Run jekyll in werf compose for local development. Use lang=en or lang=ru to run only specified lang. Run task dev:setup:website in werf/werf repository to access documentation."
deps:
- dev:setup:docker-network
cmds:
- |
services="{{ .lang }}"
services=${services:-"en ru"}
# Run compose up in docs directory.
which werf >/dev/null || source $(trdl use werf 2 beta)
werf compose up jekyll_base backend --dev --docker-compose-command-options="$services front backend" --platform=linux/amd64 || true
dev:cleanup:website:
desc: "Stop and clean after werf compose"
cmds:
- |
which werf >/dev/null || source $(trdl use werf 2 beta)
# Workaround: set image variable to stub image.
WERF_JEKYLL_BASE_DOCKER_IMAGE_NAME=nginx:latest \
WERF_BACKEND_DOCKER_IMAGE_NAME=nginx:latest \
werf compose down
docker network delete werfio-dev
- |
for d in $(ls -1d ./_site* ./.jekyll-cache* ./.jekyll-metadata 2>/dev/null) ; do
echo "Remove dir $d ..."
rm -rf $d
done
echo "Remove configurator generated content"
for d in $(ls -1d ./_includes/*/configurator ./pages_*/configurator* ./_data/*/configurator* 2>/dev/null) ; do
echo " Remove dir $d ..."
rm -rf $d
done
site:check-broken-links:
desc: "Check docs for broken links."
deps:
- site:check-broken-links:ru
- site:check-broken-links:en
site:check-broken-links:ru:
desc: "Check ru docs for broken links."
cmds:
- |
./scripts/docs/check_broken_links.sh ru
site:check-broken-links:en:
desc: "Check en docs for broken links."
cmds:
- |
./scripts/docs/check_broken_links.sh en
site:run-spell-check:
desc: "Run spell check for all pages."
deps:
- site:run-spell-check:ru
- site:run-spell-check:en
site:run-spell-check:ru:
desc: "Run spell check for ru pages. You can specify the path to a specific file with `-- ./path/to/file`"
cmds:
- |
./scripts/docs/spelling/spell_check.sh ru {{.CLI_ARGS}}
site:run-spell-check:en:
desc: "Run spell check for en pages. You can specify the path to a specific file with `-- ./path/to/file`"
cmds:
- |
./scripts/docs/spelling/spell_check.sh en {{.CLI_ARGS}}
site:generate-special-dictionary:
desc: "Generate a dictionary of special terms."
cmds:
- |
docker run --rm -v $(pwd)/scripts/:/scripts registry.werf.io/website/sorter:latest bash -c '
test -f ./scripts/docs/spelling/dictionaries/dev_OPS.dic && rm ./scripts/docs/spelling/dictionaries/dev_OPS.dic
touch ./scripts/docs/spelling/dictionaries/dev_OPS.dic
cat ./scripts/docs/spelling/wordlist | wc -l | sed "s/^[ \t]*//g" >> ./scripts/docs/spelling/dictionaries/dev_OPS.dic
sort -u -f -o ./scripts/docs/spelling/wordlist{,}
sort -u -f ./scripts/docs/spelling/wordlist >> ./scripts/docs/spelling/dictionaries/dev_OPS.dic
'
site:get-words-with-typos:
desc: "Pulls out a list of all the terms in all pages that were considered a typo"
deps:
- site:get-words-with-typos:ru
- site:get-words-with-typos:en
site:get-words-with-typos:ru:
desc: "Pulls out a list of all the terms in RU pages that were considered a typo"
cmds:
- |
task site:run-spell-check:ru | sed '1,/Checking/ d' | sed '/^$/d' | sed '/Checking/d' | sort -u > spell_log_ru
site:get-words-with-typos:en:
desc: "Pulls out a list of all the terms in EN pages that were considered a typo"
cmds:
- |
task site:run-spell-check:en | sed '1,/Checking/ d' | sed '/^$/d' | sed '/Checking/d' | sort -u > spell_log_en
site:view-plain-text-of-target-html:en:
desc: "Displays EN HTML stripped of tags."
cmds:
- |
./scripts/docs/spelling/spell_check.sh en {{.CLI_ARGS}} plain_text
site:view-plain-text-of-target-html:ru:
desc: "Displays RU HTML stripped of tags."
cmds:
- |
./scripts/docs/spelling/spell_check.sh ru {{.CLI_ARGS}} plain_text
site:view-plain-text-of-target-html:
desc: "Displays both HTML stripped of tags."
cmds:
- |
task site:view-plain-text-of-target-html:en -- {{.CLI_ARGS}}
task site:view-plain-text-of-target-html:ru -- {{.CLI_ARGS}}
_image:build:
cmds:
- docker build {{.CLI_ARGS}} --platform=linux/amd64,linux/arm64 -f "{{.dfilePath}}" -t "{{.imageName}}" "{{.context | default "."}}"
image:build:sorter:
desc: 'Build wordlist sorter image. Important vars: "imageName".'
cmds:
- task: _image:build
vars:
dfilePath: scripts/docs/spelling/sorter/Dockerfile
imageName:
sh: "echo registry-write.werf.io/website/sorter:latest"
_image:push:
cmds:
- docker push {{.CLI_ARGS}} "{{.imageName}}"
image:publish:sorter:
desc: 'Build and publish wordlist sorter image. Important vars: "imageName".'
deps:
- image:build:sorter
cmds:
- task: _image:push
vars:
imageName:
sh: "echo registry-write.werf.io/website/sorter:latest"