Skip to content

Commit 6497117

Browse files
committed
Refs #1 - start refactor
1 parent 03f5a49 commit 6497117

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+239
-121
lines changed

.github/workflows/ci.yaml .github/workflows/frontend.yaml

+5-15
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ name: Build
22

33
on:
44
push:
5-
paths-ignore:
6-
- bruno/**
7-
- .run/**
5+
paths:
6+
- frontend/**
87

98
jobs:
109
push:
@@ -14,15 +13,6 @@ jobs:
1413
- name: Checkout
1514
uses: actions/checkout@v4
1615

17-
- name: Set up JDK
18-
uses: actions/setup-java@v4
19-
with:
20-
java-version: '22'
21-
distribution: 'temurin'
22-
23-
- name: Build
24-
run: ./gradlew clean build
25-
2616
- name: Set up QEMU
2717
uses: docker/setup-qemu-action@v3
2818

@@ -38,14 +28,14 @@ jobs:
3828
- name: Build and push
3929
uses: docker/build-push-action@v5
4030
with:
41-
context: .
31+
context: ./frontend
4232
platforms: linux/amd64,linux/arm64
4333
push: true
44-
tags: "${{ secrets.DOCKERHUB_USERNAME }}/jzhistory:${{ github.sha }},${{ secrets.DOCKERHUB_USERNAME }}/jzhistory:latest"
34+
tags: "${{ secrets.DOCKERHUB_USERNAME }}/jzfrontend:${{ github.sha }},${{ secrets.DOCKERHUB_USERNAME }}/jzfrontend:latest"
4535

4636
- name: Create staging
4737
if: github.ref == 'refs/heads/main'
48-
run: docker buildx imagetools create -t ${{ secrets.DOCKERHUB_USERNAME }}/jzhistory:staging ${{ secrets.DOCKERHUB_USERNAME }}/jzhistory:latest
38+
run: docker buildx imagetools create -t ${{ secrets.DOCKERHUB_USERNAME }}/jzfrontend:staging ${{ secrets.DOCKERHUB_USERNAME }}/jzfrontend:latest
4939

5040
- name: Generate summary
5141
run: |

.github/workflows/index.yaml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
paths:
6+
- index/**
7+
8+
jobs:
9+
push:
10+
if: false
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Set up JDK
19+
uses: actions/setup-java@v4
20+
with:
21+
java-version: '22'
22+
distribution: 'temurin'
23+
24+
- name: Setup Gradle
25+
uses: gradle/actions/setup-gradle@v4
26+
27+
- name: Build
28+
run: ./gradlew :index:clean :index:build
29+
30+
- name: Set up QEMU
31+
uses: docker/setup-qemu-action@v3
32+
33+
- name: Set up Docker Buildx
34+
uses: docker/setup-buildx-action@v3
35+
36+
- name: Login to DockerHub Registry
37+
uses: docker/login-action@v3
38+
with:
39+
username: ${{ secrets.DOCKERHUB_USERNAME }}
40+
password: ${{ secrets.DOCKERHUB_TOKEN }}
41+
42+
- name: Build and push
43+
uses: docker/build-push-action@v5
44+
with:
45+
context: ./index
46+
platforms: linux/amd64,linux/arm64
47+
push: true
48+
tags: "${{ secrets.DOCKERHUB_USERNAME }}/jzindex:${{ github.sha }},${{ secrets.DOCKERHUB_USERNAME }}/jzindex:latest"
49+
50+
- name: Create staging
51+
if: github.ref == 'refs/heads/main'
52+
run: docker buildx imagetools create -t ${{ secrets.DOCKERHUB_USERNAME }}/jzindex:staging ${{ secrets.DOCKERHUB_USERNAME }}/jzindex:latest
53+
54+
- name: Generate summary
55+
run: |
56+
echo "Tag: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
57+
58+
- name: Upload reports if failed
59+
if: failure()
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: index-reports
63+
path: |
64+
**/build/reports/
65+
**/build/test-results/
66+
67+
- name: Upload coverage if passed
68+
if: success()
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: index-coverage
72+
path: |
73+
**/build/reports/jacoco/

.github/workflows/release.yaml

-23
This file was deleted.

.github/workflows/search.yaml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
paths:
6+
- search/**
7+
8+
jobs:
9+
push:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Set up JDK
17+
uses: actions/setup-java@v4
18+
with:
19+
java-version: '22'
20+
distribution: 'temurin'
21+
22+
- name: Setup Gradle
23+
uses: gradle/actions/setup-gradle@v4
24+
25+
- name: Build
26+
run: ./gradlew :search:clean :search:build
27+
28+
- name: Set up QEMU
29+
uses: docker/setup-qemu-action@v3
30+
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
34+
- name: Login to DockerHub Registry
35+
uses: docker/login-action@v3
36+
with:
37+
username: ${{ secrets.DOCKERHUB_USERNAME }}
38+
password: ${{ secrets.DOCKERHUB_TOKEN }}
39+
40+
- name: Build and push
41+
uses: docker/build-push-action@v5
42+
with:
43+
context: ./search
44+
platforms: linux/amd64,linux/arm64
45+
push: true
46+
tags: "${{ secrets.DOCKERHUB_USERNAME }}/jzsearch:${{ github.sha }},${{ secrets.DOCKERHUB_USERNAME }}/jzsearch:latest"
47+
48+
- name: Create staging
49+
if: github.ref == 'refs/heads/main'
50+
run: docker buildx imagetools create -t ${{ secrets.DOCKERHUB_USERNAME }}/jzsearch:staging ${{ secrets.DOCKERHUB_USERNAME }}/jzsearch:latest
51+
52+
- name: Generate summary
53+
run: |
54+
echo "Tag: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
55+
56+
- name: Upload reports if failed
57+
if: failure()
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: search-reports
61+
path: |
62+
**/build/reports/
63+
**/build/test-results/
64+
65+
- name: Upload coverage if passed
66+
if: success()
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: search-coverage
70+
path: |
71+
**/build/reports/jacoco/

