File tree 5 files changed +49
-0
lines changed 5 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 5
5
- main
6
6
pull_request :
7
7
jobs :
8
+ test :
9
+ name : " Run tests"
10
+ runs-on : ubuntu-latest
11
+ steps :
12
+ - name : Checkout code
13
+ uses : actions/checkout@v3
14
+ with :
15
+ fetch-depth : 0
16
+
17
+ - name : Install tools
18
+ uses : asdf-vm/actions/install@v3
19
+
20
+ - name : Run tests
21
+ run : pkl test tests.pkl
8
22
build_and_publish :
9
23
name : " Create Pkl package, tag and release"
10
24
runs-on : ubuntu-latest
25
+ needs : test
11
26
steps :
12
27
- name : Checkout code
13
28
uses : actions/checkout@v3
Original file line number Diff line number Diff line change
1
+ import "../tfVarsRenderer.pkl"
2
+
3
+ one = 1
4
+ two = "two"
5
+ three = true
6
+
7
+ output {
8
+ renderer = new tfVarsRenderer .TfVarsRenderer{}
9
+ }
Original file line number Diff line number Diff line change
1
+ amends "pkl:test"
2
+ import * "examples/*.pkl" as allExamples
3
+
4
+ examples {
5
+ for (key in allExamples.keys) {
6
+ [key.drop("examples/" .length).replaceLast("pkl" ,"tfvars" )] {
7
+ allExamples[key].output.text
8
+ }
9
+ }
10
+ }
Original file line number Diff line number Diff line change
1
+ examples {
2
+ ["basic.tfvars"] {
3
+ """
4
+ one = 1
5
+ two = "two"
6
+ three = true
7
+ """
8
+ }
9
+ }
Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ class TfVarsRenderer extends ValueRenderer {
5
5
function renderValue (value : Any ): String =
6
6
if (value is String)
7
7
"\" " + value + "\" "
8
+ else if (value is Int || value is Float)
9
+ value.toString()
10
+ else if (value is List)
11
+ "[" + value.map((el) -> renderValue(el)).join(", " ) + "]"
12
+ else if (value is Map)
13
+ "{" + value.entries.map((el) -> el.key + " = " + renderValue(el.value)).join(", " ) + "}"
8
14
else if (value is Boolean)
9
15
if (value) "true" else "false"
10
16
else if (value is Dynamic)
You can’t perform that action at this time.
0 commit comments