Skip to content

Commit

Permalink
Add komok
Browse files Browse the repository at this point in the history
  • Loading branch information
IRus committed Jan 7, 2025
1 parent 613b231 commit fd05fcb
Show file tree
Hide file tree
Showing 14 changed files with 321 additions and 224 deletions.
55 changes: 23 additions & 32 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ name: "Build"
on:
push:
pull_request:
schedule:
- cron: "37 13 * * *"
jobs:
check:
if: ${{ github.event_name == 'pull_request' }}
name: "Validating yarn cache integrity"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -15,26 +14,29 @@ jobs:
node-version: 22.x
- run: yarn install --check-cache
working-directory: app-frontend
build:
name: "Build on JDK 21 and Node.JS 22.x"

kotlin-build:
name: "Build backend"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Compiled Scripts Cache"
uses: actions/cache@v4
with:
path: ~/.cache/awesome-kotlin
key: kotlin-scripts-cache
- uses: actions/setup-java@v4
with:
java-version: "21"
distribution: "liberica"
- uses: gradle/actions/setup-gradle@v4
- run: ./gradlew check installDist
- name: "Generate data for frontend"
run: ./build/install/awesome-kotlin/bin/awesome-kotlin
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- uses: actions/upload-artifact@v4
with:
name: "Backend Application"
path: "app-backend/build/install/"
retention-days: 1

react-build:
name: "Build frontend"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.x
Expand All @@ -47,26 +49,21 @@ jobs:
name: "Frontend Application"
path: "app-frontend/dist/"
retention-days: 1
- uses: actions/upload-artifact@v4
with:
name: "Readme"
path: "readme/"
retention-days: 1

build-and-push-image:
if: ${{ github.ref == 'refs/heads/main' }}
name: "Build and push docker image"
runs-on: ubuntu-latest
needs: build
needs: [kotlin-build, react-build]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: "Frontend Application"
path: "app-frontend/dist/"
name: "Backend Application"
path: "app-backend/build/install/"
- uses: actions/download-artifact@v4
with:
name: "Readme"
path: "readme/"
- run: ls -laR
name: "Frontend Application"
path: "app-frontend/dist/"
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v3
- name: "Login to GHCR"
Expand All @@ -80,11 +77,5 @@ jobs:
with:
platforms: linux/amd64,linux/arm64
push: true
context: app-frontend
context: .
tags: ghcr.io/heapy/awesome-kotlin:main
- name: "Deploy Readme"
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./readme
publish_branch: readme
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM bellsoft/liberica-openjre-alpine:21.0.5
RUN apk --no-cache add curl
COPY /app-backend/build/install/awesome /app/backend/
COPY /app-frontend/dist /app/frontend/
RUN chmod u+x /app/backend/bin/awesome
ENTRYPOINT /app/backend/bin/awesome
10 changes: 5 additions & 5 deletions app-backend-dataops/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
plugins {
kotlin("jvm")
alias(libs.plugins.kotlin.jvm)
}

repositories {
mavenCentral()
}

dependencies {
implementation("org.jooq:jooq-codegen:3.19.16")
implementation("org.flywaydb:flyway-database-postgresql:11.1.0")
implementation("org.postgresql:postgresql:42.7.4")
implementation("ch.qos.logback:logback-classic:1.5.16")
implementation(libs.jooq.codegen)
implementation(libs.flyway.database.postgresql)
implementation(libs.postgresql)
implementation(libs.logback)
}
62 changes: 33 additions & 29 deletions app-backend/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
application
kotlin("jvm")
kotlin("plugin.serialization")
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.serialization)
}

