-
Notifications
You must be signed in to change notification settings - Fork 7
/
Justfile
665 lines (517 loc) · 27 KB
/
Justfile
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
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
# Big idea behind using a Justfile is so that we can have modules like in sbt.
besom-version := `cat version.txt`
is-snapshot := if "{{besom-version}}" =~ '.*-SNAPSHOT' { "true" } else { "false" }
no-bloop := if env_var_or_default('BESOM_BUILD_NO_BLOOP', "") == "true" { "--server=false" } else { "" }
language-plugin-output-dir := justfile_directory() + "/.out/language-plugin"
codegen-output-dir := justfile_directory() + "/.out/codegen"
schemas-output-dir := justfile_directory() + "/.out/schemas"
coverage-output-dir := justfile_directory() + "/.out/coverage"
coverage-output-dir-core := coverage-output-dir + "/core"
coverage-output-dir-cats := coverage-output-dir + "/cats"
coverage-output-dir-zio := coverage-output-dir + "/zio"
coverage := "false"
# replace with a function when https://github.com/casey/just/pull/1069 is merged
scala-cli-coverage-options-core := if coverage == "true" { "-O -coverage-out:" + coverage-output-dir-core } else { "" }
scala-cli-test-options-core := scala-cli-coverage-options-core
scala-cli-coverage-options-cats := if coverage == "true" { "-O -coverage-out:" + coverage-output-dir-cats } else { "" }
scala-cli-test-options-cats := scala-cli-coverage-options-cats
scala-cli-coverage-options-zio := if coverage == "true" { "-O -coverage-out:" + coverage-output-dir-zio } else { "" }
scala-cli-test-options-zio := scala-cli-coverage-options-zio
publish-maven-auth-options := "--user env:OSSRH_USERNAME --password env:OSSRH_PASSWORD --gpg-key $PGP_KEY_ID --gpg-option --pinentry-mode --gpg-option loopback --gpg-option --passphrase --gpg-option $PGP_PASSWORD"
ci-opts := ""
# if env_var_or_default('CI', "") == "true" { "--repository=sonatype:snapshots" } else { "" }
# This list of available targets
default:
@just --list
####################
# Aggregate tasks
####################
# TODO aggregate tasks do not incorporate besom-cfg module (with the exception of clean-all)
# TODO make this version-independent and SNAPSHOT-independent by computing short-version from version.txt
build-packages-for-templates-and-examples:
grep -hr "0.3-SNAPSHOT" examples/**/*.scala templates/**/*.scala | sed -n 's/.*besom-\([^:]*:[^"]*\).*-core.0.3-SNAPSHOT.*/\1/p' | sort -u | tr '\n' ' ' | xargs -I {} just cli packages local {}
# Cleans everything
clean-all: clean-json clean-model clean-rpc clean-sdk clean-auto clean-out clean-compiler-plugin clean-codegen clean-scripts clean-test-integration clean-cfg clean-test-templates clean-test-examples clean-test-markdown
# Compiles everything
compile-all: compile-json compile-model compile-rpc compile-sdk compile-auto compile-codegen compile-scripts compile-compiler-plugin build-language-plugin
# Tests everything
test-all: test-json test-model test-sdk test-auto test-codegen test-scripts test-integration build-packages-for-templates-and-examples test-templates test-examples test-markdown
# Publishes everything locally
publish-local-all: publish-local-json publish-local-model publish-local-rpc publish-local-sdk publish-local-auto publish-local-codegen publish-local-scripts install-language-plugin
# Publishes everything to Maven
# TODO add publish-maven-auto once stable
publish-maven-all: publish-maven-json publish-maven-model publish-maven-rpc publish-maven-sdk publish-maven-codegen publish-maven-scripts
# Runs all necessary checks before committing
before-commit: compile-all test-all
####################
# Language SDK
####################
# Compiles core besom SDK
compile-core: publish-local-json publish-local-rpc
scala-cli --power compile {{no-bloop}} core --suppress-experimental-feature-warning
# Compiles besom cats-effect extension
compile-cats: publish-local-core
scala-cli --power compile {{no-bloop}} besom-cats --suppress-experimental-feature-warning
# Compiles besom zio extension
compile-zio: publish-local-core
scala-cli --power compile {{no-bloop}} besom-zio --suppress-experimental-feature-warning
# Compiles all SDK modules
compile-sdk: compile-core compile-cats compile-zio compile-compiler-plugin
# Compiles besom compiler plugin
compile-compiler-plugin:
scala-cli --power compile {{no-bloop}} compiler-plugin --suppress-experimental-feature-warning
# Runs tests for core besom SDK
test-core: compile-core
@if [ {{ coverage }} = "true" ]; then mkdir -p {{coverage-output-dir-core}}; fi
scala-cli --power test {{no-bloop}} core {{ scala-cli-test-options-core }} --suppress-experimental-feature-warning
# Runs tests for besom cats-effect extension
test-cats: publish-local-core
@if [ {{ coverage }} = "true" ]; then mkdir -p {{coverage-output-dir-cats}}; fi
scala-cli --power test {{no-bloop}} besom-cats {{ scala-cli-test-options-cats }} --suppress-experimental-feature-warning
# Runs tests for besom zio extension
test-zio: publish-local-core
@if [ {{ coverage }} = "true" ]; then mkdir -p {{coverage-output-dir-zio}}; fi
scala-cli --power test {{no-bloop}} besom-zio {{ scala-cli-test-options-zio }} --suppress-experimental-feature-warning
# Runs all tests
test-sdk: test-core test-cats test-zio
# Publishes locally all SDK modules
publish-local-sdk: publish-local-core publish-local-cats publish-local-zio publish-local-compiler-plugin
# Publishes to maven all SDK modules
publish-maven-sdk: publish-maven-core publish-maven-cats publish-maven-zio publish-maven-compiler-plugin
# Publishes locally core besom SDK
publish-local-core: publish-local-json publish-local-rpc
scala-cli --power publish local {{no-bloop}} core --project-version {{besom-version}} --suppress-experimental-feature-warning
scala-cli --power publish core --project-version {{besom-version}} --publish-repo "file://$HOME/.m2/repository" --suppress-experimental-feature-warning
# Publishes locally besom cats-effect extension
publish-local-cats: publish-local-core
scala-cli --power publish local {{no-bloop}} besom-cats --project-version {{besom-version}} --suppress-experimental-feature-warning
# Publishes locally besom zio extension
publish-local-zio: publish-local-core
scala-cli --power publish local {{no-bloop}} besom-zio --project-version {{besom-version}} --suppress-experimental-feature-warning
# Publishes locally besom compiler plugin
publish-local-compiler-plugin:
scala-cli --power publish local {{no-bloop}} compiler-plugin --project-version {{besom-version}} --suppress-experimental-feature-warning
# Publishes core besom SDK to Maven
publish-maven-core:
scala-cli --power publish {{no-bloop}} core --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning
# Publishes besom cats-effect extension to Maven
publish-maven-cats:
scala-cli --power publish {{no-bloop}} besom-cats --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning
# Publishes besom zio extension to Maven
publish-maven-zio:
scala-cli --power publish {{no-bloop}} besom-zio --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning
# Publishes besom compiler plugin to Maven
publish-maven-compiler-plugin:
scala-cli --power publish {{no-bloop}} compiler-plugin --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning
# Cleans core build
clean-core:
scala-cli clean core
# Cleans besom cats-effect extension build
clean-cats:
scala-cli clean besom-cats
# Cleans besom ZIO extension build
clean-zio:
scala-cli clean besom-zio
# Cleans all SDK builds, sets up all modules for IDE again
clean-sdk: clean-core clean-cats clean-zio clean-compiler-plugin
# Cleans besom compiler plugin build
clean-compiler-plugin:
scala-cli clean compiler-plugin
# Cleans the ./.out directory
clean-out:
rm -rf ./.out
# Cleans the coverage out directory and sdk compilation output
clean-coverage: clean-sdk
rm -rf {{coverage-output-dir}}
####################
# RPC
####################
compile-rpc:
scala-cli --power compile {{no-bloop}} besom-rpc --suppress-experimental-feature-warning
clean-rpc:
scala-cli --power clean besom-rpc
publish-local-rpc:
scala-cli --power publish local {{no-bloop}} besom-rpc --project-version {{besom-version}} --suppress-experimental-feature-warning
scala-cli --power publish besom-rpc --project-version {{besom-version}} --publish-repo "file://$HOME/.m2/repository" --suppress-experimental-feature-warning
publish-maven-rpc:
scala-cli --power publish {{no-bloop}} besom-rpc --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning
####################
# Json
####################
# Compiles json module
compile-json:
scala-cli --power compile {{no-bloop}} besom-json --suppress-experimental-feature-warning
# Runs tests for json module
test-json:
scala-cli --power test {{no-bloop}} besom-json --suppress-experimental-feature-warning
# Cleans json module
clean-json:
scala-cli --power clean besom-json
# Publishes locally json module
publish-local-json:
scala-cli --power publish local {{no-bloop}} besom-json --project-version {{besom-version}} --suppress-experimental-feature-warning
# Publishes json module to Maven
publish-maven-json:
scala-cli --power publish {{no-bloop}} besom-json --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning
####################
# Auto
####################
# Compiles auto module
compile-auto: publish-local-core publish-local-model
scala-cli --power compile auto --suppress-experimental-feature-warning
# Runs tests for auto module
test-auto: compile-auto
scala-cli --power test auto --suppress-experimental-feature-warning
# Cleans auto module
clean-auto:
scala-cli --power clean auto
# Publishes locally auto module
publish-local-auto: test-auto
scala-cli --power publish local auto --project-version {{besom-version}} --suppress-experimental-feature-warning
# Publishes auto module
publish-maven-auto: test-auto
scala-cli --power publish auto --project-version {{besom-version}} {{publish-maven-auth-options}}
####################
# Language plugin
####################
# Run go mod tidy for language plugin
tidy-language-plugin:
cd language-plugin/pulumi-language-scala && \
go mod tidy
# Packages .jar file with language plugin bootstrap library
package-language-plugin-bootstrap:
mkdir -p {{language-plugin-output-dir}} && \
scala-cli --power package {{no-bloop}} language-plugin/bootstrap --suppress-experimental-feature-warning --assembly -o {{language-plugin-output-dir}}/bootstrap.jar -f
# Builds pulumi-language-scala binary
build-language-plugin $GOOS="" $GOARCH="":
mkdir -p {{language-plugin-output-dir}} && \
cd language-plugin/pulumi-language-scala && \
go build -o {{language-plugin-output-dir}}/pulumi-language-scala \
-ldflags "-X github.com/pulumi/pulumi/sdk/v3/go/common/version.Version={{besom-version}}"
# Installs the scala language plugin locally
install-language-plugin: build-language-plugin
#!/usr/bin/env sh
just package-language-plugin-bootstrap
just build-language-plugin
output_dir={{language-plugin-output-dir}}/local
rm -rf $output_dir
mkdir -p $output_dir
cp {{language-plugin-output-dir}}/bootstrap.jar $output_dir/
cp {{language-plugin-output-dir}}/pulumi-language-scala $output_dir/
pulumi --non-interactive --logtostderr plugin rm language scala -y
pulumi --non-interactive --logtostderr plugin install language scala {{besom-version}} --file {{language-plugin-output-dir}}/local
# Package the scala language plugin for a given architecture
package-language-plugin $GOOS $GOARCH:
#!/usr/bin/env sh
subdir={{ "dist/" + GOOS + "-" + GOARCH }}
output_dir={{language-plugin-output-dir}}/$subdir
mkdir -p $output_dir
just build-language-plugin $GOOS $GOARCH
cp {{language-plugin-output-dir}}/bootstrap.jar $output_dir/
cp {{language-plugin-output-dir}}/pulumi-language-scala $output_dir/
cd $output_dir
tar czvf pulumi-language-scala-v{{besom-version}}-{{GOOS}}-{{GOARCH}}.tar.gz *
# Package the Besom scala language plugin for all supported architectures
package-language-plugins-all: package-language-plugin-bootstrap
just package-language-plugin darwin arm64
just package-language-plugin darwin amd64
just package-language-plugin linux arm64
just package-language-plugin linux amd64
just package-language-plugin windows arm64
just package-language-plugin windows amd64
# Publishes the scala language plugin to GitHub Packages
publish-language-plugin $GOOS $GOARCH:
#!/usr/bin/env sh
subdir={{ "dist/" + GOOS + "-" + GOARCH }}
output_dir={{language-plugin-output-dir}}/$subdir
gh release upload v{{besom-version}} $output_dir/pulumi-language-scala-v{{besom-version}}-{{GOOS}}-{{GOARCH}}.tar.gz --clobber
# Publishes the scala language plugin to GitHub Packages for all supported architectures
publish-language-plugins-all: package-language-plugins-all
just publish-language-plugin darwin arm64
just publish-language-plugin darwin amd64
just publish-language-plugin linux arm64
just publish-language-plugin linux amd64
just publish-language-plugin windows arm64
just publish-language-plugin windows amd64
####################
# Besom CFG
####################
# Compiles besom-cfg lib module
compile-cfg-lib: publish-local-json publish-local-core
scala-cli --power compile besom-cfg/lib --suppress-experimental-feature-warning
compile-cfg-containers: publish-local-cfg-lib publish-local-model
scala-cli --power compile besom-cfg/containers --suppress-experimental-feature-warning
# Compiles besom-cfg k8s module
compile-cfg-k8s: publish-local-cfg-lib publish-local-cfg-containers
just cli packages local kubernetes:4.17.1
scala-cli --power compile besom-cfg/k8s --suppress-experimental-feature-warning
# Publishes locally besom-cfg lib module
publish-local-cfg-lib:
scala-cli --power publish local besom-cfg/lib --project-version {{besom-version}} --suppress-experimental-feature-warning
publish-local-cfg-containers: compile-cfg-containers
scala-cli --power publish local besom-cfg/containers --project-version {{besom-version}} --suppress-experimental-feature-warning
# Publishes locally besom-cfg k8s module
publish-local-cfg-k8s: compile-cfg-k8s
scala-cli --power publish local besom-cfg/k8s --project-version {{besom-version}} --suppress-experimental-feature-warning
# Publishes locally all besom-cfg modules
publish-local-cfg: publish-local-cfg-lib publish-local-cfg-containers publish-local-cfg-k8s
# Publishes besom-cfg lib module to Maven
publish-maven-cfg-lib:
scala-cli --power publish besom-cfg/lib --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning
publish-maven-cfg-containers:
scala-cli --power publish besom-cfg/containers --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning
# Publishes besom-cfg k8s module to Maven
publish-maven-cfg-k8s:
scala-cli --power publish besom-cfg/k8s --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning
# Tests besom-cfg lib module
test-cfg-lib: compile-cfg-lib
scala-cli --power test besom-cfg/lib --suppress-experimental-feature-warning
# Tests besom-cfg containers module
test-cfg-containers: compile-cfg-containers
scala-cli --power test besom-cfg/containers --suppress-experimental-feature-warning
# Tests besom-cfg k8s module
test-cfg-k8s: compile-cfg-k8s
scala-cli --power test besom-cfg/k8s --suppress-experimental-feature-warning
# Compiles all besom-cfg modules
compile-cfg: compile-cfg-lib compile-cfg-containers compile-cfg-k8s
# Runs all tests of besom-cfg
test-cfg: test-cfg-lib test-cfg-containers test-cfg-k8s
# Cleans besom-cfg-lib build
clean-cfg-lib:
scala-cli clean besom-cfg/lib
# Cleans besom-cfg-containers build
clean-cfg-containers:
scala-cli clean besom-cfg/containers
# Cleans besom-cfg-k8s build
clean-cfg-k8s:
scala-cli clean besom-cfg/k8s
# Cleans all besom-cfg builds
clean-cfg: clean-cfg-lib clean-cfg-containers clean-cfg-k8s
####################
# Model
####################
# Compiles model module
compile-model:
scala-cli --power compile {{no-bloop}} model --suppress-experimental-feature-warning
# Runs tests for model module
test-model:
scala-cli --power test {{no-bloop}} model --suppress-experimental-feature-warning
# Cleans model module
clean-model:
scala-cli --power clean model
# Publishes locally model module
publish-local-model: test-model
scala-cli --power publish local {{no-bloop}} model --project-version {{besom-version}} --suppress-experimental-feature-warning
# Publishes model module
publish-maven-model: test-model
scala-cli --power publish {{no-bloop}} model --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning
####################
# Codegen
####################
# Compiles Besom codegen module
compile-codegen: publish-local-model
scala-cli --power compile {{no-bloop}} codegen --suppress-experimental-feature-warning
# Runs tests for Besom codegen
test-codegen:
scala-cli --power test {{no-bloop}} codegen --suppress-experimental-feature-warning
# Cleans codegen build
clean-codegen:
scala-cli clean codegen
# Publishes locally Besom codegen
publish-local-codegen: test-codegen
scala-cli --power publish local {{no-bloop}} codegen --project-version {{besom-version}} --suppress-experimental-feature-warning
# Publishes Besom codegen
publish-maven-codegen: test-codegen
scala-cli --power publish {{no-bloop}} codegen --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning
####################
# crd2besom
####################
# Compiles crd2besom module
compile-crd2besom:
scala-cli --power compile {{no-bloop}} crd2besom --suppress-experimental-feature-warning
# Runs tests for crd2besom
test-crd2besom:
scala-cli --power test {{no-bloop}} crd2besom --suppress-experimental-feature-warning
# Cleans crd2besom build
clean-crd2besom:
scala-cli clean crd2besom
# Build crd2besom binary
build-crd2besom:
scala-cli --power package {{no-bloop}} crd2besom --suppress-experimental-feature-warning --graal -o .out/crd2besom/bin/$(arch)/crd2besom
####################
# Integration testing
####################
# Runs all integration tests
test-integration: test-integration-core test-integration-compiler-plugin test-integration-codegen test-integration-language-plugin
scala-cli --power test {{no-bloop}} integration-tests
# Cleans after integration tests
clean-test-integration: clean-test-integration-codegen
scala-cli --power clean integration-tests
# Runs integration tests for core
test-integration-core: publish-local-codegen publish-local-sdk install-language-plugin publish-local-compiler-plugin
scala-cli --power test {{no-bloop}} integration-tests --test-only 'besom.integration.core*'
# Runs integration tests for compiler plugin
test-integration-compiler-plugin: publish-local-codegen publish-local-core install-language-plugin publish-local-compiler-plugin
scala-cli --power test {{no-bloop}} integration-tests --test-only 'besom.integration.compilerplugin*'
# Runs integration tests for language plugin
test-integration-language-plugin: publish-local-codegen publish-local-core install-language-plugin publish-local-compiler-plugin
export GITHUB_TOKEN=$(gh auth token); \
scala-cli --power test {{no-bloop}} integration-tests --test-only 'besom.integration.languageplugin*'
# Runs fast integration tests for codegen
test-integration-codegen: publish-local-core publish-local-codegen
export GITHUB_TOKEN=$(gh auth token); \
scala-cli --power test {{no-bloop}} integration-tests --test-only 'besom.integration.codegen*'
# Runs fast&slow integration tests for codegen
test-integration-codegen-slow: publish-local-core publish-local-codegen
export GITHUB_TOKEN=$(gh auth token); \
scala-cli --power test {{no-bloop}} integration-tests --test-only 'besom.integration.codegen*' -- --include-categories=Slow
# Cleans after the codegen integration tests
clean-test-integration-codegen:
rm -rf integration-tests/resources/testdata/*/codegen
# Copies test schemas from pulumi repo to the testdata directory
copy-test-schemas:
scala-cli run {{no-bloop}} --suppress-experimental-feature-warning --suppress-directives-in-multiple-files-warning scripts -- schemas all
####################
# Templates and examples
####################
# Runs a template test
test-template template-name:
@echo "----------------------------------------"
@echo "Testing template {{template-name}}"
pulumi --non-interactive --logtostderr --color=never --emoji=false new -y --force --generate-only --dir target/test/{{template-name}} -n templates-test-{{template-name}} --stack templates-test-{{template-name}} ../../../templates/{{template-name}}/
# TODO drop snapshots
scala-cli compile --server=false --repository=sonatype:snapshots target/test/{{template-name}} {{ci-opts}} --suppress-experimental-feature-warning --suppress-directives-in-multiple-files-warning
# Cleans after a template test
clean-test-template template-name:
@echo "----------------------------------------"
@echo "Cleaning template test for {{template-name}}"
scala-cli clean target/test/{{template-name}} || echo "Could not clean"
pulumi --non-interactive --logtostderr --color=never --emoji=false stack rm --cwd target/test/{{template-name}} -y || echo "No stack to remove"
rm -rf ./target/test/{{template-name}} || echo "No directory to remove"
rm -rf $HOME/.pulumi/stacks/templates-test-{{template-name}} || echo "No directory to remove"
# Runs all template tests
test-templates:
for file in `ls -d templates/*/ | cut -f2 -d'/'`; do just test-template $file || exit 1; done
# Cleans after template tests
clean-test-templates:
for file in `ls -d templates/*/ | cut -f2 -d'/'`; do just clean-test-template $file; done
# Runs an example test
test-example example-name:
#!/usr/bin/env bash
echo "----------------------------------------"
echo "Testing example {{example-name}}"
# TODO drop snapshots
scala-cli compile --server=false examples/{{example-name}} --repository=sonatype:snapshots {{ci-opts}} --suppress-experimental-feature-warning --suppress-directives-in-multiple-files-warning
# Cleans after an example test
clean-test-example example-name:
@echo "----------------------------------------"
@echo "Cleaning example test for {{example-name}}"
scala-cli clean examples/{{example-name}}
# Runs all template tests
test-examples:
for file in `ls -d examples/*/ | cut -f2 -d'/'`; do just test-example $file || exit 1; done
# Cleans after template tests
clean-test-examples:
for file in `ls -d examples/*/ | cut -f2 -d'/'`; do just clean-test-example $file; done
####################
# Website and docs
####################
# Runs tests for website and docs
test-markdown:
cs launch org.scalameta:mdoc_2.12:2.3.8 -- --in ./README.md ./CONTRIBUTING.md --out target/mdoc-readme --site.version=$(cat version.txt)
cs launch org.scalameta:mdoc_2.12:2.3.8 -- --in ./website --out target/mdoc-website --exclude node_modules --site.version=$(cat version.txt)
# Cleans after website and docs tests
clean-test-markdown:
rm -rf target/mdoc-readme
rm -rf target/mdoc-website
####################
# Scripts
####################
# Compiles Besom scripts module
compile-scripts: publish-local-codegen
scala-cli --power compile {{no-bloop}} scripts --suppress-experimental-feature-warning
# Clean Besom scripts module
clean-scripts:
scala-cli --power clean scripts
# Runs tests for Besom scripts
test-scripts:
scala-cli --power test {{no-bloop}} scripts --suppress-experimental-feature-warning
# Publishes locally Besom scripts module
publish-local-scripts: test-scripts
scala-cli --power publish local {{no-bloop}} scripts --project-version {{besom-version}} --suppress-experimental-feature-warning
# Publishes Besom scripts module
publish-maven-scripts: test-scripts
scala-cli --power publish {{no-bloop}} scripts --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning
# Use Besom scripts directly
cli *ARGS:
scala-cli run {{no-bloop}} scripts {{ci-opts}} --suppress-experimental-feature-warning --suppress-directives-in-multiple-files-warning scripts -- {{ARGS}}
# Create or Update GitHub release
upsert-gh-release:
#!/usr/bin/env sh
if {{is-snapshot}}; then
echo "Not a snapshot version, refusing to delete a release"
else
gh release delete v{{besom-version}} --yes || echo "Nothing to delete"
fi
echo Creating release v{{besom-version}}
gh release create v{{besom-version}} --title v{{besom-version}} --notes "" --prerelease --draft
####################
# Troubleshooting
####################
# Cleans the local ivy
clean-local-snapshots:
rm -rf ~/.ivy2/local/org.virtuslab/
rm -rf ~/.m2/repository/org/virtuslab/
rm -rf ~/.cache/coursier/v1/https/repo1.maven.org/maven2/org/virtuslab/ # Linux
rm -rf ~/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/virtuslab/ # Mac
rm -rf ~/Library/Caches/Coursier/v1/https/oss.sonatype.org/content/repositories/snapshots/org/virtuslab/ # Mac snapshots
# Cleans everything, including the local ivy, git untracked files, and kills all java processes
power-wash: clean-all clean-local-snapshots
git clean -i -d -x -e ".idea"
killall -9 java
####################
# Demo
####################
# Run the sample kubernetes Pulumi app that resides in ./experimental directory
liftoff:
#!/usr/bin/env sh
export PULUMI_SKIP_UPDATE_CHECK=true
export PULUMI_CONFIG_PASSPHRASE=""
cd experimental
pulumi --non-interactive --logtostderr up --stack liftoff -y
# Reverts the deployment of experimental sample kubernetes Pulumi app from ./experimental directory
destroy-liftoff:
#!/usr/bin/env sh
export PULUMI_SKIP_UPDATE_CHECK=true
cd experimental
if (pulumi --non-interactive --logtostderr stack ls | grep liftoff > /dev/null); then
export PULUMI_CONFIG_PASSPHRASE=""
pulumi --non-interactive --logtostderr destroy --stack liftoff -y
fi
# Cleans the deployment of experimental sample kubernetes Pulumi app from ./experimental directory to the ground
clean-liftoff: destroy-liftoff
#!/usr/bin/env sh
export PULUMI_SKIP_UPDATE_CHECK=true
cd experimental
if (pulumi --non-interactive --logtostderr stack ls | grep liftoff > /dev/null); then
pulumi --non-interactive --logtostderr stack rm liftoff -y
fi
export PULUMI_CONFIG_PASSPHRASE=""
pulumi --non-interactive --logtostderr stack init liftoff
# Cleans the deployment of ./experimental app completely, rebuilds core and kubernetes provider SDKs, deploys the app again
clean-slate-liftoff: clean-sdk
#!/usr/bin/env sh
just publish-local-core
just publish-local-compiler-plugin
scala-cli run {{no-bloop}} codegen -- named kubernetes 4.2.0
scala-cli --power publish local {{no-bloop}} .out/codegen/kubernetes/4.2.0/ --suppress-experimental-feature-warning --suppress-directives-in-multiple-files-warning
just clean-liftoff
just liftoff
####################
# IDE
####################
# Runs 'scala-cli setup-ide' for all modules
setup-intellij:
for file in `ls */project.scala | cut -f1 -d'/'`; do scala-cli setup-ide $file --suppress-experimental-feature-warning --suppress-directives-in-multiple-files-warning; done
for file in `ls */*/project.scala | cut -f1,2 -d'/'`; do scala-cli setup-ide $file --suppress-experimental-feature-warning --suppress-directives-in-multiple-files-warning; done
for file in `ls */*/*/project.scala | cut -f1,2,3 -d'/'`; do scala-cli setup-ide $file --suppress-experimental-feature-warning --suppress-directives-in-multiple-files-warning; done