Skip to content

Commit

Permalink
feat(abg)!: replace data class perks by code generation in bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
Vampire committed Sep 6, 2024
1 parent 6e0c383 commit fcb93fe
Show file tree
Hide file tree
Showing 41 changed files with 3,793 additions and 659 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/bindings-server.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ workflow(

cleanMavenLocal()

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

cleanMavenLocal()

run(
name = "Execute the script using bindings but without dependency on library",
command = """
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/bindings-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,22 @@ jobs:
name: 'Clean Maven Local to fetch required POMs again'
run: 'rm -rf ~/.m2/repository/'
- id: 'step-9'
name: 'Execute the script using the bindings from the server with v2 route'
run: |-
mv .github/workflows/test-script-consuming-jit-bindings-v2.main.do-not-compile.kts .github/workflows/test-script-consuming-jit-bindings-v2.main.kts
.github/workflows/test-script-consuming-jit-bindings-v2.main.kts
- id: 'step-10'
name: 'Clean Maven Local to fetch required POMs again'
run: 'rm -rf ~/.m2/repository/'
- id: 'step-11'
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'
- id: 'step-12'
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-11'
- id: 'step-13'
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env kotlin
@file:Repository("https://repo.maven.apache.org/maven2/")
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:1.13.0")
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.0.0")

@file:Repository("http://localhost:8080/v1")

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env kotlin
@file:Repository("https://repo.maven.apache.org/maven2/")
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.0.0")

@file:Repository("http://localhost:8080/v2")

// Regular, top-level action.
@file:DependsOn("actions:checkout:v4")

// Nested action.
@file:DependsOn("gradle:actions__setup-gradle:v3")

// Using specific version.
@file:DependsOn("actions:cache:v3.3.3")

// Always untyped action.
@file:DependsOn("typesafegithub:always-untyped-action-for-tests:v1")

import io.github.typesafegithub.workflows.actions.actions.Cache
import io.github.typesafegithub.workflows.actions.actions.Checkout
import io.github.typesafegithub.workflows.actions.actions.Checkout_Untyped
import io.github.typesafegithub.workflows.actions.gradle.ActionsSetupGradle
import io.github.typesafegithub.workflows.actions.typesafegithub.AlwaysUntypedActionForTests_Untyped

println(Checkout_Untyped(fetchTags_Untyped = "false"))
println(Checkout(fetchTags = false))
println(Checkout(fetchTags_Untyped = "false"))
println(AlwaysUntypedActionForTests_Untyped(foobar_Untyped = "baz"))
println(ActionsSetupGradle())
println(Cache(path = listOf("some-path"), key = "some-key"))

// Ensure that 'copy(...)' method is exposed.
Checkout(fetchTags = false).copy(fetchTags = true)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env kotlin
@file:Repository("https://repo.maven.apache.org/maven2/")
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:1.13.0")
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.0.0")

@file:Repository("http://localhost:8080")

Expand Down
1 change: 1 addition & 0 deletions action-binding-generator/api/action-binding-generator.api
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ public abstract interface class io/github/typesafegithub/workflows/actionbinding

public final class io/github/typesafegithub/workflows/actionbindinggenerator/versioning/BindingVersion : java/lang/Enum {
public static final field V1 Lio/github/typesafegithub/workflows/actionbindinggenerator/versioning/BindingVersion;
public static final field V2 Lio/github/typesafegithub/workflows/actionbindinggenerator/versioning/BindingVersion;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public final fun getLibraryVersion ()Ljava/lang/String;
public final fun isDeprecated ()Z
Expand Down
2 changes: 2 additions & 0 deletions action-binding-generator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ dependencies {
implementation("com.charleskorn.kaml:kaml:0.61.0")
implementation(projects.sharedInternal)

testImplementation("io.kotest:kotest-framework-datatest")
testImplementation(kotlin("reflect"))
testImplementation(projects.githubWorkflowsKt)
}

Expand Down
Loading

0 comments on commit fcb93fe

Please sign in to comment.