CI/CD
This commit is contained in:
parent
5e7fd754c0
commit
88b1065414
|
@ -0,0 +1,22 @@
|
|||
image: gradle:$GRADLE_VERSION-jdk$JDK_VERSION
|
||||
|
||||
stages:
|
||||
- test
|
||||
- deploy
|
||||
|
||||
test:
|
||||
stage: test
|
||||
script:
|
||||
- gradle test
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit: build/test-results/test/TEST-*.xml
|
||||
|
||||
deploy-maven:
|
||||
stage: deploy
|
||||
needs: [ 'test' ]
|
||||
only:
|
||||
- master
|
||||
script:
|
||||
docker publish
|
|
@ -5,10 +5,13 @@ version = "1.0"
|
|||
|
||||
plugins {
|
||||
kotlin("jvm") version "1.4.30"
|
||||
id("org.jetbrains.dokka") version "1.4.20"
|
||||
id("maven-publish")
|
||||
id("com.github.johnrengelman.shadow") version "6.1.0"
|
||||
}
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
|
@ -21,15 +24,51 @@ dependencies {
|
|||
implementation("ch.qos.logback:logback-classic:1.0.13")
|
||||
|
||||
// Database drivers
|
||||
implementation("mysql:mysql-connector-java:8.0.22")
|
||||
runtimeOnly("com.h2database:h2:1.4.199")
|
||||
runtimeOnly("mysql:mysql-connector-java:8.0.22")
|
||||
runtimeOnly("org.postgresql:postgresql:42.2.16")
|
||||
runtimeOnly("com.microsoft.sqlserver:mssql-jdbc:9.2.1.jre11")
|
||||
|
||||
testImplementation("io.mockk:mockk:1.10.6")
|
||||
testImplementation("io.kotest:kotest-runner-junit5:4.4.1")
|
||||
implementation(kotlin("stdlib-jdk8"))
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("cre-database-manager") {
|
||||
from(components["kotlin"])
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url = uri("https://git.fyloz.dev/api/v4/projects/40/packages/maven")
|
||||
name = "Gitlab"
|
||||
|
||||
credentials(HttpHeaderCredentials::class.java) {
|
||||
val gitlabPrivateTokens: String? by project
|
||||
|
||||
name = "Private-Token"
|
||||
value = gitlabPrivateTokens ?: System.getenv("CI_JOB_TOKEN")
|
||||
}
|
||||
authentication {
|
||||
create<HttpHeaderAuthentication>("header")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
|
||||
testLogging {
|
||||
events("failed")
|
||||
}
|
||||
|
||||
reports {
|
||||
junitXml.isEnabled = true
|
||||
html.isEnabled = false
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile>() {
|
||||
|
@ -42,3 +81,7 @@ tasks.withType<Jar> {
|
|||
attributes["Main-Class"] = "dev.fyloz.colorrecipesexplorer.databasemanager.DatabaseUpdaterKt"
|
||||
}
|
||||
}
|
||||
|
||||
tasks.dokkaHtml {
|
||||
outputDirectory.set(rootDir.resolve("dokka"))
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
|
||||
rootProject.name = "DatabaseManager"
|
||||
rootProject.name = "database-manager"
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class CreDatabase(
|
|||
}
|
||||
|
||||
private var databaseOpen = false
|
||||
val database by lazy {
|
||||
private val database by lazy {
|
||||
DatabaseFactory.getInstance().findCorrectDatabaseImplementation(JdbcConnection(databaseConnection))
|
||||
.apply { databaseOpen = true }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue