Skip to content

Commit

Permalink
Add kotlin github action checks, and make Kotlin code snippets build (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
gvdongen authored Apr 23, 2024
1 parent e5c4179 commit c8207a0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ jobs:
arguments: check
build-root-directory: code_snippets/java

# Upgrade Kotlin code snippets if new version is provided
- name: Find and replace restateVersion in build.gradle.kts for Kotlin code snippets
if: github.event.inputs.sdkJavaVersion != ''
run: sed -i 's/val restateVersion = "[0-9A-Z.-]*"/val restateVersion = "${{ inputs.sdkJavaVersion }}"/' code_snippets/kotlin/build.gradle.kts

# Check Kotlin code snippets
- name: Test Kotlin code snippets
uses: gradle/gradle-build-action@v2
with:
arguments: check
build-root-directory: code_snippets/kotlin

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,11 @@ jobs:
uses: gradle/gradle-build-action@v2
with:
arguments: check
build-root-directory: code_snippets/java
build-root-directory: code_snippets/java

# Check Java code snippets
- name: Test Kotlin code snippets
uses: gradle/gradle-build-action@v2
with:
arguments: check
build-root-directory: code_snippets/kotlin
1 change: 0 additions & 1 deletion code_snippets/kotlin/src/main/kotlin/develop/Greeter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,5 @@ fun main() {
RestateHttpEndpointBuilder
.builder()
.bind(Greeter())
// Start the Restate Endpoint HTTP Server
.buildAndListen()
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package develop

import dev.restate.sdk.http.vertx.RestateHttpEndpointBuilder
import dev.restate.sdk.kotlin.Component
import dev.restate.sdk.kotlin.Service
import java.util.concurrent.Executors
import kotlinx.coroutines.asCoroutineDispatcher

Expand All @@ -10,9 +10,9 @@ class ServingVirtualThreads {
// <start_here>
builder.bind(
// This is the class generated by the annotation processor
GreeterBindableComponent(
GreeterBindableService(
Greeter(),
Component.Options(
Service.Options(
coroutineContext = Executors.newVirtualThreadPerTaskExecutor().asCoroutineDispatcher()
)
)
Expand Down

0 comments on commit c8207a0

Please sign in to comment.