application {
Expand Down Expand Up @@ -29,45 +29,49 @@ tasks.test {
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.10.1")
implementation(libs.kotlinx.coroutines.jdk8)

implementation("org.jetbrains.kotlinx:kotlinx-serialization-hocon:1.7.3")
implementation("com.charleskorn.kaml:kaml:0.67.0")
implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlinx.serialization.hocon)
implementation(libs.kaml)

implementation("org.flywaydb:flyway-database-postgresql:11.1.0")
implementation("org.jooq:jooq:3.19.16")
implementation("org.postgresql:postgresql:42.7.4")
implementation("com.zaxxer:HikariCP:6.2.1")
implementation(libs.flyway.database.postgresql)
implementation(libs.jooq.core)
implementation(libs.postgresql)
implementation(libs.hikari)

implementation("at.favre.lib:bcrypt:0.10.2")

implementation("io.heapy.komok:komok-tech-to-been-injected:1.0.7")
implementation(libs.komok.tech.to.be.injected)
implementation(libs.komok.tech.dotenv)
implementation(libs.komok.tech.logging)

implementation("io.ktor:ktor-serialization-kotlinx-json:3.0.3")
implementation("io.ktor:ktor-client-cio:3.0.3")
implementation("io.ktor:ktor-server-content-negotiation:3.0.3")
implementation("io.ktor:ktor-server-cio:3.0.3")
implementation("io.ktor:ktor-server-resources:3.0.3")
implementation("io.ktor:ktor-server-websockets:3.0.3")
implementation("io.ktor:ktor-client-content-negotiation:3.0.3")
implementation("io.ktor:ktor-server-auth-jwt:3.0.3")
implementation("io.ktor:ktor-server-metrics-micrometer:3.0.3")
implementation("io.micrometer:micrometer-registry-prometheus:1.14.2")
implementation("io.ktor:ktor-server-call-logging:3.0.3")
implementation("io.ktor:ktor-server-default-headers:3.0.3")
implementation("io.ktor:ktor-server-caching-headers:3.0.3")
implementation("io.ktor:ktor-server-status-pages:3.0.3")
implementation(libs.ktor.serialization.kotlinx.json)
implementation(libs.ktor.client.cio)
implementation(libs.ktor.server.content.negotiation)
implementation(libs.ktor.server.cio)
implementation(libs.ktor.server.resources)
implementation(libs.ktor.server.websockets)
implementation(libs.ktor.client.content.negotiation)
implementation(libs.ktor.server.auth.jwt)
implementation(libs.ktor.server.metrics.micrometer)
implementation(libs.micrometer.registry.prometheus)
implementation(libs.ktor.server.call.logging)
implementation(libs.ktor.server.default.headers)
implementation(libs.ktor.server.caching.headers)
implementation(libs.ktor.server.status.pages)

implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.2")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.2")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.18.2")

implementation("ch.qos.logback:logback-classic:1.5.16")
implementation(libs.logback)

testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.1")
testImplementation("io.mockk:mockk:1.13.14")
testImplementation("org.junit.jupiter:junit-jupiter:5.11.4")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testImplementation(libs.ktor.server.test.host)
testImplementation(libs.kotlinx.coroutines.test)
testImplementation(libs.mockk)
testImplementation(libs.junit.jupiter)
testRuntimeOnly(libs.junit.platform.launcher)
}

tasks.distZip {
Expand Down
4 changes: 0 additions & 4 deletions app-frontend/Dockerfile

This file was deleted.

26 changes: 19 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
plugins {
application
kotlin("jvm").version("2.1.0")
kotlin("plugin.serialization").version("2.1.0")
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.ksp)
}

application {
Expand All @@ -12,20 +13,31 @@ repositories {
mavenCentral()
}

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}

tasks.test {
useJUnitPlatform()
}

dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.10.1")
implementation(libs.kotlinx.coroutines.jdk8)

implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.2")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.2")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.18.2")

implementation("ch.qos.logback:logback-classic:1.5.16")
implementation(libs.logback)

ksp(libs.komok.tech.di)
implementation(libs.komok.tech.di.lib)
implementation(libs.komok.tech.dotenv)
implementation(libs.komok.tech.logging)

implementation("com.rometools:rome:2.1.0")
implementation("com.github.dfabulich:sitemapgen4j:1.1.2")
Expand All @@ -41,9 +53,9 @@ dependencies {
implementation("io.ktor:ktor-client-apache:3.0.3")
implementation("io.ktor:ktor-client-jackson:3.0.3")

testImplementation("io.mockk:mockk:1.13.14")
testImplementation("org.junit.jupiter:junit-jupiter:5.11.4")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testImplementation(libs.mockk)
testImplementation(libs.junit.jupiter)
testRuntimeOnly(libs.junit.platform.launcher)
}

