diff --git a/action-binding-generator/api/action-binding-generator.api b/action-binding-generator/api/action-binding-generator.api index 9dc904e866..056fdfb1e7 100644 --- a/action-binding-generator/api/action-binding-generator.api +++ b/action-binding-generator/api/action-binding-generator.api @@ -1,6 +1,6 @@ public final class io/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords { - public fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/SignificantVersion;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V - public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/SignificantVersion;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/SignificantVersion;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/SignificantVersion;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ljava/lang/String; public final fun component2 ()Ljava/lang/String; public final fun component3 ()Ljava/lang/String; @@ -8,14 +8,16 @@ public final class io/github/typesafegithub/workflows/actionbindinggenerator/dom public final fun component5 ()Ljava/lang/String; public final fun component6 ()Ljava/lang/String; public final fun component7 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/SignificantVersion;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords; - public static synthetic fun copy$default (Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/SignificantVersion;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords; + public final fun component8 ()Ljava/lang/String; + public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/SignificantVersion;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords; + public static synthetic fun copy$default (Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/SignificantVersion;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords; public fun equals (Ljava/lang/Object;)Z public final fun getComment ()Ljava/lang/String; public final fun getName ()Ljava/lang/String; public final fun getOwner ()Ljava/lang/String; public final fun getPath ()Ljava/lang/String; public final fun getSignificantVersion ()Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/SignificantVersion; + public final fun getTypesUuid ()Ljava/lang/String; public final fun getVersion ()Ljava/lang/String; public final fun getVersionForTypings ()Ljava/lang/String; public fun hashCode ()I @@ -81,6 +83,7 @@ public final class io/github/typesafegithub/workflows/actionbindinggenerator/dom public final class io/github/typesafegithub/workflows/actionbindinggenerator/domain/TypingActualSource : java/lang/Enum { public static final field ACTION Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/TypingActualSource; + public static final field CUSTOM Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/TypingActualSource; public static final field TYPING_CATALOG Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/TypingActualSource; public static fun getEntries ()Lkotlin/enums/EnumEntries; public static fun valueOf (Ljava/lang/String;)Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/TypingActualSource; @@ -107,8 +110,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;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionTypings;Lio/ktor/client/HttpClient;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - 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;Lio/ktor/client/HttpClient;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + 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/lang/String;Ljava/lang/String;Lio/ktor/client/HttpClient;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + 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;Ljava/lang/String;Ljava/lang/String;Lio/ktor/client/HttpClient;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; } public final class io/github/typesafegithub/workflows/actionbindinggenerator/metadata/Input { @@ -181,7 +184,8 @@ public final class io/github/typesafegithub/workflows/actionbindinggenerator/met } public final class io/github/typesafegithub/workflows/actionbindinggenerator/metadata/MetadataReadingKt { - public static final fun fetchMetadata (Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/MetadataRevision;Lio/ktor/client/HttpClient;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun fetchMetadata (Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/MetadataRevision;Ljava/lang/String;Lio/ktor/client/HttpClient;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun fetchMetadata$default (Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords;Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/MetadataRevision;Ljava/lang/String;Lio/ktor/client/HttpClient;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; } public final class io/github/typesafegithub/workflows/actionbindinggenerator/metadata/Output { diff --git a/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords.kt b/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords.kt index 4a3518509a..7dbdb6e32a 100644 --- a/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords.kt +++ b/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords.kt @@ -25,6 +25,7 @@ public data class ActionCoords( * the typings are defined. */ val versionForTypings: String = version, + val typesUuid: String? = null, ) /** @@ -33,9 +34,15 @@ public data class ActionCoords( */ public val ActionCoords.isTopLevel: Boolean get() = path == null -public val ActionCoords.prettyPrint: String get() = "$prettyPrintWithoutVersion@$version" +public val ActionCoords.prettyPrint: String get() = "$prettyPrintBase@$version${typesUuid?.let { + " (types: $it)" +} ?: ""}" -public val ActionCoords.prettyPrintWithoutVersion: String get() = "$owner/$fullName${ +public val ActionCoords.prettyPrintWithoutVersion: String get() = "$prettyPrintBase${typesUuid?.let { + " (types: $it)" +} ?: ""}" + +private val ActionCoords.prettyPrintBase: String get() = "$owner/$fullName${ significantVersion.takeUnless { it == FULL }?.let { " with $it version" } ?: "" }${ if ((significantVersion == COMMIT_LENIENT) && (comment != null)) " and comment '$comment'" else "" diff --git a/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/domain/TypingActualSource.kt b/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/domain/TypingActualSource.kt index 094f3251b4..4a6fca4f9e 100644 --- a/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/domain/TypingActualSource.kt +++ b/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/domain/TypingActualSource.kt @@ -3,4 +3,5 @@ package io.github.typesafegithub.workflows.actionbindinggenerator.domain public enum class TypingActualSource { ACTION, TYPING_CATALOG, + CUSTOM, } diff --git a/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/generation/Generation.kt b/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/generation/Generation.kt index 4bd81df904..cca197ed9a 100644 --- a/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/generation/Generation.kt +++ b/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/generation/Generation.kt @@ -72,13 +72,20 @@ public suspend fun ActionCoords.generateBinding( metadataRevision: MetadataRevision, metadata: Metadata? = null, inputTypings: ActionTypings? = null, + types: String? = null, + explicitMetadata: String? = null, httpClient: HttpClient = HttpClient(CIO), ): List { val metadataResolved = - metadata ?: this.fetchMetadata(metadataRevision, httpClient = httpClient) ?: return emptyList() + metadata ?: this.fetchMetadata( + metadataRevision = metadataRevision, + explicitMetadata = explicitMetadata, + httpClient = httpClient, + ) ?: return emptyList() val metadataProcessed = metadataResolved.removeDeprecatedInputsIfNameClash() - val inputTypingsResolved = inputTypings ?: this.provideTypes(metadataRevision, httpClient = httpClient) + val inputTypingsResolved = + inputTypings ?: this.provideTypes(metadataRevision, types = types, httpClient = httpClient) val packageName = owner.toKotlinPackageName() val className = this.buildActionClassName() diff --git a/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/metadata/MetadataReading.kt b/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/metadata/MetadataReading.kt index b4c1fea8fa..d3b8b06aec 100644 --- a/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/metadata/MetadataReading.kt +++ b/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/metadata/MetadataReading.kt @@ -50,8 +50,13 @@ private fun ActionCoords.actionYamlUrl(gitRef: String) = public suspend fun ActionCoords.fetchMetadata( metadataRevision: MetadataRevision, + explicitMetadata: String? = null, httpClient: HttpClient, ): Metadata? { + if (explicitMetadata != null) { + return yaml.decodeFromString(explicitMetadata) + } + val gitRef = when (metadataRevision) { is CommitHash -> metadataRevision.value diff --git a/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/typing/TypesProviding.kt b/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/typing/TypesProviding.kt index 9b3369d0b1..95a4199884 100644 --- a/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/typing/TypesProviding.kt +++ b/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/typing/TypesProviding.kt @@ -11,6 +11,7 @@ import io.github.typesafegithub.workflows.actionbindinggenerator.domain.Metadata import io.github.typesafegithub.workflows.actionbindinggenerator.domain.NewestForVersion import io.github.typesafegithub.workflows.actionbindinggenerator.domain.TypingActualSource import io.github.typesafegithub.workflows.actionbindinggenerator.domain.TypingActualSource.ACTION +import io.github.typesafegithub.workflows.actionbindinggenerator.domain.TypingActualSource.CUSTOM import io.github.typesafegithub.workflows.actionbindinggenerator.domain.TypingActualSource.TYPING_CATALOG import io.github.typesafegithub.workflows.actionbindinggenerator.domain.subName import io.github.typesafegithub.workflows.actionbindinggenerator.utils.toPascalCase @@ -26,11 +27,13 @@ private val logger = logger { } internal suspend fun ActionCoords.provideTypes( metadataRevision: MetadataRevision, + types: String? = null, httpClient: HttpClient, ): ActionTypings = ( - this.fetchTypingMetadata(metadataRevision, httpClient) - ?: this.toMajorVersionForTypings().fetchFromTypingsFromCatalog(httpClient) + customTypingMetadata(types) + ?: this.fetchTypingMetadata(metadataRevision, httpClient) + ?: this.toMajorVersionForTypings().fetchTypingsFromCatalog(httpClient) )?.let { (typings, typingActualSource) -> ActionTypings( inputTypings = typings.toTypesMap(), @@ -53,6 +56,9 @@ private fun ActionCoords.actionTypesFromCatalog() = private fun ActionCoords.catalogMetadata() = "$CATALOG_BASE_URL/${owner.lowercase()}/${name.lowercase()}/metadata.yml" +private fun customTypingMetadata(types: String? = null) = + types?.let { Pair(yaml.decodeFromStringOrDefaultIfEmpty(it, ActionTypes()), CUSTOM) } + private suspend fun ActionCoords.fetchTypingMetadata( metadataRevision: MetadataRevision, httpClient: HttpClient, @@ -86,7 +92,7 @@ private suspend fun ActionCoords.fetchTypingMetadata( return Pair(yaml.decodeFromStringOrDefaultIfEmpty(typesMetadataYaml, ActionTypes()), ACTION) } -private suspend fun ActionCoords.fetchFromTypingsFromCatalog( +private suspend fun ActionCoords.fetchTypingsFromCatalog( httpClient: HttpClient, ): Pair? = ( diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/typing/TypesProvidingTest.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/typing/TypesProvidingTest.kt index fb1bcd5a17..39d6e954ab 100644 --- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/typing/TypesProvidingTest.kt +++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/typing/TypesProvidingTest.kt @@ -28,7 +28,8 @@ class TypesProvidingTest : val types = actionCoord.provideTypes( metadataRevision = CommitHash("some-hash"), - mockClientReturning(actionTypesYml), + types = null, + httpClient = mockClientReturning(actionTypesYml), ) // Then @@ -44,7 +45,8 @@ class TypesProvidingTest : val types = actionCoord.provideTypes( metadataRevision = CommitHash("some-hash"), - mockClientReturning(actionTypesYml), + types = null, + httpClient = mockClientReturning(actionTypesYml), ) // Then @@ -60,7 +62,8 @@ class TypesProvidingTest : val types = actionCoord.provideTypes( metadataRevision = CommitHash("some-hash"), - mockClientReturning(actionTypesYml), + types = null, + httpClient = mockClientReturning(actionTypesYml), ) // Then @@ -76,7 +79,8 @@ class TypesProvidingTest : val types = actionCoord.provideTypes( metadataRevision = CommitHash("some-hash"), - mockClientReturning(actionTypesYml), + types = null, + httpClient = mockClientReturning(actionTypesYml), ) // Then @@ -96,7 +100,8 @@ class TypesProvidingTest : val types = actionCoord.provideTypes( metadataRevision = CommitHash("some-hash"), - mockClientReturning(actionTypesYml), + types = null, + httpClient = mockClientReturning(actionTypesYml), ) // Then @@ -146,7 +151,8 @@ class TypesProvidingTest : val types = actionCoord.provideTypes( metadataRevision = CommitHash("some-hash"), - mockClientReturning(actionTypesYml), + types = null, + httpClient = mockClientReturning(actionTypesYml), ) // Then @@ -182,6 +188,12 @@ class TypesProvidingTest : stored-in-typing-catalog: type: string """.trimIndent() + val custom = + """ + inputs: + custom: + type: string + """.trimIndent() val metadata = """ "versionsWithTypings": @@ -564,6 +576,204 @@ class TypesProvidingTest : ) } + test("only custom") { + // Given + val mockClient = + HttpClient(MockEngine { _ -> respond("Not found", status = HttpStatusCode.NotFound) }) + val actionCoord = ActionCoords("some-owner", "some-name", "v3") + + // When + val types = + actionCoord.provideTypes( + metadataRevision = CommitHash("some-hash"), + types = custom, + httpClient = mockClient, + ) + + // Then + types shouldBe + ActionTypings( + inputTypings = mapOf("custom" to StringTyping), + source = TypingActualSource.CUSTOM, + fromFallbackVersion = false, + ) + } + + test("only custom for subaction") { + // Given + val mockClient = + HttpClient(MockEngine { _ -> respond("Not found", status = HttpStatusCode.NotFound) }) + val actionCoord = ActionCoords("some-owner", "some-name", "v3", FULL, "some-sub") + + // When + val types = + actionCoord.provideTypes( + metadataRevision = CommitHash("some-hash"), + types = custom, + httpClient = mockClient, + ) + + // Then + types shouldBe + ActionTypings( + inputTypings = mapOf("custom" to StringTyping), + source = TypingActualSource.CUSTOM, + fromFallbackVersion = false, + ) + } + + test("hosted by action, stored in typing catalog, and custom") { + // Given + val mockClient = + HttpClient( + MockEngine { request -> + if (request.url.toString() == "https://raw.githubusercontent.com/some-owner/some-name/" + + "some-hash/action-types.yml" + ) { + respond(hostedByActionYml) + } else if (request.url.toString() == + "https://raw.githubusercontent.com/typesafegithub/github-actions-typing-catalog/" + + "main/typings/some-owner/some-name/v3/action-types.yml" + ) { + respond(storedInTypingCatalog) + } else { + respond("Not found", status = HttpStatusCode.NotFound) + } + }, + ) + val actionCoord = ActionCoords("some-owner", "some-name", "v3") + + // When + val types = + actionCoord.provideTypes( + metadataRevision = CommitHash("some-hash"), + types = custom, + httpClient = mockClient, + ) + + // Then + types shouldBe + ActionTypings( + inputTypings = mapOf("custom" to StringTyping), + source = TypingActualSource.CUSTOM, + fromFallbackVersion = false, + ) + } + + test("hosted by subaction, stored in typing catalog, and custom") { + // Given + val mockClient = + HttpClient( + MockEngine { request -> + if (request.url.toString() == "https://raw.githubusercontent.com/some-owner/some-name/" + + "some-hash/some-sub/action-types.yml" + ) { + respond(hostedByActionYml) + } else if (request.url.toString() == + "https://raw.githubusercontent.com/typesafegithub/github-actions-typing-catalog/" + + "main/typings/some-owner/some-name/v3/some-sub/action-types.yml" + ) { + respond(storedInTypingCatalog) + } else { + respond("Not found", status = HttpStatusCode.NotFound) + } + }, + ) + val actionCoord = ActionCoords("some-owner", "some-name", "v3", FULL, "some-sub") + + // When + val types = + actionCoord.provideTypes( + metadataRevision = CommitHash("some-hash"), + types = custom, + httpClient = mockClient, + ) + + // Then + types shouldBe + ActionTypings( + inputTypings = mapOf("custom" to StringTyping), + source = TypingActualSource.CUSTOM, + fromFallbackVersion = false, + ) + } + + test("hosted by action, stored in typing catalog, and empty custom") { + // Given + val mockClient = + HttpClient( + MockEngine { request -> + if (request.url.toString() == "https://raw.githubusercontent.com/some-owner/some-name/" + + "some-hash/action-types.yml" + ) { + respond(hostedByActionYml) + } else if (request.url.toString() == + "https://raw.githubusercontent.com/typesafegithub/github-actions-typing-catalog/" + + "main/typings/some-owner/some-name/v3/action-types.yml" + ) { + respond(storedInTypingCatalog) + } else { + respond("Not found", status = HttpStatusCode.NotFound) + } + }, + ) + val actionCoord = ActionCoords("some-owner", "some-name", "v3") + + // When + val types = + actionCoord.provideTypes( + metadataRevision = CommitHash("some-hash"), + types = "", + httpClient = mockClient, + ) + + // Then + types shouldBe + ActionTypings( + inputTypings = emptyMap(), + source = TypingActualSource.CUSTOM, + fromFallbackVersion = false, + ) + } + + test("hosted by subaction, stored in typing catalog, and empty custom") { + // Given + val mockClient = + HttpClient( + MockEngine { request -> + if (request.url.toString() == "https://raw.githubusercontent.com/some-owner/some-name/" + + "some-hash/some-sub/action-types.yml" + ) { + respond(hostedByActionYml) + } else if (request.url.toString() == + "https://raw.githubusercontent.com/typesafegithub/github-actions-typing-catalog/" + + "main/typings/some-owner/some-name/v3/some-sub/action-types.yml" + ) { + respond(storedInTypingCatalog) + } else { + respond("Not found", status = HttpStatusCode.NotFound) + } + }, + ) + val actionCoord = ActionCoords("some-owner", "some-name", "v3", FULL, "some-sub") + + // When + val types = + actionCoord.provideTypes( + metadataRevision = CommitHash("some-hash"), + types = "", + httpClient = mockClient, + ) + + // Then + types shouldBe + ActionTypings( + inputTypings = emptyMap(), + source = TypingActualSource.CUSTOM, + fromFallbackVersion = false, + ) + } + test("only stored in typing catalog for older version") { // Given val mockClient = @@ -1125,6 +1335,46 @@ class TypesProvidingTest : ) } + test("only custom") { + // Given + val mockClient = + HttpClient(MockEngine { _ -> respond("Not found", status = HttpStatusCode.NotFound) }) + val actionCoord = ActionCoords("some-owner", "some-name", "v3") + + // When + val types = + actionCoord.provideTypes( + metadataRevision = CommitHash("some-hash"), + types = typingYml, + httpClient = mockClient, + ) + + // Then + types shouldBe + ActionTypings( + inputTypings = + mapOf( + "granted-scopes" to + ListOfTypings( + ",", + EnumTyping("GrantedScopes", listOf("read", "write")), + ), + "granted-scopes2" to + ListOfTypings( + ",", + EnumTyping("GrantedScopes", listOf("read", "write")), + ), + "granted-scopes3" to + ListOfTypings( + """\n""", + EnumTyping("GrantedScopes", listOf("read", "write")), + ), + ), + source = TypingActualSource.CUSTOM, + fromFallbackVersion = false, + ) + } + test("billion laughs attack is prevented") { // Given val billionLaughsAttack = @@ -1178,7 +1428,8 @@ class TypesProvidingTest : val actionCoord = ActionCoords("some-owner", "some-name", "v6-beta") // When - val types = actionCoord.provideTypes(metadataRevision = CommitHash("some-hash"), httpClient = mockClient) + val types = + actionCoord.provideTypes(metadataRevision = CommitHash("some-hash"), httpClient = mockClient) // Then types shouldBe ActionTypings(inputTypings = emptyMap(), source = null) diff --git a/docs/user-guide/using-actions.md b/docs/user-guide/using-actions.md index f88ea7208b..881b35568e 100644 --- a/docs/user-guide/using-actions.md +++ b/docs/user-guide/using-actions.md @@ -74,6 +74,24 @@ There are two ways of configuring typings: a community-maintained place to host the typings. You can contribute or fix typings for your favorite action by sending a PR. +While developing a typing manifest it might be a good idea to test the result without needing to +release the action in question or merge a PR in the catalog. For this you can `POST` the typing manifest you have +on disk to the binding server using any valid URL for the action in question, for example using +```bash +curl -F types=@action-types.yml https://bindings.krzeminski.it/pbrisbin/setup-tool-action/v2/setup-tool-action-v2.pom +``` +The binding server generates a binding with only the given type manifest and answer with some unique coordinates +that you can use in a test workflow script. The binding will be available the normal cache time on the binding +server and locally as long as you do not delete it from your local Maven repository where it is cached. After +the cache period on the server ended requesting the same coordinates will return a binding as if no typing +information is available at all. + +When writing typings for a new action that is not published yet or a new version with changed inputs / outputs, +you should also provide the new action manifest, that the generation works with that state using +```bash +curl -F actionYaml=@action.yml -F types=@action-types.yml https://bindings.krzeminski.it/foo/bar/vX/bar-vX.pom +``` + Once there are any typings in place for the action, the `_Untyped` suffixed class is marked `@Deprecated`, and a class without that suffix is created additionally. In that class for each input that does not have type information available there will still be only the property with `_Untyped` suffix and nullability according to required status. For each diff --git a/jit-binding-server/build.gradle.kts b/jit-binding-server/build.gradle.kts index 47d94e57ac..57fa3bf1fb 100644 --- a/jit-binding-server/build.gradle.kts +++ b/jit-binding-server/build.gradle.kts @@ -13,6 +13,7 @@ dependencies { implementation("io.ktor:ktor-server-netty") implementation("io.ktor:ktor-server-call-logging") implementation("io.ktor:ktor-server-call-id") + implementation("it.krzeminski:snakeyaml-engine-kmp:3.0.2") implementation("io.ktor:ktor-server-metrics-micrometer") implementation("io.ktor:ktor-client-core") implementation("io.ktor:ktor-client-cio") diff --git a/jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver/ArtifactRoutes.kt b/jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver/ArtifactRoutes.kt index 824d422841..c741e7ae26 100644 --- a/jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver/ArtifactRoutes.kt +++ b/jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver/ArtifactRoutes.kt @@ -8,26 +8,40 @@ import io.github.typesafegithub.workflows.mavenbinding.BindingsServerRequest import io.github.typesafegithub.workflows.mavenbinding.JarArtifact import io.github.typesafegithub.workflows.mavenbinding.TextArtifact import io.github.typesafegithub.workflows.mavenbinding.VersionArtifacts +import io.github.typesafegithub.workflows.mavenbinding.buildVersionArtifacts +import io.ktor.client.HttpClient +import io.ktor.client.engine.cio.CIO import io.ktor.http.ContentType import io.ktor.http.HttpStatusCode +import io.ktor.http.content.asFlow import io.ktor.server.application.ApplicationCall import io.ktor.server.request.httpMethod +import io.ktor.server.request.receiveMultipart +import io.ktor.server.request.receiveText import io.ktor.server.response.respondBytes import io.ktor.server.response.respondText import io.ktor.server.routing.Route import io.ktor.server.routing.Routing import io.ktor.server.routing.get import io.ktor.server.routing.head +import io.ktor.server.routing.post import io.ktor.server.routing.route import io.micrometer.core.instrument.Tag import io.micrometer.core.instrument.binder.cache.CaffeineCacheMetrics import io.micrometer.prometheusmetrics.PrometheusMeterRegistry +import it.krzeminski.snakeyaml.engine.kmp.api.Load import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.flow.map +import kotlinx.coroutines.flow.toList import kotlinx.coroutines.launch import java.util.Optional +import java.util.UUID.randomUUID import kotlin.jvm.optionals.getOrNull +private const val METADATA_PARAMETER = "actionYaml" +private const val TYPES_PARAMETER = "types" + private val logger = logger { } typealias CachedVersionArtifact = Optional @@ -58,6 +72,7 @@ private fun Route.artifact( ) { headArtifact(bindingsCache, prometheusRegistry, refresh) getArtifact(bindingsCache, prometheusRegistry, refresh) + postArtifact(bindingsCache, prometheusRegistry) } private fun Route.headArtifact( @@ -112,17 +127,140 @@ internal fun prefetchBindingArtifacts( } } +private fun Route.postArtifact( + bindingsCache: LoadingCache, + prometheusRegistry: PrometheusMeterRegistry?, +) { + post { + val owner = "${call.parameters["owner"]}__types__${randomUUID()}" + val name = call.parameters["name"]!! + val version = call.parameters["version"]!! + + val (metadata, types) = + runCatching { + val parts = + call + .receiveMultipart() + .asFlow() + .map { it.name to it.asString() } + .toList() + .map { (name, result) -> + name to + when { + result.isSuccess -> { + result.getOrThrow() + } + + else -> { + call.respondText( + text = HttpStatusCode.InternalServerError.description, + status = HttpStatusCode.InternalServerError, + ) + return@post + } + } + }.associate { it } + + if (parts.keys.any { (it != METADATA_PARAMETER) && (it != TYPES_PARAMETER) }) { + call.respondBadRequest( + text = "Only '$METADATA_PARAMETER' and '$TYPES_PARAMETER' are allowed as form data fields", + ) + return@post + } + if (!parts.containsKey(TYPES_PARAMETER)) { + call.respondBadRequest(text = "'$TYPES_PARAMETER' field is mandatory") + return@post + } + parts[METADATA_PARAMETER] to parts[TYPES_PARAMETER]!! + }.recover { + null to call.receiveText() + }.getOrThrow() + + if (!call.validateMetadata(metadata) || !call.validateTypes(types)) { + return@post + } + val typingActualSource = + call + .toBindingArtifacts( + refresh = true, + bindingsCache = bindingsCache, + owner = owner, + types = types, + metadata = metadata, + )?.typingActualSource ?: TypingActualSource.CUSTOM + call.respondText(text = "$owner:$name:$version") + + prometheusRegistry?.incrementArtifactCounter(call, typingActualSource) + } +} + +private suspend fun ApplicationCall.validateTypes(types: String): Boolean { + runCatching { + Load().loadOne(types) + }.onFailure { + respondText( + text = "Exception while parsing supplied $TYPES_PARAMETER:\n${it.stackTraceToString()}", + status = HttpStatusCode.UnprocessableEntity, + ) + return false + } + return true +} + +private suspend fun ApplicationCall.validateMetadata(metadata: String?): Boolean { + var result = true + if (metadata != null) { + if (metadata.isEmpty()) { + respondText( + text = "Supplied $METADATA_PARAMETER is empty", + status = HttpStatusCode.UnprocessableEntity, + ) + result = false + } + + runCatching { + Load().loadOne(metadata) + }.onFailure { + respondText( + text = "Exception while parsing supplied $METADATA_PARAMETER:\n${it.stackTraceToString()}", + status = HttpStatusCode.UnprocessableEntity, + ) + result = false + } + } + return result +} + private suspend fun ApplicationCall.toBindingArtifacts( refresh: Boolean, bindingsCache: LoadingCache, + owner: String = parameters["owner"]!!, + types: String? = null, + metadata: String? = null, ): VersionArtifacts? { - val parsedRequest = parameters.parseRequest(extractVersion = true) ?: return null + val parsedRequest = parameters.parseRequest(extractVersion = true, owner = owner) ?: return null logger.info { "➡️ Requesting ${parsedRequest.actionCoords.prettyPrint}" } if (refresh) { bindingsCache.invalidate(parsedRequest) } - return bindingsCache.get(parsedRequest).getOrNull() + return ( + if (types != null) { + bindingsCache + .get(parsedRequest) { + Optional.ofNullable( + buildVersionArtifacts( + parsedRequest, + types, + metadata, + HttpClient(CIO), + ), + ) + }.getOrNull() + } else { + bindingsCache.get(parsedRequest).getOrNull() + } + ) } private fun PrometheusMeterRegistry.incrementArtifactCounter( @@ -143,6 +281,7 @@ private fun PrometheusMeterRegistry.incrementArtifactCounter( when (typingActualSource) { TypingActualSource.ACTION -> "action" TypingActualSource.TYPING_CATALOG -> "typing_catalog" + TypingActualSource.CUSTOM -> "custom" null -> "no_typing" } diff --git a/jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver/Main.kt b/jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver/Main.kt index 77ea514214..e740396388 100644 --- a/jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver/Main.kt +++ b/jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver/Main.kt @@ -59,7 +59,14 @@ fun main() { } embeddedServer(Netty, port = 8080) { appModule( - buildVersionArtifacts = ::buildVersionArtifacts, + buildVersionArtifacts = { bindingsServerRequest, httpClient -> + buildVersionArtifacts( + bindingsServerRequest, + bindingsServerRequest.actionCoords.typesUuid?.let { "" }, + null, + httpClient, + ) + }, buildPackageArtifacts = ::buildPackageArtifacts, getGithubAuthToken = ::getGithubAuthToken, ) @@ -139,3 +146,5 @@ private fun buildMetadataCache( val deliverOnRefreshRoute = System.getenv("GWKT_DELIVER_ON_REFRESH").toBoolean() suspend fun ApplicationCall.respondNotFound() = respondText(text = "Not found", status = HttpStatusCode.NotFound) + +suspend fun ApplicationCall.respondBadRequest(text: String) = respondText(text, status = HttpStatusCode.BadRequest) diff --git a/jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver/PartData.kt b/jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver/PartData.kt new file mode 100644 index 0000000000..4c2299b687 --- /dev/null +++ b/jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver/PartData.kt @@ -0,0 +1,26 @@ +package io.github.typesafegithub.workflows.jitbindingserver + +import io.github.oshai.kotlinlogging.KotlinLogging.logger +import io.ktor.http.content.PartData +import io.ktor.utils.io.readRemaining +import io.ktor.utils.io.readText + +private val logger = logger { } + +internal suspend fun PartData.asString() = + runCatching { + when (this) { + is PartData.FileItem -> { + provider().readRemaining().readText() + } + + is PartData.FormItem -> { + value + } + + else -> { + logger.error { "Unexpected part data ${this::class.simpleName}" } + error("Unexpected part data ${this::class.simpleName}") + } + } + } diff --git a/jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver/RequestParsing.kt b/jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver/RequestParsing.kt index 56770914cb..49186c037a 100644 --- a/jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver/RequestParsing.kt +++ b/jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver/RequestParsing.kt @@ -10,8 +10,10 @@ import io.ktor.http.Parameters /** * Returns `null` if the request doesn't make sense and the service should return no resource. */ -fun Parameters.parseRequest(extractVersion: Boolean): BindingsServerRequest? { - val owner = this["owner"]!! +fun Parameters.parseRequest( + extractVersion: Boolean, + owner: String = this["owner"]!!, +): BindingsServerRequest? { val nameAndPathAndSignificantVersionParts = this["name"]!!.split("___", limit = 2) val significantVersion = nameAndPathAndSignificantVersionParts @@ -31,37 +33,54 @@ fun Parameters.parseRequest(extractVersion: Boolean): BindingsServerRequest? { .drop(1) .joinToString("/") .takeUnless { it.isBlank() } - val version = - if (extractVersion) { - val versionPart = this["version"]!! - if (significantVersion == COMMIT_LENIENT) { - val versionParts = versionPart.split("__") - if (versionParts.size < 2) { - return null - } - versionParts[1] - } else { - versionPart - } - } else { - "irrelevant" - } + val version = determineVersion(extractVersion, significantVersion) ?: return null val comment = if ((significantVersion == COMMIT_LENIENT) && extractVersion) this["version"]!!.split("__")[0] else null val versionForTypings = if (extractVersion) this["version"]!!.split("__")[0] else "irrelevant" + // we cannot give the types UUID separately from the post handler + // only in the post handler we generate the UUID, but for the other + // handlers the UUID part is already coming through the request as part of the owner + val ownerAndTypesUuid = owner.split("__types__", limit = 2) + val ownerPlain = ownerAndTypesUuid.first() + val typesUuid = + ownerAndTypesUuid + .drop(1) + .takeIf { it.isNotEmpty() } + ?.single() return BindingsServerRequest( + rawOwner = owner, rawName = this["name"]!!, rawVersion = this["version"], actionCoords = ActionCoords( - owner = owner, + owner = ownerPlain, name = name, version = version, versionForTypings = versionForTypings, significantVersion = significantVersion, path = path, comment = comment, + typesUuid = typesUuid, ), ) } + +fun Parameters.determineVersion( + extractVersion: Boolean, + significantVersion: SignificantVersion, +): String? = + if (extractVersion) { + val versionPart = this["version"]!! + if (significantVersion == COMMIT_LENIENT) { + val versionParts = versionPart.split("__") + if (versionParts.size < 2) { + return null + } + versionParts[1] + } else { + versionPart + } + } else { + "irrelevant" + } diff --git a/jit-binding-server/src/test/kotlin/io/github/typesafegithub/workflows/jitbindingserver/ArtifactRoutesTest.kt b/jit-binding-server/src/test/kotlin/io/github/typesafegithub/workflows/jitbindingserver/ArtifactRoutesTest.kt index 9827791493..3364647b6d 100644 --- a/jit-binding-server/src/test/kotlin/io/github/typesafegithub/workflows/jitbindingserver/ArtifactRoutesTest.kt +++ b/jit-binding-server/src/test/kotlin/io/github/typesafegithub/workflows/jitbindingserver/ArtifactRoutesTest.kt @@ -158,6 +158,8 @@ class ArtifactRoutesTest : buildVersionArtifacts = { bindingsServerRequest, _ -> buildVersionArtifacts( bindingsServerRequest, + null, + null, HttpClient( MockEngine { request -> when (request.url.toString()) { diff --git a/jit-binding-server/src/test/kotlin/io/github/typesafegithub/workflows/jitbindingserver/RequestParsingTest.kt b/jit-binding-server/src/test/kotlin/io/github/typesafegithub/workflows/jitbindingserver/RequestParsingTest.kt index 8c7ec1b67a..2d328205cb 100644 --- a/jit-binding-server/src/test/kotlin/io/github/typesafegithub/workflows/jitbindingserver/RequestParsingTest.kt +++ b/jit-binding-server/src/test/kotlin/io/github/typesafegithub/workflows/jitbindingserver/RequestParsingTest.kt @@ -21,6 +21,7 @@ class RequestParsingTest : parameters.parseRequest(extractVersion = true) shouldBe BindingsServerRequest( + rawOwner = "o", rawName = "act", rawVersion = "v1", actionCoords = @@ -39,6 +40,7 @@ class RequestParsingTest : parameters.parseRequest(extractVersion = true) shouldBe BindingsServerRequest( + rawOwner = "o", rawName = "act__p1__p2___major", rawVersion = "v9", actionCoords = @@ -57,6 +59,7 @@ class RequestParsingTest : parameters.parseRequest(extractVersion = false) shouldBe BindingsServerRequest( + rawOwner = "o", rawName = "act___minor", rawVersion = null, actionCoords = @@ -75,6 +78,7 @@ class RequestParsingTest : parameters.parseRequest(extractVersion = false) shouldBe BindingsServerRequest( + rawOwner = "o", rawName = "act___weird", rawVersion = null, actionCoords = @@ -94,6 +98,7 @@ class RequestParsingTest : parameters.parseRequest(extractVersion = true) shouldBe BindingsServerRequest( + rawOwner = "o", rawName = "my_action-name__dir_one__dir-two___minor", rawVersion = "v2", actionCoords = @@ -117,6 +122,7 @@ class RequestParsingTest : parameters.parseRequest(extractVersion = true) shouldBe BindingsServerRequest( + rawOwner = "o", rawName = "act___commit_lenient", rawVersion = "v1.2.3__323898970401d85df44b3324a610af9a862d54b3", actionCoords = diff --git a/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/BindingsServerRequest.kt b/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/BindingsServerRequest.kt index ebc3eb2b76..d99e0e74aa 100644 --- a/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/BindingsServerRequest.kt +++ b/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/BindingsServerRequest.kt @@ -3,6 +3,7 @@ package io.github.typesafegithub.workflows.mavenbinding import io.github.typesafegithub.workflows.actionbindinggenerator.domain.ActionCoords data class BindingsServerRequest( + val rawOwner: String, val rawName: String, val rawVersion: String?, val actionCoords: ActionCoords, diff --git a/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/JarBuilding.kt b/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/JarBuilding.kt index 9a6d43c171..785ea8b8a6 100644 --- a/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/JarBuilding.kt +++ b/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/JarBuilding.kt @@ -32,9 +32,18 @@ internal data class Jars( val typingActualSource: TypingActualSource?, ) -internal suspend fun ActionCoords.buildJars(httpClient: HttpClient): Jars? { +internal suspend fun ActionCoords.buildJars( + types: String?, + metadata: String?, + httpClient: HttpClient, +): Jars? { val binding = - generateBinding(metadataRevision = NewestForVersion, httpClient = httpClient).also { + generateBinding( + metadataRevision = NewestForVersion, + types = types, + explicitMetadata = metadata, + httpClient = httpClient, + ).also { if (it.isEmpty()) return null } diff --git a/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/ModuleBuilding.kt b/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/ModuleBuilding.kt index f9b98d6625..a8c23c38ca 100644 --- a/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/ModuleBuilding.kt +++ b/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/ModuleBuilding.kt @@ -15,7 +15,7 @@ internal fun BindingsServerRequest.buildModuleFile( { "formatVersion": "1.1", "component": { - "group": "${actionCoords.owner}", + "group": "$rawOwner", "module": "$rawName", "version": "$rawVersion", "attributes": { diff --git a/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/PomBuilding.kt b/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/PomBuilding.kt index 463c574f6f..eb5ce63d8f 100644 --- a/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/PomBuilding.kt +++ b/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/PomBuilding.kt @@ -10,7 +10,7 @@ internal fun BindingsServerRequest.buildPomFile() = 4.0.0 - ${this.actionCoords.owner} + ${this.rawOwner} ${this.rawName} ${this.rawVersion} ${this.actionCoords.fullName} diff --git a/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/VersionArtifactsBuilding.kt b/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/VersionArtifactsBuilding.kt index 55df3dc892..bf860bb4ae 100644 --- a/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/VersionArtifactsBuilding.kt +++ b/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/VersionArtifactsBuilding.kt @@ -20,10 +20,12 @@ data class VersionArtifacts( suspend fun buildVersionArtifacts( bindingsServerRequest: BindingsServerRequest, + types: String? = null, + metadata: String? = null, httpClient: HttpClient, ): VersionArtifacts? { with(bindingsServerRequest) { - val jars = actionCoords.buildJars(httpClient = httpClient) ?: return null + val jars = actionCoords.buildJars(types = types, metadata = metadata, httpClient = httpClient) ?: return null val pom = this.buildPomFile() val mainJarSize by lazy { jars.mainJar().size } val mainJarMd5Checksum by lazy { jars.mainJar().md5Checksum() } diff --git a/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/JavaBytecodeVersionTest.kt b/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/JavaBytecodeVersionTest.kt index 5eed370351..4eca07d11a 100644 --- a/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/JavaBytecodeVersionTest.kt +++ b/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/JavaBytecodeVersionTest.kt @@ -12,7 +12,7 @@ class JavaBytecodeVersionTest : { test("bindings are built with desired Java bytecode version") { val actionCoords = ActionCoords("actions", "setup-java", "v3") - val jars = actionCoords.buildJars(httpClient = HttpClient(CIO))!! + val jars = actionCoords.buildJars(types = null, metadata = null, httpClient = HttpClient(CIO))!! jars.randomClassFile() shouldHaveBytecodeVersion JDK_8 } }, diff --git a/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/MavenMetadataBuildingTest.kt b/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/MavenMetadataBuildingTest.kt index 4fbdd6e71f..e12a361836 100644 --- a/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/MavenMetadataBuildingTest.kt +++ b/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/MavenMetadataBuildingTest.kt @@ -20,6 +20,7 @@ class MavenMetadataBuildingTest : FunSpec({ val bindingsServerRequest = BindingsServerRequest( + rawOwner = "owner", rawName = "name", rawVersion = null, actionCoords = diff --git a/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/ModuleBuildingTest.kt b/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/ModuleBuildingTest.kt index 8c53af52e5..8f0e862d63 100644 --- a/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/ModuleBuildingTest.kt +++ b/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/ModuleBuildingTest.kt @@ -18,6 +18,7 @@ class ModuleBuildingTest : val bindingsServerRequest = BindingsServerRequest( + rawOwner = "owner", rawName = "name$nameSuffix", rawVersion = "v1.2.3$versionSuffix", actionCoords = diff --git a/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/PomBuildingTest.kt b/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/PomBuildingTest.kt index 2a16652abb..fd4d4ea60e 100644 --- a/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/PomBuildingTest.kt +++ b/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/PomBuildingTest.kt @@ -25,6 +25,7 @@ class PomBuildingTest : val bindingsServerRequest = BindingsServerRequest( + rawOwner = "owner", rawName = "name$nameSuffix", rawVersion = "v1.2.3$versionSuffix", actionCoords =