Skip to content

Commit

Permalink
build, ci: replace Netty with CIO, set up dependency submission
Browse files Browse the repository at this point in the history
  • Loading branch information
tronghn committed Jun 21, 2024
1 parent d988b78 commit b02105e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 17 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: Build and push
runs-on: ubuntu-latest
permissions:
contents: read
contents: write
id-token: write
strategy:
matrix:
Expand All @@ -22,17 +22,23 @@ jobs:
java-version: '21'
distribution: 'temurin'
cache: 'gradle'
- name: Setup Gradle wrapper cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # ratchet:actions/cache@v4
- name: Set up JDK 21
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # ratchet:actions/setup-java@v4
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-wrapper-
java-version: '21'
distribution: 'temurin'
cache: 'gradle'
- name: Verify Gradle wrapper checksum
uses: gradle/wrapper-validation-action@9ba54b687bf0f59b62abbf91e0d60de082e8ebc4 # ratchet:gradle/wrapper-validation-action@v3
uses: gradle/actions/wrapper-validation@dbbdc275be76ac10734476cc723d82dfe7ec6eda # ratchet:gradle/actions/wrapper-validation@v3
- name: Setup Gradle to generate and submit dependency graphs
uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # ratchet:gradle/actions/setup-gradle@v3
with:
dependency-graph: generate-and-submit
- name: Build with Gradle
run: ./gradlew clean wonderwalled-${{ matrix.module }}:build wonderwalled-${{ matrix.module }}:shadowJar
env:
ORG_GRADLE_PROJECT_githubUser: x-access-token
ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.GITHUB_TOKEN }}
- uses: nais/platform-build-push-sign@main # ratchet:exclude
id: build_push_sign
with:
Expand Down
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
val konfigVersion = "1.6.10.0"
val ktorVersion = "2.3.11"
val ktorVersion = "2.3.12"
val logstashVersion = "7.4"
val logbackVersion = "1.5.6"
val nimbusJoseJwtVersion = "9.40"
Expand Down Expand Up @@ -46,13 +46,13 @@ subprojects {

dependencies {
implementation(kotlin("stdlib"))
implementation("io.ktor:ktor-server-netty:${ktorVersion}")
implementation("io.ktor:ktor-server:${ktorVersion}")
implementation("io.ktor:ktor-server-cio:${ktorVersion}")
implementation("io.ktor:ktor-server-auth-jwt:${ktorVersion}")
implementation("io.ktor:ktor-server-content-negotiation:${ktorVersion}")
implementation("io.ktor:ktor-serialization-jackson:${ktorVersion}")
implementation("io.ktor:ktor-client-cio:${ktorVersion}")
implementation("io.ktor:ktor-client-core:${ktorVersion}")
implementation("io.ktor:ktor-client-apache:${ktorVersion}")
implementation("io.ktor:ktor-client-content-negotiation:${ktorVersion}")
implementation("com.natpryce:konfig:${konfigVersion}")
implementation("com.nimbusds:nimbus-jose-jwt:${nimbusJoseJwtVersion}")
Expand Down
4 changes: 2 additions & 2 deletions wonderwalled-azure/src/main/kotlin/io/nais/Wonderwalled.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import io.ktor.server.auth.authenticate
import io.ktor.server.auth.authentication
import io.ktor.server.auth.jwt.JWTPrincipal
import io.ktor.server.auth.jwt.jwt
import io.ktor.server.cio.CIO
import io.ktor.server.engine.embeddedServer
import io.ktor.server.netty.Netty
import io.ktor.server.request.host
import io.ktor.server.request.uri
import io.ktor.server.response.respond
Expand All @@ -31,7 +31,7 @@ import java.util.concurrent.TimeUnit
fun main() {
val config = Configuration()

embeddedServer(Netty, port = config.port) {
embeddedServer(CIO, port = config.port) {
wonderwalled(config)
}.start(wait = true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package io.nais.common
import com.fasterxml.jackson.databind.DeserializationFeature
import io.ktor.client.HttpClient
import io.ktor.client.call.body
import io.ktor.client.engine.apache.Apache
import io.ktor.client.engine.cio.CIO
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
import io.ktor.client.request.get
import io.ktor.serialization.jackson.jackson
import kotlinx.coroutines.runBlocking

fun defaultHttpClient() =
HttpClient(Apache) {
HttpClient(CIO) {
expectSuccess = true
install(ContentNegotiation) {
jackson {
Expand Down
4 changes: 2 additions & 2 deletions wonderwalled-idporten/src/main/kotlin/io/nais/Wonderwalled.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import io.ktor.server.auth.authenticate
import io.ktor.server.auth.authentication
import io.ktor.server.auth.jwt.JWTPrincipal
import io.ktor.server.auth.jwt.jwt
import io.ktor.server.cio.CIO
import io.ktor.server.engine.embeddedServer
import io.ktor.server.netty.Netty
import io.ktor.server.request.host
import io.ktor.server.request.uri
import io.ktor.server.response.respond
Expand All @@ -31,7 +31,7 @@ import java.util.concurrent.TimeUnit
fun main() {
val config = Configuration()

embeddedServer(Netty, port = config.port) {
embeddedServer(CIO, port = config.port) {
wonderwalled(config)
}.start(wait = true)
}
Expand Down

0 comments on commit b02105e

Please sign in to comment.