Skip to content

Commit

Permalink
feat(abg)!: Allow to wire typed outputs to matching typed inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Vampire committed Aug 24, 2024
1 parent 060e80b commit 3a53468
Show file tree
Hide file tree
Showing 34 changed files with 1,371 additions and 468 deletions.
59 changes: 30 additions & 29 deletions .github/workflows/bindings-server.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -79,35 +79,36 @@ workflow(
}
}

cleanMavenLocal()

run(
name = "Execute the script using the bindings from the server - with /binding",
command = """
mv .github/workflows/test-script-consuming-jit-bindings-old.main.do-not-compile.kts .github/workflows/test-script-consuming-jit-bindings-old.main.kts
.github/workflows/test-script-consuming-jit-bindings-old.main.kts
""".trimIndent(),
)

cleanMavenLocal()

run(
name = "Execute the script using the bindings from the server",
command = """
mv .github/workflows/test-script-consuming-jit-bindings.main.do-not-compile.kts .github/workflows/test-script-consuming-jit-bindings.main.kts
.github/workflows/test-script-consuming-jit-bindings.main.kts
""".trimIndent(),
)

cleanMavenLocal()

run(
name = "Execute the script using bindings but without dependency on library",
command = """
mv .github/workflows/test-served-bindings-depend-on-library.main.do-not-compile.kts .github/workflows/test-served-bindings-depend-on-library.main.kts
.github/workflows/test-served-bindings-depend-on-library.main.kts
""".trimIndent(),
)
// TODO: Reenable after release, currently, new class "Expression" cannot be found
//cleanMavenLocal()

//run(
// name = "Execute the script using the bindings from the server - with /binding",
// command = """
// mv .github/workflows/test-script-consuming-jit-bindings-old.main.do-not-compile.kts .github/workflows/test-script-consuming-jit-bindings-old.main.kts
// .github/workflows/test-script-consuming-jit-bindings-old.main.kts
// """.trimIndent(),
//)

//cleanMavenLocal()

//run(
// name = "Execute the script using the bindings from the server",
// command = """
// mv .github/workflows/test-script-consuming-jit-bindings.main.do-not-compile.kts .github/workflows/test-script-consuming-jit-bindings.main.kts
// .github/workflows/test-script-consuming-jit-bindings.main.kts
// """.trimIndent(),
//)

//cleanMavenLocal()

//run(
// name = "Execute the script using bindings but without dependency on library",
// command = """
// mv .github/workflows/test-served-bindings-depend-on-library.main.do-not-compile.kts .github/workflows/test-served-bindings-depend-on-library.main.kts
// .github/workflows/test-served-bindings-depend-on-library.main.kts
// """.trimIndent(),
//)

