Skip to content

Commit 1cc527e

Browse files
committed
feat(abg)!: allow to wire typed outputs to matching typed inputs
1 parent cd64a8e commit 1cc527e

47 files changed

Lines changed: 1712 additions & 538 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/bindings-server.main.kts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,16 @@ workflow(
101101
""".trimIndent(),
102102
)
103103

104-
cleanMavenLocal()
105-
106-
run(
107-
name = "Execute the script using the bindings from the server with v2 route",
108-
command = """
109-
mv .github/workflows/test-script-consuming-jit-bindings-v2.main.do-not-compile.kts .github/workflows/test-script-consuming-jit-bindings-v2.main.kts
110-
.github/workflows/test-script-consuming-jit-bindings-v2.main.kts
111-
""".trimIndent(),
112-
)
104+
// TODO: Reenable after release, currently, new class "Expression" cannot be found
105+
//cleanMavenLocal()
106+
107+
//run(
108+
// name = "Execute the script using the bindings from the server with v2 route",
109+
// command = """
110+
// mv .github/workflows/test-script-consuming-jit-bindings-v2.main.do-not-compile.kts .github/workflows/test-script-consuming-jit-bindings-v2.main.kts
111+
// .github/workflows/test-script-consuming-jit-bindings-v2.main.kts
112+
// """.trimIndent(),
113+
//)
113114

114115
cleanMavenLocal()
115116

.github/workflows/bindings-server.yaml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -65,54 +65,46 @@ jobs:
6565
name: 'Clean Maven Local to fetch required POMs again'
6666
run: 'rm -rf ~/.m2/repository/'
6767
- id: 'step-9'
68-
name: 'Execute the script using the bindings from the server with v2 route'
69-
run: |-
70-
mv .github/workflows/test-script-consuming-jit-bindings-v2.main.do-not-compile.kts .github/workflows/test-script-consuming-jit-bindings-v2.main.kts
71-
.github/workflows/test-script-consuming-jit-bindings-v2.main.kts
72-
- id: 'step-10'
73-
name: 'Clean Maven Local to fetch required POMs again'
74-
run: 'rm -rf ~/.m2/repository/'
75-
- id: 'step-11'
7668
name: 'Execute the script using bindings but without dependency on library'
7769
run: |-
7870
mv .github/workflows/test-served-bindings-depend-on-library.main.do-not-compile.kts .github/workflows/test-served-bindings-depend-on-library.main.kts
7971
.github/workflows/test-served-bindings-depend-on-library.main.kts
80-
- id: 'step-12'
72+
- id: 'step-10'
8173
name: 'Install Kotlin 1.9.0'
8274
uses: 'fwilhe2/setup-kotlin@0.11.0'
8375
with:
8476
version: '1.9.0'
85-
- id: 'step-13'
77+
- id: 'step-11'
8678
name: 'Clean Maven Local to fetch required POMs again'
8779
run: 'rm -rf ~/.m2/repository/'
88-
- id: 'step-14'
80+
- id: 'step-12'
8981
name: 'Execute the script using the bindings from the server, using older Kotlin (1.9.0) as consumer'
9082
run: |2-
9183
cp .github/workflows/test-script-consuming-jit-bindings.main.kts .github/workflows/test-script-consuming-jit-bindings-too-old-kotlin.main.kts
9284
(.github/workflows/test-script-consuming-jit-bindings-too-old-kotlin.main.kts || true) >> output.txt 2>&1
9385
grep "was compiled with an incompatible version of Kotlin" output.txt
94-
- id: 'step-15'
86+
- id: 'step-13'
9587
name: 'Install Kotlin 2.0.0'
9688
uses: 'fwilhe2/setup-kotlin@0.11.0'
9789
with:
9890
version: '2.0.0'
99-
- id: 'step-16'
91+
- id: 'step-14'
10092
name: 'Clean Maven Local to fetch required POMs again'
10193
run: 'rm -rf ~/.m2/repository/'
102-
- id: 'step-17'
94+
- id: 'step-15'
10395
name: 'Execute the script using the bindings from the server, using older Kotlin (2.0.0) as consumer'
10496
run: |-
10597
cp .github/workflows/test-script-consuming-jit-bindings.main.kts .github/workflows/test-script-consuming-jit-bindings-older-kotlin.main.kts
10698
.github/workflows/test-script-consuming-jit-bindings-older-kotlin.main.kts
107-
- id: 'step-18'
99+
- id: 'step-16'
108100
name: 'Compile a Gradle project using the bindings from the server'
109101
run: |-
110102
cd .github/workflows/test-gradle-project-using-bindings-server
111103
./gradlew build
112-
- id: 'step-19'
104+
- id: 'step-17'
113105
name: 'Fetch maven-metadata.xml for top-level action'
114106
run: 'curl --fail http://localhost:8080/actions/checkout/maven-metadata.xml | grep ''<version>v4</version>'''
115-
- id: 'step-20'
107+
- id: 'step-18'
116108
name: 'Fetch maven-metadata.xml for nested action'
117109
run: 'curl --fail http://localhost:8080/actions/cache__save/maven-metadata.xml | grep ''<version>v4</version>'''
118110
deploy:

.github/workflows/end-to-end-tests.main.kts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import io.github.typesafegithub.workflows.actions.actions.*
1515
import io.github.typesafegithub.workflows.actions.gradle.ActionsSetupGradle
1616
import io.github.typesafegithub.workflows.actions.wandalen.WretryAction
1717
import io.github.typesafegithub.workflows.annotations.ExperimentalKotlinLogicStep
18+
import io.github.typesafegithub.workflows.domain.Expression
1819
import io.github.typesafegithub.workflows.domain.JobOutputs
1920
import io.github.typesafegithub.workflows.domain.Mode
2021
import io.github.typesafegithub.workflows.domain.Permission
@@ -81,9 +82,9 @@ workflow(
8182
Permission.Contents to Mode.None,
8283
),
8384
outputs = object : JobOutputs() {
84-
var scriptKey by output()
85-
var scriptKey2 by output()
86-
var scriptResult by output()
85+
var scriptKey by output<String>()
86+
var scriptKey2 by output<String>()
87+
var scriptResult by output<String>()
8788
},
8889
) {
8990
run(
@@ -179,7 +180,7 @@ workflow(
179180
name = "Some step consuming other step's output",
180181
action = Checkout(
181182
sshKey = expr(addAndCommit.outputs.pythonVersion),
182-
path = expr(addAndCommit.outputs["my-unsafe-output"]),
183+
path = addAndCommit.outputs["my-unsafe-output"].expressionString,
183184
),
184185
)
185186

@@ -234,7 +235,7 @@ workflow(
234235
)
235236
jobOutputs.scriptKey = scriptStep.outputs["key"]
236237
jobOutputs.scriptKey2 = scriptStep.outputs["key2"]
237-
jobOutputs.scriptResult = scriptStep.outputs.result
238+
jobOutputs.scriptResult = Expression(scriptStep.outputs.result)
238239
}
239240

240241
job(
@@ -250,9 +251,9 @@ workflow(
250251
run(
251252
name = "use output of script",
252253
command = """
253-
echo ${expr { testJob1.outputs.scriptKey }}
254-
echo ${expr { testJob1.outputs.scriptKey2 }}
255-
echo ${expr { testJob1.outputs.scriptResult }}
254+
echo ${testJob1.outputs.scriptKey.expressionString}
255+
echo ${expr(testJob1.outputs.scriptKey2.expression)}
256+
echo ${expr { testJob1.outputs.scriptResult.expression }}
256257
""".trimIndent(),
257258
)
258259

action-binding-generator/api/action-binding-generator.api

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,23 @@ public final class io/github/typesafegithub/workflows/actionbindinggenerator/dom
2323
public static final fun isTopLevel (Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords;)Z
2424
}
2525

26+
public final class io/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionTypings {
27+
public fun <init> ()V
28+
public fun <init> (Ljava/util/Map;Ljava/util/Map;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/TypingActualSource;)V
29+
public synthetic fun <init> (Ljava/util/Map;Ljava/util/Map;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/TypingActualSource;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
30+
public final fun component1 ()Ljava/util/Map;
31+
public final fun component2 ()Ljava/util/Map;
32+
public final fun component3 ()Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/TypingActualSource;
33+
public final fun copy (Ljava/util/Map;Ljava/util/Map;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/TypingActualSource;)Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionTypings;
34+
public static synthetic fun copy$default (Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionTypings;Ljava/util/Map;Ljava/util/Map;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/TypingActualSource;ILjava/lang/Object;)Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionTypings;
35+
public fun equals (Ljava/lang/Object;)Z
36+
public final fun getInputTypings ()Ljava/util/Map;
37+
public final fun getOutputTypings ()Ljava/util/Map;
38+
public final fun getSource ()Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/TypingActualSource;
39+
public fun hashCode ()I
40+
public fun toString ()Ljava/lang/String;
41+
}
42+
2643
public final class io/github/typesafegithub/workflows/actionbindinggenerator/domain/CommitHash : io/github/typesafegithub/workflows/actionbindinggenerator/domain/MetadataRevision {
2744
public fun <init> (Ljava/lang/String;)V
2845
public final fun component1 ()Ljava/lang/String;
@@ -72,8 +89,8 @@ public final class io/github/typesafegithub/workflows/actionbindinggenerator/gen
7289
}
7390

7491
public final class io/github/typesafegithub/workflows/actionbindinggenerator/generation/GenerationKt {
75-
public static final fun generateBinding (Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords;Lio/github/typesafegithub/workflows/actionbindinggenerator/versioning/BindingVersion;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/MetadataRevision;Lio/github/typesafegithub/workflows/actionbindinggenerator/metadata/Metadata;Lkotlin/Pair;)Ljava/util/List;
76-
public static synthetic fun generateBinding$default (Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords;Lio/github/typesafegithub/workflows/actionbindinggenerator/versioning/BindingVersion;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/MetadataRevision;Lio/github/typesafegithub/workflows/actionbindinggenerator/metadata/Metadata;Lkotlin/Pair;ILjava/lang/Object;)Ljava/util/List;
92+
public static final fun generateBinding (Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords;Lio/github/typesafegithub/workflows/actionbindinggenerator/versioning/BindingVersion;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/MetadataRevision;Lio/github/typesafegithub/workflows/actionbindinggenerator/metadata/Metadata;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionTypings;)Ljava/util/List;
93+
public static synthetic fun generateBinding$default (Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords;Lio/github/typesafegithub/workflows/actionbindinggenerator/versioning/BindingVersion;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/MetadataRevision;Lio/github/typesafegithub/workflows/actionbindinggenerator/metadata/Metadata;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionTypings;ILjava/lang/Object;)Ljava/util/List;
7794
}
7895

7996
public final class io/github/typesafegithub/workflows/actionbindinggenerator/metadata/Input {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package io.github.typesafegithub.workflows.actionbindinggenerator.domain
2+
3+
import io.github.typesafegithub.workflows.actionbindinggenerator.typing.Typing
4+
5+
public data class ActionTypings(
6+
val inputTypings: Map<String, Typing> = emptyMap(),
7+
val outputTypings: Map<String, Typing> = emptyMap(),
8+
val source: TypingActualSource? = null,
9+
)

0 commit comments

Comments
 (0)