Skip to content

Commit 233ed8b

Browse files
committed
Use latest action API in test workflow
1 parent 37c005c commit 233ed8b

File tree

1 file changed

+43
-68
lines changed

1 file changed

+43
-68
lines changed

.github/workflows/test.main.kts

Lines changed: 43 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
@file:DependsOn("actions:checkout:v4")
2424
@file:DependsOn("actions:setup-java:v4")
2525
@file:DependsOn("burrunan:gradle-cache-action:v1")
26-
@file:DependsOn("Vampire:setup-wsl:v3")
26+
@file:DependsOn("Vampire:setup-wsl:RELEASE")
2727

2828
import io.github.typesafegithub.workflows.actions.actions.CacheRestore
2929
import io.github.typesafegithub.workflows.actions.actions.CacheSave
@@ -157,9 +157,7 @@ workflowWithCopyright(
157157

158158
val executeAction = SetupWsl(
159159
distribution = SetupWsl.Distribution.Custom(expr("matrix.distribution.user-id")),
160-
_customInputs = mapOf(
161-
"wsl-version" to "1"
162-
)
160+
wslVersion = 1
163161
)
164162

165163
val build = job(
@@ -289,9 +287,8 @@ workflowWithCopyright(
289287
executeActionStep = usesSelf(
290288
action = executeAction.copy(
291289
distribution = Debian,
292-
_customInputs = mapOf(
293-
"wsl-version" to expr("matrix.wsl-version")
294-
)
290+
wslVersion = null,
291+
wslVersion_Untyped = expr("matrix.wsl-version")
295292
),
296293
continueOnError = true
297294
)
@@ -318,9 +315,7 @@ workflowWithCopyright(
318315
executeActionStep = usesSelf(
319316
action = SetupWsl(
320317
update = true,
321-
_customInputs = mapOf(
322-
"wsl-version" to "1"
323-
)
318+
wslVersion = 1
324319
)
325320
)
326321
commonTests()
@@ -362,10 +357,9 @@ workflowWithCopyright(
362357
executeActionStep = usesSelf(
363358
action = executeAction.copy(
364359
useCache = false,
365-
_customInputs = mapOf(
366-
// part of work-around for https://bugs.kali.org/view.php?id=8921
367-
"wsl-version" to expr(getWslVersionExpression(kali))
368-
)
360+
// part of work-around for https://bugs.kali.org/view.php?id=8921
361+
wslVersion = null,
362+
wslVersion_Untyped = expr(getWslVersionExpression(kali))
369363
)
370364
)
371365
verifyFailure(
@@ -381,7 +375,7 @@ workflowWithCopyright(
381375
name = "Install Bash on Alpine",
382376
action = executeAction.copy(
383377
additionalPackages = listOf("bash"),
384-
_customInputs = emptyMap()
378+
wslVersion = null
385379
),
386380
condition = executeActionStep.getSuccessOnDistributionCondition(alpine)
387381
)
@@ -407,7 +401,7 @@ workflowWithCopyright(
407401
name = "Add wsl-sh wrapper",
408402
action = executeAction.copy(
409403
wslShellCommand = "sh -eu",
410-
_customInputs = emptyMap()
404+
wslVersion = null
411405
)
412406
)
413407
runAfterSuccess(
@@ -442,7 +436,7 @@ workflowWithCopyright(
442436
executeActionStep = usesSelfAfterSuccess(
443437
name = "Re-add wsl-bash wrapper",
444438
action = executeAction.copy(
445-
_customInputs = emptyMap()
439+
wslVersion = null
446440
)
447441
)
448442
runAfterSuccess(
@@ -485,7 +479,7 @@ workflowWithCopyright(
485479
action = executeAction.copy(
486480
additionalPackages = listOf("sudo"),
487481
wslShellCommand = """bash -c "sudo -u test bash --noprofile --norc -euo pipefail "\""",
488-
_customInputs = emptyMap()
482+
wslVersion = null
489483
)
490484
)
491485
verifyCommandResult(
@@ -529,7 +523,7 @@ workflowWithCopyright(
529523
},
530524
action = executeAction.copy(
531525
wslShellCommand = """bash -c "sudo -u test bash --noprofile --norc -euo pipefail '{0}'"""",
532-
_customInputs = emptyMap()
526+
wslVersion = null
533527
)
534528
)
535529
verifyCommandResult(
@@ -541,7 +535,7 @@ workflowWithCopyright(
541535
executeActionStep = usesSelfAfterSuccess(
542536
name = "Set wsl-bash wrapper to use default user by default",
543537
action = executeAction.copy(
544-
_customInputs = emptyMap()
538+
wslVersion = null
545539
)
546540
)
547541
verifyCommandResult(
@@ -558,7 +552,7 @@ workflowWithCopyright(
558552
name = "Set wsl-bash wrapper to use existing user test by default with extra parameter",
559553
action = executeAction.copy(
560554
wslShellUser = "test",
561-
_customInputs = emptyMap()
555+
wslVersion = null
562556
)
563557
)
564558
verifyCommandResult(
@@ -575,7 +569,7 @@ workflowWithCopyright(
575569
name = "Set wsl-bash wrapper to use non-existing user test2 by default with extra parameter",
576570
action = executeAction.copy(
577571
wslShellUser = "test2",
578-
_customInputs = emptyMap()
572+
wslVersion = null
579573
)
580574
)
581575
verifyCommandResult(
@@ -598,7 +592,7 @@ workflowWithCopyright(
598592
executeActionStep = usesSelfAfterSuccess(
599593
name = "Make a no-op execution of the action",
600594
action = executeAction.copy(
601-
_customInputs = emptyMap()
595+
wslVersion = null
602596
)
603597
)
604598
verifyCommandResult(
@@ -634,7 +628,7 @@ workflowWithCopyright(
634628
name = "Install Bash on Alpine",
635629
action = executeAction.copy(
636630
additionalPackages = listOf("bash"),
637-
_customInputs = emptyMap()
631+
wslVersion = null
638632
),
639633
condition = executeActionStep.getSuccessOnDistributionCondition(alpine)
640634
)
@@ -675,7 +669,7 @@ workflowWithCopyright(
675669
name = "Install Bash on Alpine",
676670
action = executeAction.copy(
677671
additionalPackages = listOf("bash"),
678-
_customInputs = emptyMap()
672+
wslVersion = null
679673
),
680674
condition = executeActionStep.getSuccessOnDistributionCondition(alpine)
681675
)
@@ -704,7 +698,7 @@ workflowWithCopyright(
704698
[automount]
705699
root = /
706700
""".trimIndent(),
707-
_customInputs = emptyMap()
701+
wslVersion = null
708702
)
709703
)
710704
runAfterSuccess(
@@ -742,10 +736,9 @@ workflowWithCopyright(
742736
expr("matrix.distribution.default-absent-tool"),
743737
"bash"
744738
),
745-
_customInputs = mapOf(
746-
// part of work-around for https://bugs.kali.org/view.php?id=8921
747-
"wsl-version" to expr(getWslVersionExpression(kali))
748-
)
739+
// part of work-around for https://bugs.kali.org/view.php?id=8921
740+
wslVersion = null,
741+
wslVersion_Untyped = expr(getWslVersionExpression(kali))
749742
),
750743
// part of work-around for https://bugs.kali.org/view.php?id=8921
751744
condition = """
@@ -824,9 +817,8 @@ workflowWithCopyright(
824817
""".trimIndent()
825818
)
826819
),
827-
_customInputs = mapOf(
828-
"wsl-version" to expr("matrix.wsl-version")
829-
)
820+
wslVersion = null,
821+
wslVersion_Untyped = expr("matrix.wsl-version")
830822
)
831823
)
832824
verifyCommandResult(
@@ -855,25 +847,19 @@ workflowWithCopyright(
855847
usesSelf(
856848
action = executeAction.copy(
857849
distribution = Debian,
858-
_customInputs = mapOf(
859-
"wsl-version" to "1"
860-
)
850+
wslVersion = 1
861851
)
862852
)
863853
usesSelf(
864854
action = executeAction.copy(
865855
distribution = Ubuntu1604,
866-
_customInputs = mapOf(
867-
"wsl-version" to "2"
868-
)
856+
wslVersion = 2
869857
)
870858
)
871859
executeActionStep = usesSelf(
872860
action = executeAction.copy(
873861
distribution = Ubuntu1804,
874-
_customInputs = mapOf(
875-
"wsl-version" to "1"
876-
)
862+
wslVersion = 1
877863
)
878864
)
879865
verifyCommandResult(
@@ -912,7 +898,7 @@ workflowWithCopyright(
912898
""".trimIndent()
913899
)
914900
),
915-
_customInputs = emptyMap()
901+
wslVersion = null
916902
)
917903
)
918904
verifyCommandResult(
@@ -992,28 +978,22 @@ workflowWithCopyright(
992978
name = "Execute action for ${expr("matrix.distributions.distribution1.user-id")}",
993979
action = SetupWsl(
994980
distribution = SetupWsl.Distribution.Custom(expr("matrix.distributions.distribution1.user-id")),
995-
_customInputs = mapOf(
996-
"wsl-version" to "1"
997-
)
981+
wslVersion = 1
998982
)
999983
)
1000984
usesSelf(
1001985
name = "Execute action for ${expr("matrix.distributions.distribution2.user-id")}",
1002986
action = SetupWsl(
1003987
distribution = SetupWsl.Distribution.Custom(expr("matrix.distributions.distribution2.user-id")),
1004-
_customInputs = mapOf(
1005-
"wsl-version" to "1"
1006-
)
988+
wslVersion = 1
1007989
)
1008990
)
1009991
usesSelf(
1010992
name = "Execute action for ${expr("matrix.distributions.distribution3.user-id")}",
1011993
action = SetupWsl(
1012994
distribution = SetupWsl.Distribution.Custom(expr("matrix.distributions.distribution3.user-id")),
1013995
setAsDefault = false,
1014-
_customInputs = mapOf(
1015-
"wsl-version" to "1"
1016-
)
996+
wslVersion = 1
1017997
)
1018998
)
1019999
executeActionStep = usesSelf(
@@ -1087,19 +1067,18 @@ workflowWithCopyright(
10871067
""".trimMargin()
10881068
)
10891069
),
1090-
_customInputs = mapOf(
1091-
// part of work-around for https://bugs.kali.org/view.php?id=8921
1092-
// and https://bugs.kali.org/view.php?id=6672
1093-
// and https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2069555
1094-
"wsl-version" to expr(getWslVersionExpression(kali, ubuntu2404))
1095-
)
1070+
// part of work-around for https://bugs.kali.org/view.php?id=8921
1071+
// and https://bugs.kali.org/view.php?id=6672
1072+
// and https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2069555
1073+
wslVersion = null,
1074+
wslVersion_Untyped = expr(getWslVersionExpression(kali, ubuntu2404))
10961075
)
10971076
)
10981077
usesSelf(
10991078
name = "Update distribution",
11001079
action = executeAction.copy(
11011080
update = true,
1102-
_customInputs = emptyMap()
1081+
wslVersion = null
11031082
),
11041083
// part of work-around for https://bugs.kali.org/view.php?id=6672
11051084
// and https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2069555
@@ -1119,7 +1098,7 @@ workflowWithCopyright(
11191098
name = "Install default absent tool",
11201099
action = executeAction.copy(
11211100
additionalPackages = listOf(expr("matrix.distribution.default-absent-tool")),
1122-
_customInputs = emptyMap()
1101+
wslVersion = null
11231102
),
11241103
// part of work-around for https://bugs.kali.org/view.php?id=8921
11251104
condition = """
@@ -1155,9 +1134,7 @@ workflowWithCopyright(
11551134
name = "Execute action for ${expr("matrix.distribution2.user-id")}",
11561135
action = SetupWsl(
11571136
distribution = SetupWsl.Distribution.Custom(expr("matrix.distribution2.user-id")),
1158-
_customInputs = mapOf(
1159-
"wsl-version" to "1"
1160-
)
1137+
wslVersion = 1
11611138
)
11621139
)
11631140
verifyInstalledDistribution(
@@ -1167,7 +1144,7 @@ workflowWithCopyright(
11671144
executeActionStep = usesSelfAfterSuccess(
11681145
name = "Re-execute action",
11691146
action = executeAction.copy(
1170-
_customInputs = emptyMap()
1147+
wslVersion = null
11711148
)
11721149
)
11731150
verifyInstalledDistribution(
@@ -1178,7 +1155,7 @@ workflowWithCopyright(
11781155
name = "Set as default",
11791156
action = executeAction.copy(
11801157
setAsDefault = true,
1181-
_customInputs = emptyMap()
1158+
wslVersion = null
11821159
)
11831160
)
11841161
verifyInstalledDistribution(
@@ -1222,9 +1199,7 @@ workflowWithCopyright(
12221199
distribution = SetupWsl.Distribution.Custom(expr("matrix.distributions.distribution$it.user-id")),
12231200
additionalPackages = if (it == 2) listOf("bash") else null,
12241201
setAsDefault = if (it >= 3) false else null,
1225-
_customInputs = mapOf(
1226-
"wsl-version" to "1"
1227-
)
1202+
wslVersion = 1
12281203
)
12291204
)
12301205
}

0 commit comments

Comments
 (0)