Skip to content

Commit

Permalink
Merge branch 'main' into vampire/custom-types
Browse files Browse the repository at this point in the history
  • Loading branch information
krzema12 authored Jan 2, 2025
2 parents 343cfae + 0a1bf40 commit 102e593
Show file tree
Hide file tree
Showing 27 changed files with 128 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/_shared.main.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env kotlin
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.0.1")
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.0.2")

import io.github.typesafegithub.workflows.dsl.expressions.expr

Expand Down
56 changes: 54 additions & 2 deletions .github/workflows/bindings-server.main.kts
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:3.0.1")
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.0.2")

@file:Repository("https://bindings.krzeminski.it")
@file:DependsOn("actions:checkout:v4")
Expand Down Expand Up @@ -99,7 +99,31 @@ workflow(
""".trimIndent(),
)

cleanMavenLocal()
// There should be a difference of one (mostly minor) version between these two,
// to be able to see the newest non-working and oldest working version.
val newestNotCompatibleVersion = "1.9.0"
val oldestCompatibleVersion = "2.0.0"

runWithSpecificKotlinVersion(
kotlinVersion = newestNotCompatibleVersion,
command = """
cp .github/workflows/test-script-consuming-jit-bindings.main.kts .github/workflows/test-script-consuming-jit-bindings-too-old-kotlin.main.kts
${failsWithPhraseInLogs(
command = ".github/workflows/test-script-consuming-jit-bindings-too-old-kotlin.main.kts",
// This test depicts the current behavior that the served bindings aren't
// compatible with some older Kotlin version. We may want to address it one day.
// For more info, see https://github.com/typesafegithub/github-workflows-kt/issues/1756
phrase = "was compiled with an incompatible version of Kotlin",
)}
""".trimIndent(),
)
runWithSpecificKotlinVersion(
kotlinVersion = oldestCompatibleVersion,
command = """
cp .github/workflows/test-script-consuming-jit-bindings.main.kts .github/workflows/test-script-consuming-jit-bindings-older-kotlin.main.kts
.github/workflows/test-script-consuming-jit-bindings-older-kotlin.main.kts
""".trimIndent(),
)

run(
name = "Compile a Gradle project using the bindings from the server",
Expand Down Expand Up @@ -150,3 +174,31 @@ fun JobBuilder<JobOutputs.EMPTY>.cleanMavenLocal() {
command = "rm -rf ~/.m2/repository/"
)
}

fun JobBuilder<JobOutputs.EMPTY>.runWithSpecificKotlinVersion(kotlinVersion: String, command: String) {
run(
name = "Download older Kotlin compiler ($kotlinVersion)",
command = "curl -Lo kotlin-compiler-$kotlinVersion.zip https://github.com/JetBrains/kotlin/releases/download/v$kotlinVersion/kotlin-compiler-$kotlinVersion.zip",
)
run(
name = "Unzip and add to PATH",
command = "unzip kotlin-compiler-$kotlinVersion.zip -d kotlin-compiler-$kotlinVersion",
)
cleanMavenLocal()
run(
name = "Execute the script using the bindings from the server, using older Kotlin ($kotlinVersion) as consumer",
command = """
PATH=${'$'}(pwd)/kotlin-compiler-$kotlinVersion/kotlinc/bin:${'$'}PATH
$command
""".trimIndent(),
)
}

fun failsWithPhraseInLogs(
command: String,
phrase: String,
): String =
"""
($command || true) >> output.txt 2>&1
grep "$phrase" output.txt
""".trimIndent()
34 changes: 31 additions & 3 deletions .github/workflows/bindings-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,45 @@ jobs:
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-8'
name: 'Download older Kotlin compiler (1.9.0)'
run: 'curl -Lo kotlin-compiler-1.9.0.zip https://github.com/JetBrains/kotlin/releases/download/v1.9.0/kotlin-compiler-1.9.0.zip'
- id: 'step-9'
name: 'Unzip and add to PATH'
run: 'unzip kotlin-compiler-1.9.0.zip -d kotlin-compiler-1.9.0'
- id: 'step-10'
name: 'Clean Maven Local to fetch required POMs again'
run: 'rm -rf ~/.m2/repository/'
- id: 'step-9'
- id: 'step-11'
name: 'Execute the script using the bindings from the server, using older Kotlin (1.9.0) as consumer'
run: |2-
PATH=$(pwd)/kotlin-compiler-1.9.0/kotlinc/bin:$PATH
cp .github/workflows/test-script-consuming-jit-bindings.main.kts .github/workflows/test-script-consuming-jit-bindings-too-old-kotlin.main.kts
(.github/workflows/test-script-consuming-jit-bindings-too-old-kotlin.main.kts || true) >> output.txt 2>&1
grep "was compiled with an incompatible version of Kotlin" output.txt
- id: 'step-12'
name: 'Download older Kotlin compiler (2.0.0)'
run: 'curl -Lo kotlin-compiler-2.0.0.zip https://github.com/JetBrains/kotlin/releases/download/v2.0.0/kotlin-compiler-2.0.0.zip'
- id: 'step-13'
name: 'Unzip and add to PATH'
run: 'unzip kotlin-compiler-2.0.0.zip -d kotlin-compiler-2.0.0'
- id: 'step-14'
name: 'Clean Maven Local to fetch required POMs again'
run: 'rm -rf ~/.m2/repository/'
- id: 'step-15'
name: 'Execute the script using the bindings from the server, using older Kotlin (2.0.0) as consumer'
run: |2-
PATH=$(pwd)/kotlin-compiler-2.0.0/kotlinc/bin:$PATH
cp .github/workflows/test-script-consuming-jit-bindings.main.kts .github/workflows/test-script-consuming-jit-bindings-older-kotlin.main.kts
.github/workflows/test-script-consuming-jit-bindings-older-kotlin.main.kts
- id: 'step-16'
name: 'Compile a Gradle project using the bindings from the server'
run: |-
cd .github/workflows/test-gradle-project-using-bindings-server
./gradlew build
- id: 'step-10'
- id: 'step-17'
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-18'
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
2 changes: 1 addition & 1 deletion .github/workflows/build.main.kts
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:3.0.1")
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.0.2")

@file:Repository("https://bindings.krzeminski.it")
@file:DependsOn("actions:cache:v4")
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/end-to-end-tests.main.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env kotlin
@file:Repository("file://~/.m2/repository/")
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.0.2-SNAPSHOT")
@file:DependsOn("io.github.typesafegithub:action-updates-checker:3.0.2-SNAPSHOT")
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.0.3-SNAPSHOT")
@file:DependsOn("io.github.typesafegithub:action-updates-checker:3.0.3-SNAPSHOT")
@file:Repository("https://bindings.krzeminski.it")
@file:DependsOn("actions:checkout:v4")
@file:DependsOn("actions:github-script:v7")
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-wrapper-validation.main.kts
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:3.0.1")
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.0.2")

@file:Repository("https://bindings.krzeminski.it")
@file:DependsOn("actions:checkout:v4")
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.main.kts
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:3.0.1")
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.0.2")

@file:Repository("https://bindings.krzeminski.it")
@file:DependsOn("actions:checkout:v4")
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/setup-java.main.kts
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:3.0.1")
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.0.2")

@file:Repository("https://bindings.krzeminski.it")
@file:DependsOn("actions:setup-java:v4")
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/setup-python.main.kts
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:3.0.1")
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.0.2")

@file:Repository("https://bindings.krzeminski.it")
@file:DependsOn("actions:setup-python:v5")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import java.net.URI

plugins {
kotlin("jvm") version "2.0.21"
kotlin("jvm") version "2.1.0"
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=f397b287023acdba1e9f6fc5ea72d22dd63669d59ed4a289a29b1a76eee151c6
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
distributionSha256Sum=7a00d51fb93147819aab76024feece20b6b84e420694101f276be952e08bef03
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
4 changes: 2 additions & 2 deletions action-binding-generator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ plugins {
buildsrc.convention.publishing
kotlin("plugin.serialization")

id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.16.3"
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.17.0"
}

group = rootProject.group
version = rootProject.version

dependencies {
implementation("com.squareup:kotlinpoet:2.0.0")
implementation("com.charleskorn.kaml:kaml:0.66.0")
implementation("com.charleskorn.kaml:kaml:0.67.0")
implementation("io.github.oshai:kotlin-logging:7.0.3")
implementation(projects.sharedInternal)

Expand Down
4 changes: 2 additions & 2 deletions action-updates-checker/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ plugins {
buildsrc.convention.`kotlin-jvm`
buildsrc.convention.publishing

id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.16.3"
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.17.0"
}

group = rootProject.group
version = rootProject.version

dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1")

implementation(projects.githubWorkflowsKt)
implementation(projects.sharedInternal)
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group = "io.github.typesafegithub"
version = "3.0.2-SNAPSHOT"
version = "3.0.3-SNAPSHOT"

nexusPublishing {
repositories {
Expand Down
10 changes: 5 additions & 5 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ plugins {
}

dependencies {
implementation(platform("org.jetbrains.kotlin:kotlin-bom:2.0.21"))
implementation(platform("org.jetbrains.kotlin:kotlin-bom:2.1.0"))

implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.21")
implementation("org.jetbrains.kotlin:kotlin-serialization:2.0.21")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.0")
implementation("org.jetbrains.kotlin:kotlin-serialization:2.1.0")

implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.7")
implementation("org.jmailen.gradle:kotlinter-gradle:4.5.0")
implementation("org.jmailen.gradle:kotlinter-gradle:5.0.1")

implementation(platform("org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.9.0"))
implementation(platform("org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.10.1"))
implementation(("org.jetbrains.kotlinx:kotlinx-coroutines-core"))
}

Expand Down
1 change: 1 addition & 0 deletions docs/projects-using-this-library.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* [rankquest-studio](https://github.com/jillesvangurp/rankquest-studio/tree/main/.github/workflows)
* [setup-wsl](https://github.com/Vampire/setup-wsl/tree/master/.github/workflows)
* [snakeyaml-engine-kmp](https://github.com/krzema12/snakeyaml-engine-kmp/tree/main/.github/workflows)
* [Spock](https://github.com/spockframework/spock/tree/master/.github/workflows)
* [spring-cqs](https://github.com/prisma-capacity/spring-cqs/tree/main/.github/kts)
* [twitch-announcement-discord-bot](https://github.com/NikkyAI/twitch-announcement-discord-bot/tree/main/.github/workflows)
* [WalletConnectKotlinV2](https://github.com/WalletConnect/WalletConnectKotlinV2/tree/develop/.github/workflows/scripts)
Expand Down
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mkdocs==1.6.1
mkdocs-material==9.5.48
mkdocs-material==9.5.49
mkdocs-material-extensions==1.3.1
mkdocs-video==1.5.0
pymdown-extensions==10.12
pymdown-extensions==10.13
8 changes: 4 additions & 4 deletions github-workflows-kt/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ plugins {
buildsrc.convention.`duplicate-versions`

kotlin("plugin.serialization")
id("com.google.devtools.ksp") version "2.0.21-1.0.28"
id("com.google.devtools.ksp") version "2.1.0-1.0.29"

// Code quality.
id("io.gitlab.arturbosch.detekt")
id("info.solidsoft.pitest") version "1.15.0"
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.16.3"
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.17.0"

id("org.jetbrains.dokka") version "1.9.20"
id("org.jetbrains.dokka") version "2.0.0"
}

group = rootProject.group
Expand All @@ -27,7 +27,7 @@ dependencies {
implementation(projects.sharedInternal)
ksp(projects.codeGenerator)

testImplementation("dev.zacsweers.kctfork:core:0.6.0")
testImplementation("dev.zacsweers.kctfork:core:0.7.0")
// Needed to use the right version of the compiler for the libraries that depend on it.
testImplementation(kotlin("compiler"))
testImplementation(kotlin("reflect"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class GettingStartedSnippets :
#!/usr/bin/env kotlin
@file:Repository("https://repo.maven.apache.org/maven2/")
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.0.2-SNAPSHOT")
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.0.3-SNAPSHOT")
@file:Repository("https://bindings.krzeminski.it")
@file:DependsOn("actions:checkout:v4")
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=f397b287023acdba1e9f6fc5ea72d22dd63669d59ed4a289a29b1a76eee151c6
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
distributionSha256Sum=7a00d51fb93147819aab76024feece20b6b84e420694101f276be952e08bef03
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 1 addition & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 1 addition & 1 deletion images/teaser-with-newest-version.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions jit-binding-server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import io.ktor.plugin.features.*
plugins {
buildsrc.convention.`kotlin-jvm-server`
application
id("io.ktor.plugin") version "3.0.2"
id("io.ktor.plugin") version "3.0.3"
}

dependencies {
implementation(platform("io.ktor:ktor-bom:3.0.2"))
implementation(platform("io.ktor:ktor-bom:3.0.3"))
implementation("io.ktor:ktor-server-core")
implementation("io.ktor:ktor-server-netty")
implementation("io.ktor:ktor-client-core")
Expand All @@ -23,7 +23,7 @@ dependencies {
implementation("io.opentelemetry:opentelemetry-exporter-logging:1.45.0")
implementation("io.github.reactivecircus.cache4k:cache4k:0.13.0")
implementation("io.github.oshai:kotlin-logging:7.0.3")
implementation(platform("org.apache.logging.log4j:log4j-bom:2.24.2"))
implementation(platform("org.apache.logging.log4j:log4j-bom:2.24.3"))
implementation("org.apache.logging.log4j:log4j-jul")
runtimeOnly("org.apache.logging.log4j:log4j-core")
runtimeOnly("org.apache.logging.log4j:log4j-slf4j2-impl")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import io.github.typesafegithub.workflows.actionbindinggenerator.domain.ActionCo
import io.github.typesafegithub.workflows.actionbindinggenerator.domain.fullName
import io.github.typesafegithub.workflows.actionbindinggenerator.domain.prettyPrint

internal const val LATEST_RELASED_LIBRARY_VERSION = "3.0.1"
internal const val LATEST_RELASED_LIBRARY_VERSION = "3.0.2"

internal fun ActionCoords.buildPomFile() =
"""
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ include(
)

plugins {
id("com.gradle.develocity") version "3.18.2"
id("com.gradle.develocity") version "3.19"
}

dependencyResolutionManagement {
Expand Down
8 changes: 4 additions & 4 deletions shared-internal/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ version = rootProject.version
dependencies {
// we cannot use a BOM due to limitation in kotlin scripting when resolving the transitive KMM variant dependencies
// note: see https://youtrack.jetbrains.com/issue/KT-67618
implementation("io.ktor:ktor-client-core:3.0.2")
implementation("io.ktor:ktor-client-cio:3.0.2")
implementation("io.ktor:ktor-client-content-negotiation:3.0.2")
implementation("io.ktor:ktor-serialization-kotlinx-json:3.0.2")
implementation("io.ktor:ktor-client-core:3.0.3")
implementation("io.ktor:ktor-client-cio:3.0.3")
implementation("io.ktor:ktor-client-content-negotiation:3.0.3")
implementation("io.ktor:ktor-serialization-kotlinx-json:3.0.3")
}

0 comments on commit 102e593

Please sign in to comment.