Add CI/CD
This commit is contained in:
32
.gitea/workflows/release.yml
Normal file
32
.gitea/workflows/release.yml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
name: Create and Push Release
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
AUTHENTIK_URL: https://auth.smoothbrain.win
|
||||||
|
REGISTRY_URL: gitea.smoothbrain.win
|
||||||
|
IMAGE_OWNER: rak
|
||||||
|
IMAGE_NAME: dex-scraper-java
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup JDK
|
||||||
|
uses: https://gitea.smoothbrain.win/rak/setup-java@main
|
||||||
|
with:
|
||||||
|
distribution: 'corretto'
|
||||||
|
java-version: '21.0.6'
|
||||||
|
cache: 'gradle'
|
||||||
|
|
||||||
|
- name: Build & Push Image
|
||||||
|
env:
|
||||||
|
QUARKUS_CONTAINER_IMAGE_USERNAME: ${{ secrets.CI_SERVICE_ACCOUNT }}
|
||||||
|
QUARKUS_CONTAINER_IMAGE_PASSWORD: ${{ secrets.CI_SERVICE_ACCOUNT_PASSWORD }}
|
||||||
|
run: |
|
||||||
|
./gradlew clean build \
|
||||||
|
-Dquarkus.container-image.push=true
|
||||||
@@ -22,6 +22,7 @@ dependencies {
|
|||||||
implementation("io.quarkus:quarkus-rest-client-kotlin-serialization")
|
implementation("io.quarkus:quarkus-rest-client-kotlin-serialization")
|
||||||
implementation("io.quarkus:quarkus-rest-jackson")
|
implementation("io.quarkus:quarkus-rest-jackson")
|
||||||
implementation("io.quarkus:quarkus-kotlin")
|
implementation("io.quarkus:quarkus-kotlin")
|
||||||
|
implementation("io.quarkus:quarkus-smallrye-fault-tolerance")
|
||||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
|
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
|
||||||
implementation("io.quarkus:quarkus-arc")
|
implementation("io.quarkus:quarkus-arc")
|
||||||
implementation("org.jsoup:jsoup:1.20.1")
|
implementation("org.jsoup:jsoup:1.20.1")
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class CommonCrawlService(
|
|||||||
crawlName.indexName
|
crawlName.indexName
|
||||||
))
|
))
|
||||||
} catch (ex: RuntimeException) {
|
} catch (ex: RuntimeException) {
|
||||||
Log.warn("Error occurred querying crawl '${crawlName.indexName}' for URL $url")
|
Log.warn("Error occurred querying crawl '${crawlName.indexName}' for URL $url", ex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class ScrapeService(
|
|||||||
try {
|
try {
|
||||||
document = Jsoup.connect(url).get()
|
document = Jsoup.connect(url).get()
|
||||||
} catch(ex: Exception) {
|
} catch(ex: Exception) {
|
||||||
Log.warn("Error occurred during Jsoup query")
|
Log.warn("Error occurred during Jsoup query", ex)
|
||||||
throw TargetNotFoundException("Could not find '$setName' for Provider '$provider'")
|
throw TargetNotFoundException("Could not find '$setName' for Provider '$provider'")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,14 +6,17 @@ import io.netty.buffer.ByteBufInputStream
|
|||||||
import io.quarkus.rest.client.reactive.ClientQueryParam
|
import io.quarkus.rest.client.reactive.ClientQueryParam
|
||||||
import io.quarkus.rest.client.reactive.NotBody
|
import io.quarkus.rest.client.reactive.NotBody
|
||||||
import io.quarkus.rest.client.reactive.Url
|
import io.quarkus.rest.client.reactive.Url
|
||||||
|
import io.smallrye.faulttolerance.api.RateLimit
|
||||||
import jakarta.ws.rs.Consumes
|
import jakarta.ws.rs.Consumes
|
||||||
import jakarta.ws.rs.GET
|
import jakarta.ws.rs.GET
|
||||||
import jakarta.ws.rs.Path
|
import jakarta.ws.rs.Path
|
||||||
import jakarta.ws.rs.PathParam
|
import jakarta.ws.rs.PathParam
|
||||||
import jakarta.ws.rs.QueryParam
|
import jakarta.ws.rs.QueryParam
|
||||||
|
import org.eclipse.microprofile.faulttolerance.Bulkhead
|
||||||
import org.eclipse.microprofile.rest.client.annotation.ClientHeaderParam
|
import org.eclipse.microprofile.rest.client.annotation.ClientHeaderParam
|
||||||
import org.eclipse.microprofile.rest.client.annotation.RegisterProvider
|
import org.eclipse.microprofile.rest.client.annotation.RegisterProvider
|
||||||
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient
|
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient
|
||||||
|
import java.time.temporal.ChronoUnit
|
||||||
|
|
||||||
@RegisterRestClient(baseUri = "whatever")
|
@RegisterRestClient(baseUri = "whatever")
|
||||||
@RegisterProvider(NDJsonReader::class)
|
@RegisterProvider(NDJsonReader::class)
|
||||||
@@ -23,6 +26,11 @@ interface CommonCrawlRestClient {
|
|||||||
@ClientQueryParam(name = "output", value = ["json"])
|
@ClientQueryParam(name = "output", value = ["json"])
|
||||||
@Path("/{index}-index")
|
@Path("/{index}-index")
|
||||||
@Consumes("text/x-ndjson")
|
@Consumes("text/x-ndjson")
|
||||||
|
@RateLimit(
|
||||||
|
value = 1,
|
||||||
|
minSpacing = 5
|
||||||
|
)
|
||||||
|
@Bulkhead
|
||||||
fun queryIndex(
|
fun queryIndex(
|
||||||
@Url
|
@Url
|
||||||
baseUrl: String,
|
baseUrl: String,
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
quarkus:
|
quarkus:
|
||||||
|
|
||||||
|
container-image:
|
||||||
|
registry: gitea.smoothbrain.win
|
||||||
|
group: rak
|
||||||
|
build: true
|
||||||
|
additional-tags: latest
|
||||||
|
|
||||||
http:
|
http:
|
||||||
port: 8081
|
port: 8081
|
||||||
live-reload:
|
live-reload:
|
||||||
|
|||||||
Reference in New Issue
Block a user