run(
name = "Fetch maven-metadata.xml for top-level action - with /binding",
Expand Down
30 changes: 3 additions & 27 deletions .github/workflows/bindings-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,39 +46,15 @@ jobs:
GHWKT_GITHUB_CONTEXT_JSON: '${{ toJSON(github) }}'
run: 'GHWKT_RUN_STEP=''end-to-end-test:step-3'' ''.github/workflows/bindings-server.main.kts'''
- id: 'step-4'
name: 'Clean Maven Local to fetch required POMs again'
run: 'rm -rf ~/.m2/repository/'
- id: 'step-5'
name: 'Execute the script using the bindings from the server - with /binding'
run: |-
mv .github/workflows/test-script-consuming-jit-bindings-old.main.do-not-compile.kts .github/workflows/test-script-consuming-jit-bindings-old.main.kts
.github/workflows/test-script-consuming-jit-bindings-old.main.kts
- id: 'step-6'
name: 'Clean Maven Local to fetch required POMs again'
run: 'rm -rf ~/.m2/repository/'
- id: 'step-7'
name: 'Execute the script using the bindings from the server'
run: |-
mv .github/workflows/test-script-consuming-jit-bindings.main.do-not-compile.kts .github/workflows/test-script-consuming-jit-bindings.main.kts
.github/workflows/test-script-consuming-jit-bindings.main.kts
- id: 'step-8'
name: 'Clean Maven Local to fetch required POMs again'
run: 'rm -rf ~/.m2/repository/'
- id: 'step-9'
name: 'Execute the script using bindings but without dependency on library'
run: |-
mv .github/workflows/test-served-bindings-depend-on-library.main.do-not-compile.kts .github/workflows/test-served-bindings-depend-on-library.main.kts
.github/workflows/test-served-bindings-depend-on-library.main.kts
- id: 'step-10'
name: 'Fetch maven-metadata.xml for top-level action - with /binding'
run: 'curl --fail http://localhost:8080/binding/actions/checkout/maven-metadata.xml | grep ''<version>v4</version>'''
- id: 'step-11'
- id: 'step-5'
name: 'Fetch maven-metadata.xml for nested action - with /binding'
run: 'curl --fail http://localhost:8080/binding/actions/cache__save/maven-metadata.xml | grep ''<version>v4</version>'''
- id: 'step-12'
- id: 'step-6'
name: 'Fetch maven-metadata.xml for top-level action'
run: 'curl --fail http://localhost:8080/actions/checkout/maven-metadata.xml | grep ''<version>v4</version>'''
- id: 'step-13'
- id: 'step-7'
name: 'Fetch maven-metadata.xml for nested action'
run: 'curl --fail http://localhost:8080/actions/cache__save/maven-metadata.xml | grep ''<version>v4</version>'''
deploy:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/end-to-end-tests.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ workflow(
name = "Some step consuming other step's output",
action = Checkout(
sshKey = expr(addAndCommit.outputs.pythonVersion),
path = expr(addAndCommit.outputs["my-unsafe-output"]),
path = addAndCommit.outputs["my-unsafe-output"].expressionString,
),
)

Expand Down Expand Up @@ -232,8 +232,8 @@ workflow(
""".trimIndent(),
),
)
jobOutputs.scriptKey = scriptStep.outputs["key"]
jobOutputs.scriptKey2 = scriptStep.outputs["key2"]
jobOutputs.scriptKey = scriptStep.outputs["key"].expression
jobOutputs.scriptKey2 = scriptStep.outputs["key2"].expression
jobOutputs.scriptResult = scriptStep.outputs.result
}

Expand Down
21 changes: 19 additions & 2 deletions action-binding-generator/api/action-binding-generator.api
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,23 @@ public final class io/github/typesafegithub/workflows/actionbindinggenerator/dom
public static final fun isTopLevel (Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords;)Z
}

public final class io/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionTypings {
public fun <init> ()V
public fun <init> (Ljava/util/Map;Ljava/util/Map;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/TypingActualSource;)V
public synthetic fun <init> (Ljava/util/Map;Ljava/util/Map;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/TypingActualSource;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Ljava/util/Map;
public final fun component2 ()Ljava/util/Map;
public final fun component3 ()Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/TypingActualSource;
public final fun copy (Ljava/util/Map;Ljava/util/Map;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/TypingActualSource;)Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionTypings;
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;
public fun equals (Ljava/lang/Object;)Z
public final fun getInputTypings ()Ljava/util/Map;
public final fun getOutputTypings ()Ljava/util/Map;
public final fun getSource ()Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/TypingActualSource;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class io/github/typesafegithub/workflows/actionbindinggenerator/domain/CommitHash : io/github/typesafegithub/workflows/actionbindinggenerator/domain/MetadataRevision {
public fun <init> (Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
Expand Down Expand Up @@ -72,8 +89,8 @@ public final class io/github/typesafegithub/workflows/actionbindinggenerator/gen
}

public final class io/github/typesafegithub/workflows/actionbindinggenerator/generation/GenerationKt {
public static final fun generateBinding (Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/MetadataRevision;Lio/github/typesafegithub/workflows/actionbindinggenerator/metadata/Metadata;Lkotlin/Pair;)Ljava/util/List;
public static synthetic fun generateBinding$default (Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/MetadataRevision;Lio/github/typesafegithub/workflows/actionbindinggenerator/metadata/Metadata;Lkotlin/Pair;ILjava/lang/Object;)Ljava/util/List;
public static final fun generateBinding (Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/MetadataRevision;Lio/github/typesafegithub/workflows/actionbindinggenerator/metadata/Metadata;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionTypings;)Ljava/util/List;
public static synthetic fun generateBinding$default (Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords;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;
}

public final class io/github/typesafegithub/workflows/actionbindinggenerator/metadata/Input {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.github.typesafegithub.workflows.actionbindinggenerator.domain

import io.github.typesafegithub.workflows.actionbindinggenerator.typing.Typing

public data class ActionTypings(
val inputTypings: Map<String, Typing> = emptyMap(),
val outputTypings: Map<String, Typing> = emptyMap(),
val source: TypingActualSource? = null,
)
Loading

0 comments on commit 3a53468

Please sign in to comment.