build.gradle.kts

-72
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,3 @@
11
plugins {
2-
alias(libs.plugins.kotlin.jvm)
3-
alias(libs.plugins.ktor)
4-
alias(libs.plugins.kotlinter)
5-
alias(libs.plugins.detekt)
62
alias(libs.plugins.versions)
7-
alias(libs.plugins.serialization)
8-
jacoco
93
}
10-
11-
group = "no.java.conf"
12-
version = "0.0.1"
13-
14-
application {
15-
mainClass.set("io.ktor.server.cio.EngineMain")
16-
}
17-
18-
kotlin {
19-
jvmToolchain(22)
20-
21-
compilerOptions {
22-
freeCompilerArgs = listOf("-Xcontext-receivers")
23-
}
24-
}
25-
26-
repositories {
27-
mavenCentral()
28-
maven("https://maven.tryformation.com/releases") {
29-
content {
30-
includeGroup("com.jillesvangurp")
31-
}
32-
}
33-
}
34-
35-
dependencies {
36-
implementation(libs.ktor.server.core)
37-
implementation(libs.ktor.server.host.common)
38-
implementation(libs.ktor.server.status.pages)
39-
implementation(libs.ktor.server.cio)
40-
implementation(libs.ktor.server.content.negotiation)
41-
implementation(libs.logback.classic)
42-
implementation(libs.bundles.monitoring)
43-
implementation(libs.bundles.serialization)
44-
implementation(libs.bundles.ktor.client)
45-
implementation(libs.arrow.core)
46-
implementation(libs.kotlin.logging)
47-
implementation(libs.bundles.search)
48-
testImplementation(libs.bundles.test)
49-
}
50-
51-
tasks.shadowJar {
52-
dependsOn(":frontend:npm_run_generate")
53-
54-
from("frontend/.output/public") {
55-
into("static")
56-
}
57-
58-
archiveFileName.set("history.jar")
59-
}
60-
61-
tasks.jar {
62-
enabled = false
63-
}
64-
65-
tasks.withType<Test>().configureEach {
66-
useJUnitPlatform()
67-
}
68-
69-
tasks.test {
70-
finalizedBy(tasks.jacocoTestReport)
71-
}
72-
73-
tasks.jacocoTestReport {
74-
dependsOn(tasks.test)
75-
}

frontend/Dockerfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM node:22-alpine AS build
2+
3+
WORKDIR /app
4+
COPY . .
5+
RUN npm install
6+
RUN npm run build
7+
8+
FROM node:22-alpine AS deploy
9+
10+
WORKDIR /app
11+
COPY --from=build /app/.output/ /app
12+
CMD ["node", "/app/server/index.mjs"]

frontend/build.gradle.kts

-9
This file was deleted.

Dockerfile index/Dockerfile

File renamed without changes.

search/Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM eclipse-temurin:22-jre
2+
3+
RUN mkdir -p /opt/app
4+
COPY build/libs/search.jar /opt/app
5+
CMD ["java", "-jar", "/opt/app/search.jar"]
6+
++

search/build.gradle.kts

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
plugins {
2+
alias(libs.plugins.kotlin.jvm)
3+
alias(libs.plugins.ktor)
4+
alias(libs.plugins.kotlinter)
5+
alias(libs.plugins.detekt)
6+
alias(libs.plugins.versions)
7+
alias(libs.plugins.serialization)
8+
jacoco
9+
}
10+
11+
group = "no.java.conf"
12+
version = "0.0.1"
13+
14+
application {
15+
mainClass.set("io.ktor.server.cio.EngineMain")
16+
}
17+
18+
kotlin {
19+
jvmToolchain(22)
20+
21+
compilerOptions {
22+
freeCompilerArgs = listOf("-Xcontext-receivers")
23+
}
24+
}
25+
26+
repositories {
27+
mavenCentral()
28+
maven("https://maven.tryformation.com/releases") {
29+
content {
30+
includeGroup("com.jillesvangurp")
31+
}
32+
}
33+
}
34+
35+
dependencies {
36+
implementation(libs.ktor.server.core)
37+
implementation(libs.ktor.server.host.common)
38+
implementation(libs.ktor.server.status.pages)
39+
implementation(libs.ktor.server.cio)
40+
implementation(libs.ktor.server.content.negotiation)
41+
implementation(libs.logback.classic)
42+
implementation(libs.bundles.monitoring)
43+
implementation(libs.bundles.serialization)
44+
implementation(libs.bundles.ktor.client)
45+
implementation(libs.arrow.core)
46+
implementation(libs.kotlin.logging)
47+
implementation(libs.bundles.search)
48+
testImplementation(libs.bundles.test)
49+
}
50+
51+
tasks.shadowJar {
52+
archiveFileName.set("search.jar")
53+
}
54+
55+
tasks.jar {
56+
enabled = false
57+
}
58+
59+
tasks.withType<Test>().configureEach {
60+
useJUnitPlatform()
61+
}
62+
63+
tasks.test {
64+
finalizedBy(tasks.jacocoTestReport)
65+
}
66+
67+
tasks.jacocoTestReport {
68+
dependsOn(tasks.test)
69+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)