This commit is contained in:
FyloZ 2021-03-04 13:05:23 -05:00
parent 5e7fd754c0
commit 88b1065414
4 changed files with 69 additions and 4 deletions

22
.gitlab-ci.yml Normal file
View File

@ -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

View File

@ -5,10 +5,13 @@ version = "1.0"
plugins { plugins {
kotlin("jvm") version "1.4.30" 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" id("com.github.johnrengelman.shadow") version "6.1.0"
} }
repositories { repositories {
jcenter()
mavenCentral() mavenCentral()
} }
@ -21,15 +24,51 @@ dependencies {
implementation("ch.qos.logback:logback-classic:1.0.13") implementation("ch.qos.logback:logback-classic:1.0.13")
// Database drivers // 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.mockk:mockk:1.10.6")
testImplementation("io.kotest:kotest-runner-junit5:4.4.1") 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 { tasks.test {
useJUnitPlatform() useJUnitPlatform()
testLogging {
events("failed")
}
reports {
junitXml.isEnabled = true
html.isEnabled = false
}
} }
tasks.withType<KotlinCompile>() { tasks.withType<KotlinCompile>() {
@ -42,3 +81,7 @@ tasks.withType<Jar> {
attributes["Main-Class"] = "dev.fyloz.colorrecipesexplorer.databasemanager.DatabaseUpdaterKt" attributes["Main-Class"] = "dev.fyloz.colorrecipesexplorer.databasemanager.DatabaseUpdaterKt"
} }
} }
tasks.dokkaHtml {
outputDirectory.set(rootDir.resolve("dokka"))
}

View File

@ -1,3 +1,3 @@
rootProject.name = "DatabaseManager" rootProject.name = "database-manager"

View File

@ -54,7 +54,7 @@ class CreDatabase(
} }
private var databaseOpen = false private var databaseOpen = false
val database by lazy { private val database by lazy {
DatabaseFactory.getInstance().findCorrectDatabaseImplementation(JdbcConnection(databaseConnection)) DatabaseFactory.getInstance().findCorrectDatabaseImplementation(JdbcConnection(databaseConnection))
.apply { databaseOpen = true } .apply { databaseOpen = true }
} }