-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
.makim.yaml
478 lines (448 loc) · 18.4 KB
/
.makim.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
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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
groups:
clean:
tasks:
tmp:
help: Clean unnecessary temporary files
backend: bash
run: |
rm -fr build/
rm -fr dist/
rm -fr .eggs/
rm -f .coverage
rm -fr htmlcov/
rm -fr .pytest_cache
rm -fr .ruff_cache
rm -fr .mypy_cache
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
find . -name '*.pyc' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
docs:
tasks:
build:
help: Build documentation
run: |
mkdocs build --config-file mkdocs.yaml
preview:
help: Preview documentation page locally
run: |
mkdocs serve --watch docs --config-file mkdocs.yaml
release:
vars:
app: |
npx --yes \
-p semantic-release \
-p [email protected] \
-p "@semantic-release/commit-analyzer" \
-p "@semantic-release/release-notes-generator" \
-p "@semantic-release/changelog" \
-p "@semantic-release/exec" \
-p "@semantic-release/github" \
-p "@semantic-release/git" \
-p "semantic-release-replace-plugin" \
semantic-release
tasks:
ci:
help: Run semantic release on CI
run: ${{ vars.app }} --ci
dry:
help: Run semantic release in dry-run mode
run: |
${{ vars.app }} --dry-run
poetry build
poetry publish --dry-run
tests:
tasks:
linter:
help: Run linter tools
run: pre-commit run --all-files
unittest:
help: Run tests
run: pytest -s -vv tests
smoke:
help: Run smoke tests
hooks:
pre-run:
- task: smoke-tests.simple
- task: smoke-tests.complex
- task: smoke-tests.containers
- task: smoke-tests.unittest
- task: smoke-tests.vars-env
- task: smoke-tests.test-vars
- task: smoke-tests.bash
- task: smoke-tests.dir-absolute-path
- task: smoke-tests.dir-no-path
- task: smoke-tests.dir-relative-path
- task: smoke-tests.interactive-args
- task: smoke-tests.run-hooks
- task: smoke-tests.matrix
- task: smoke-tests.shell-app
- task: smoke-tests.ssh-remote-execution
ci:
help: Run all tasks used on CI
hooks:
pre-run:
- task: tests.linter
- task: tests.unittest
- task: tests.smoke
- task: docs.build
smoke-tests:
tasks:
simple:
help: Test makim using a simple makimfile
args:
verbose-mode:
help: Run the all the tests in verbose mode
type: bool
action: store_true
env:
MAKIM_FILE: ./tests/smoke/.makim-simple.yaml
backend: bash
run: |
export VERBOSE_FLAG='${{ "--verbose" if args.verbose_mode else "" }}'
makim $VERBOSE_FLAG --file $MAKIM_FILE --help
makim $VERBOSE_FLAG --file $MAKIM_FILE --version
makim $VERBOSE_FLAG --file $MAKIM_FILE default.clean
makim $VERBOSE_FLAG --file $MAKIM_FILE default.build
complex:
help: Test makim using a complex makimfile
env:
MAKIM_FILE: ./tests/smoke/.makim-complex.yaml
args:
verbose-mode:
help: Run the all the tests in verbose mode
type: bool
action: store_true
backend: bash
run: |
export VERBOSE_FLAG='${{ "--verbose" if args.verbose_mode else "" }}'
makim $VERBOSE_FLAG --file $MAKIM_FILE --help
makim $VERBOSE_FLAG --file $MAKIM_FILE --version
makim $VERBOSE_FLAG --file $MAKIM_FILE default.lint
makim $VERBOSE_FLAG --file $MAKIM_FILE build.clean-gcda
makim $VERBOSE_FLAG --file $MAKIM_FILE build.clean
makim $VERBOSE_FLAG --file $MAKIM_FILE build.install
makim $VERBOSE_FLAG --file $MAKIM_FILE build.release
makim $VERBOSE_FLAG --file $MAKIM_FILE build.release --build-type debug
makim $VERBOSE_FLAG --file $MAKIM_FILE build.release --extras '-D'
makim $VERBOSE_FLAG --file $MAKIM_FILE build.release --clean
makim $VERBOSE_FLAG --file $MAKIM_FILE build.dev
makim $VERBOSE_FLAG --file $MAKIM_FILE env.create-file
makim $VERBOSE_FLAG --file $MAKIM_FILE conda.build
makim $VERBOSE_FLAG --file $MAKIM_FILE release.ci
makim $VERBOSE_FLAG --file $MAKIM_FILE release.dry
makim $VERBOSE_FLAG --file $MAKIM_FILE docs.api
makim $VERBOSE_FLAG --file $MAKIM_FILE docs.build
makim $VERBOSE_FLAG --file $MAKIM_FILE docs.clean
makim $VERBOSE_FLAG --file $MAKIM_FILE docs.preview
makim $VERBOSE_FLAG --file $MAKIM_FILE tests.sanitizer
makim $VERBOSE_FLAG --file $MAKIM_FILE tests.code-coverage
makim $VERBOSE_FLAG --file $MAKIM_FILE tests.gen-object
makim $VERBOSE_FLAG --file $MAKIM_FILE tests.gen-ast
makim $VERBOSE_FLAG --file $MAKIM_FILE tests.gen-llvm-ir
makim $VERBOSE_FLAG --file $MAKIM_FILE tests.examples
makim $VERBOSE_FLAG --file $MAKIM_FILE tests.all
makim $VERBOSE_FLAG --file $MAKIM_FILE debug.fibonacci
makim $VERBOSE_FLAG --file $MAKIM_FILE print.local-env-vars
makim $VERBOSE_FLAG --file $MAKIM_FILE print.makim-env-vars
makim $VERBOSE_FLAG --file $MAKIM_FILE print.dotenv-var
makim $VERBOSE_FLAG --file $MAKIM_FILE print.nested
containers:
help: Test makim with containers-sugar
env:
# it change the directory first to tests/smoke
MAKIM_FILE: .makim-sugar.yaml
args:
verbose-mode:
help: Run the all the tests in verbose mode
type: bool
action: store_true
backend: bash
run: |
export VERBOSE_FLAG='${{ "--verbose" if args.verbose_mode else "" }}'
cd ./tests/smoke
makim $VERBOSE_FLAG --file $MAKIM_FILE containers.run
shell-app:
help: |
Test makim with dir for global no-path and its various
combinations with group and task dir
args:
verbose-mode:
help: Run the all the tests in verbose mode
type: bool
action: store_true
env:
MAKIM_FILE: tests/smoke/.makim-interpreters.yaml
backend: bash
run: |
export VERBOSE_FLAG='${{ "--verbose" if args.verbose_mode else "" }}'
export MAKIM_FILE="$(pwd)/${MAKIM_FILE}"
makim $VERBOSE_FLAG --file $MAKIM_FILE main.all
unittest:
help: Test makim using a unittest makimfile
args:
verbose-mode:
help: Run the all the tests in verbose mode
type: bool
action: store_true
env:
MAKIM_FILE: ./tests/smoke/.makim-unittest.yaml
backend: bash
run: |
export VERBOSE_FLAG='${{ "--verbose" if args.verbose_mode else "" }}'
makim $VERBOSE_FLAG --file $MAKIM_FILE --help
makim $VERBOSE_FLAG --file $MAKIM_FILE --version
makim $VERBOSE_FLAG --file $MAKIM_FILE tests.test-1
makim $VERBOSE_FLAG --file $MAKIM_FILE tests.test-2 --all
makim $VERBOSE_FLAG --file $MAKIM_FILE tests.test-3-a
makim $VERBOSE_FLAG --file $MAKIM_FILE tests.test-3-b
makim $VERBOSE_FLAG --file $MAKIM_FILE tests.test-4
makim $VERBOSE_FLAG --file $MAKIM_FILE tests.test-4 --trigger-dep
makim $VERBOSE_FLAG --file $MAKIM_FILE tests.test-5
makim $VERBOSE_FLAG --file $MAKIM_FILE tests.test-6
vars-env:
help: Test makim using env makimfile
args:
verbose-mode:
help: Run the all the tests in verbose mode
type: bool
action: store_true
env:
MAKIM_FILE: ./tests/smoke/.makim-env.yaml
backend: bash
run: |
export VERBOSE_FLAG='${{ "--verbose" if args.verbose_mode else "" }}'
makim $VERBOSE_FLAG --file $MAKIM_FILE --help
makim $VERBOSE_FLAG --file $MAKIM_FILE --version
makim $VERBOSE_FLAG --file $MAKIM_FILE global-scope.test-var-env-file
makim $VERBOSE_FLAG --file $MAKIM_FILE global-scope.test-var-env
makim $VERBOSE_FLAG --file $MAKIM_FILE group-scope.test-var-env-file
makim $VERBOSE_FLAG --file $MAKIM_FILE group-scope.test-var-env
makim $VERBOSE_FLAG --file $MAKIM_FILE task-scope.test-var-env-file
makim $VERBOSE_FLAG --file $MAKIM_FILE task-scope.test-var-env
makim $VERBOSE_FLAG --file $MAKIM_FILE rerender-env.from-global
makim $VERBOSE_FLAG --file $MAKIM_FILE rerender-env.from-group
makim $VERBOSE_FLAG --file $MAKIM_FILE rerender-env.from-task
test-vars:
help: Test makim using a vars makim file
args:
verbose-mode:
help: Run the all the tests in verbose mode
type: bool
action: store_true
env:
MAKIM_FILE: ./tests/smoke/.makim-vars.yaml
backend: bash
run: |
export VERBOSE_FLAG='${{ "--verbose" if args.verbose_mode else "" }}'
makim $VERBOSE_FLAG --file $MAKIM_FILE vars-group.vars-task
bash:
help: Test makim shell attribute with bash
backend: bash
args:
verbose-mode:
help: Run the all the tests in verbose mode
type: bool
action: store_true
run: |
export VERBOSE_FLAG='${{ "--verbose" if args.verbose_mode else "" }}'
makim $VERBOSE_FLAG --file tests/smoke/.makim-bash-main-scope.yaml main-scope.test
makim $VERBOSE_FLAG --file tests/smoke/.makim-bash-group-scope.yaml group-scope.test
makim $VERBOSE_FLAG --file tests/smoke/.makim-bash-task-scope.yaml task-scope.test
dir-absolute-path:
help: |
Test makim with dir absolute for global path and its various
combinations with group and task dir
args:
verbose-mode:
help: Run the all the tests in verbose mode
type: bool
action: store_true
env:
MAKIM_FILE: tests/smoke/.makim-dir-absolute-path.yaml
backend: bash
run: |
export VERBOSE_FLAG='${{ "--verbose" if args.verbose_mode else "" }}'
makim $VERBOSE_FLAG --file $MAKIM_FILE --help
makim $VERBOSE_FLAG --file $MAKIM_FILE --version
makim $VERBOSE_FLAG --file $MAKIM_FILE group-no-path.task-no-path
makim $VERBOSE_FLAG --file $MAKIM_FILE group-no-path.task-absolute
makim $VERBOSE_FLAG --file $MAKIM_FILE group-no-path.task-relative
makim $VERBOSE_FLAG --file $MAKIM_FILE group-relative.task-no-path
makim $VERBOSE_FLAG --file $MAKIM_FILE group-relative.task-absolute
makim $VERBOSE_FLAG --file $MAKIM_FILE group-relative.task-relative
makim $VERBOSE_FLAG --file $MAKIM_FILE group-absolute.task-no-path
makim $VERBOSE_FLAG --file $MAKIM_FILE group-absolute.task-absolute
makim $VERBOSE_FLAG --file $MAKIM_FILE group-absolute.task-relative
dir-no-path:
help: |
Test makim with dir for global no-path and its
various combinations with group and task dir
args:
verbose-mode:
help: Run the all the tests in verbose mode
type: bool
action: store_true
env:
MAKIM_FILE: tests/smoke/.makim-dir-no-path.yaml
backend: bash
run: |
export VERBOSE_FLAG='${{ "--verbose" if args.verbose_mode else "" }}'
export MAKIM_FILE="$(pwd)/${MAKIM_FILE}"
cd /tmp
makim $VERBOSE_FLAG --file $MAKIM_FILE --help
makim $VERBOSE_FLAG --file $MAKIM_FILE --version
makim $VERBOSE_FLAG --file $MAKIM_FILE group-no-path.task-no-path
makim $VERBOSE_FLAG --file $MAKIM_FILE group-no-path.task-absolute
makim $VERBOSE_FLAG --file $MAKIM_FILE group-no-path.task-relative
makim $VERBOSE_FLAG --file $MAKIM_FILE group-absolute.task-no-path
makim $VERBOSE_FLAG --file $MAKIM_FILE group-absolute.task-absolute
makim $VERBOSE_FLAG --file $MAKIM_FILE group-absolute.task-relative
makim $VERBOSE_FLAG --file $MAKIM_FILE group-relative.task-no-path
makim $VERBOSE_FLAG --file $MAKIM_FILE group-relative.task-absolute
makim $VERBOSE_FLAG --file $MAKIM_FILE group-relative.task-relative
dir-relative-path:
help: |
Test makim with dir for global no-path and its various
combinations with group and task dir
args:
verbose-mode:
help: Run the all the tests in verbose mode
type: bool
action: store_true
env:
MAKIM_FILE: tests/smoke/.makim-dir-relative-path.yaml
backend: bash
run: |
export VERBOSE_FLAG='${{ "--verbose" if args.verbose_mode else "" }}'
export MAKIM_FILE="$(pwd)/${MAKIM_FILE}"
mkdir -p /tmp/global-relative
cd /tmp
makim $VERBOSE_FLAG --file $MAKIM_FILE --help
makim $VERBOSE_FLAG --file $MAKIM_FILE --version
makim $VERBOSE_FLAG --file $MAKIM_FILE group-no-path.task-no-path
makim $VERBOSE_FLAG --file $MAKIM_FILE group-no-path.task-absolute
makim $VERBOSE_FLAG --file $MAKIM_FILE group-no-path.task-relative
makim $VERBOSE_FLAG --file $MAKIM_FILE group-absolute.task-no-path
makim $VERBOSE_FLAG --file $MAKIM_FILE group-absolute.task-absolute
makim $VERBOSE_FLAG --file $MAKIM_FILE group-absolute.task-relative
makim $VERBOSE_FLAG --file $MAKIM_FILE group-relative.task-no-path
makim $VERBOSE_FLAG --file $MAKIM_FILE group-relative.task-absolute
makim $VERBOSE_FLAG --file $MAKIM_FILE group-relative.task-relative
interactive-args:
help: Test makim with interactive-args
args:
verbose-mode:
help: Run the all the tests in verbose mode
type: bool
action: store_true
env:
MAKIM_FILE: tests/smoke/.makim-interactive-args.yaml
backend: bash
run: |
export VERBOSE_FLAG='${{ "--verbose" if args.verbose_mode else "" }}'
makim $VERBOSE_FLAG --file $MAKIM_FILE --help
makim $VERBOSE_FLAG --file $MAKIM_FILE --version
makim $VERBOSE_FLAG --file $MAKIM_FILE user.create --username johndoe --email [email protected] --password johndoe
makim $VERBOSE_FLAG --file $MAKIM_FILE weather.forecast --city Delhi --country India
RESULT=$(echo mycity | makim $VERBOSE_FLAG --file $MAKIM_FILE weather.forecast --country mycountry)
STRING_VALIDATION="Fetching weather forecast for mycity, mycountry..."
# Check if RESULT contains SUBSTRING
if [[ "$RESULT" != *"$STRING_VALIDATION"* ]]; then
echo "STRING_VALIDATION not found in RESULT."
exit 1
fi
run-hooks:
help: Test makim with pre-run and post-run hooks
args:
verbose-mode:
help: Run the all the tests in verbose mode
type: bool
action: store_true
env:
MAKIM_FILE: tests/smoke/.makim-hooks.yaml
backend: bash
run: |
export VERBOSE_FLAG='${{ "--verbose" if args.verbose_mode else "" }}'
makim $VERBOSE_FLAG --file $MAKIM_FILE --help
makim $VERBOSE_FLAG --file $MAKIM_FILE --version
makim $VERBOSE_FLAG --file $MAKIM_FILE build.compile
matrix:
help: Test makim with matrix combination
args:
verbose-mode:
help: Run the all the tests in verbose mode
type: bool
action: store_true
env:
MAKIM_FILE: tests/smoke/.makim-matrix-strategy.yaml
backend: bash
run: |
export VERBOSE_FLAG='${{ "--verbose" if args.verbose_mode else "" }}'
makim $VERBOSE_FLAG --file $MAKIM_FILE --help
makim $VERBOSE_FLAG --file $MAKIM_FILE --version
makim $VERBOSE_FLAG --file $MAKIM_FILE build.setup
makim $VERBOSE_FLAG --file $MAKIM_FILE build.lint
makim $VERBOSE_FLAG --file $MAKIM_FILE build.lint --fix
makim $VERBOSE_FLAG --file $MAKIM_FILE test.unit
makim $VERBOSE_FLAG --file $MAKIM_FILE test.browser
makim $VERBOSE_FLAG --file $MAKIM_FILE test.browser --headless
ssh-remote-execution:
help: Test makim with remote execution
args:
verbose-mode:
help: Run the all the tests in verbose mode
type: bool
action: store_true
env:
MAKIM_FILE: tests/smoke/.makim-ssh.yaml
backend: bash
run: |
export VERBOSE_FLAG='${{ "--verbose" if args.verbose_mode else "" }}'
makim $VERBOSE_FLAG --file $MAKIM_FILE --help
makim $VERBOSE_FLAG --file $MAKIM_FILE --version
makim $VERBOSE_FLAG --file $MAKIM_FILE remote_test.echo_test
error:
help: This group helps tests failure tasks
tasks:
python-assert:
help: Raise an system error
backend: python
run: assert False, "Failed"
code-3:
help: Raise an system error
backend: bash
run: exit 3
docker:
help: Tasks with docker
tasks:
build:
help: Build the dockerfile for ssh tests
dir: containers
env:
DOCKER_BUILDKIT: "0"
run: docker build -t ssh-test .
start:
help: Start a service from the dockerfile for ssh tests
dir: containers
env:
DOCKER_BUILDKIT: "0"
hooks:
pre-run:
- task: docker.build
run: docker run -d -p 2222:22 --rm --name ssh-test ssh-test
stop:
help: Start a service from the dockerfile for ssh tests
dir: containers
env:
DOCKER_BUILDKIT: "0"
run: docker stop ssh-test
test:
help: Test ssh connection with the docker service
dir: containers
run: |
# it requires the password manually
ssh-keygen -R "[localhost]:2222" || true
ssh -o StrictHostKeyChecking=no testuser@localhost -p 2222 'pwd'