tasks.distZip {
Expand Down
76 changes: 76 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
[versions]
bouncycastle = "1.78.1"
flyway = "11.1.0"
hikari = "6.2.1"
jooq = "3.19.16"
junit = "5.11.4"
kaml = "0.67.0"
komok = "1.0.8"
kotlin = "2.1.0"
kotlinx-coroutines = "1.10.1"
kotlinx-serialization = "1.8.0"
ksp = "2.1.0-1.0.29"
ktor = "3.0.3"
logback = "1.5.16"
micrometer = "1.14.2"
mockk = "1.13.14"
postgresql = "42.7.4"
xmlutil = "0.90.1"

[libraries]
bouncycastle-bcpkix = { module = "org.bouncycastle:bcpkix-jdk18on", version.ref = "bouncycastle" }

flyway-database-postgresql = { module = "org.flywaydb:flyway-database-postgresql", version.ref = "flyway" }

hikari = { module = "com.zaxxer:HikariCP", version.ref = "hikari" }

jooq-codegen = { module = "org.jooq:jooq-codegen", version.ref = "jooq" }
jooq-core = { module = "org.jooq:jooq", version.ref = "jooq" }

junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit" }
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher" }

kaml = { module = "com.charleskorn.kaml:kaml", version.ref = "kaml" }

komok-tech-di = { module = "io.heapy.komok:komok-tech-di", version.ref = "komok" }
komok-tech-di-lib = { module = "io.heapy.komok:komok-tech-di-lib", version.ref = "komok" }
komok-tech-to-be-injected = { module = "io.heapy.komok:komok-tech-to-be-injected", version.ref = "komok" }
komok-tech-dotenv = { module = "io.heapy.komok:komok-tech-dotenv", version.ref = "komok" }
komok-tech-logging = { module = "io.heapy.komok:komok-tech-logging", version.ref = "komok" }

kotlinx-coroutines-jdk8 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" }

kotlinx-serialization-hocon = { module = "org.jetbrains.kotlinx:kotlinx-serialization-hocon", version.ref = "kotlinx-serialization" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" }

ktor-serialization-kotlinx-json = { group = "io.ktor", name = "ktor-serialization-kotlinx-json", version.ref = "ktor" }
ktor-client-cio = { group = "io.ktor", name = "ktor-client-cio", version.ref = "ktor" }
ktor-server-content-negotiation = { group = "io.ktor", name = "ktor-server-content-negotiation", version.ref = "ktor" }
ktor-server-cio = { group = "io.ktor", name = "ktor-server-cio", version.ref = "ktor" }
ktor-server-resources = { group = "io.ktor", name = "ktor-server-resources", version.ref = "ktor" }
ktor-server-websockets = { group = "io.ktor", name = "ktor-server-websockets", version.ref = "ktor" }
ktor-client-content-negotiation = { group = "io.ktor", name = "ktor-client-content-negotiation", version.ref = "ktor" }
ktor-server-auth-jwt = { group = "io.ktor", name = "ktor-server-auth-jwt", version.ref = "ktor" }
ktor-server-metrics-micrometer = { group = "io.ktor", name = "ktor-server-metrics-micrometer", version.ref = "ktor" }
ktor-server-call-logging = { group = "io.ktor", name = "ktor-server-call-logging", version.ref = "ktor" }
ktor-server-default-headers = { group = "io.ktor", name = "ktor-server-default-headers", version.ref = "ktor" }
ktor-server-caching-headers = { group = "io.ktor", name = "ktor-server-caching-headers", version.ref = "ktor" }
ktor-server-status-pages = { group = "io.ktor", name = "ktor-server-status-pages", version.ref = "ktor" }
ktor-server-test-host = { group = "io.ktor", name = "ktor-server-test-host", version.ref = "ktor" }

logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }

micrometer-registry-prometheus = { module = "io.micrometer:micrometer-registry-prometheus", version.ref = "micrometer" }

mockk = { module = "io.mockk:mockk", version.ref = "mockk" }

postgresql = { module = "org.postgresql:postgresql", version.ref = "postgresql" }

xmlutil = { module = "io.github.pdvrieze.xmlutil:serialization", version.ref = "xmlutil" }

[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }

ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
30 changes: 9 additions & 21 deletions src/main/kotlin/link/kotlin/scripts/Application.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,17 @@

package link.kotlin.scripts

import link.kotlin.scripts.utils.logger
import kotlin.system.exitProcess

fun main() {
try {
val generator = AwesomeKotlinGenerator.default()

// Load data
val articles = generator.getArticles()
val links = generator.getLinks()
val generator = createApplicationModule {}
.awesomeKotlinGenerator

// Create README.md
generator.generateReadme(links)
// Load data
val articles = generator.getArticles()
val links = generator.getLinks()

// Generate resources for site
generator.generateSiteResources(links, articles)
// Create README.md
generator.generateReadme(links)

LOGGER.info("Done, exit.")
exitProcess(0)
} catch (e: Exception) {
LOGGER.error("Failed, exit.", e)
exitProcess(1)
}
// Generate resources for site
generator.generateSiteResources(links, articles)
}

private val LOGGER = logger {}
Loading

0 comments on commit fd05fcb

Please sign in to comment.