Change tests task and CI
This commit is contained in:
21
.github/workflows/tests.yml
vendored
21
.github/workflows/tests.yml
vendored
@@ -69,6 +69,13 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: Build
|
name: Build
|
||||||
path: build
|
path: build
|
||||||
|
|
||||||
|
- name: Composer Up
|
||||||
|
uses: eskatos/gradle-command-action@v1
|
||||||
|
with:
|
||||||
|
gradle-version: 6.8
|
||||||
|
arguments: testSqlComposeUp
|
||||||
|
|
||||||
- name: TestSql
|
- name: TestSql
|
||||||
uses: eskatos/gradle-command-action@v1
|
uses: eskatos/gradle-command-action@v1
|
||||||
with:
|
with:
|
||||||
@@ -81,19 +88,29 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK 11
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 11
|
java-version: 11
|
||||||
|
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: Build
|
name: Build
|
||||||
path: build
|
path: build
|
||||||
|
|
||||||
|
- name: Composer Up
|
||||||
|
uses: eskatos/gradle-command-action@v1
|
||||||
|
with:
|
||||||
|
gradle-version: 6.8
|
||||||
|
arguments: testComposeUp
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
uses: eskatos/gradle-command-action@v1
|
uses: eskatos/gradle-command-action@v1
|
||||||
with:
|
with:
|
||||||
gradle-version: 6.8
|
gradle-version: 6.8
|
||||||
arguments: test -x testSql
|
arguments: test
|
||||||
|
|
||||||
- name: Coverage
|
- name: Coverage
|
||||||
uses: eskatos/gradle-command-action@v1
|
uses: eskatos/gradle-command-action@v1
|
||||||
with:
|
with:
|
||||||
@@ -101,12 +118,14 @@ jobs:
|
|||||||
arguments: coveralls
|
arguments: coveralls
|
||||||
env:
|
env:
|
||||||
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
|
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
|
||||||
|
|
||||||
- name: Cache SonarCloud packages
|
- name: Cache SonarCloud packages
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v1
|
||||||
with:
|
with:
|
||||||
path: ~/.sonar/cache
|
path: ~/.sonar/cache
|
||||||
key: ${{ runner.os }}-sonar
|
key: ${{ runner.os }}-sonar
|
||||||
restore-keys: ${{ runner.os }}-sonar
|
restore-keys: ${{ runner.os }}-sonar
|
||||||
|
|
||||||
- name: Build and analyze
|
- name: Build and analyze
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ val migration by tasks.registering {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val migrationTest by tasks.registering {
|
val migrationTest by tasks.registering {
|
||||||
group = "verification"
|
group = "tests"
|
||||||
dependsOn(tasks.named("testComposeUp"))
|
dependsOn(tasks.named("testComposeUp"))
|
||||||
finalizedBy(tasks.named("testComposeDown"))
|
finalizedBy(tasks.named("testComposeDown"))
|
||||||
doLast {
|
doLast {
|
||||||
@@ -118,11 +118,9 @@ val migrationTest by tasks.registering {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val testSql by tasks.registering {
|
val testSql by tasks.registering {
|
||||||
group = "verification"
|
group = "tests"
|
||||||
dependsOn(tasks.named("processResources"))
|
dependsOn(tasks.named("processResources"))
|
||||||
dependsOn(tasks.named("processTestResources"))
|
dependsOn(tasks.named("processTestResources"))
|
||||||
dependsOn(tasks.named("testSqlComposeUp"))
|
|
||||||
finalizedBy(tasks.named("testSqlComposeDown"))
|
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
val config = ConfigFactory.parseFile(file("$buildDir/resources/test/application-test.conf")).resolve()
|
val config = ConfigFactory.parseFile(file("$buildDir/resources/test/application-test.conf")).resolve()
|
||||||
@@ -197,8 +195,7 @@ val sourcesJar by tasks.registering(Jar::class) {
|
|||||||
tasks.test {
|
tasks.test {
|
||||||
useJUnit()
|
useJUnit()
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
// systemProperty("junit.jupiter.execution.parallel.enabled", true)
|
systemProperty("junit.jupiter.execution.parallel.enabled", true)
|
||||||
dependsOn(testSql)
|
|
||||||
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run
|
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,13 +203,6 @@ coveralls {
|
|||||||
sourceDirs.add("src/main/kotlin")
|
sourceDirs.add("src/main/kotlin")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register("testAll") {
|
|
||||||
group = "verification"
|
|
||||||
dependsOn(testSql)
|
|
||||||
dependsOn(tasks.test)
|
|
||||||
dependsOn(tasks.ktlintCheck)
|
|
||||||
}
|
|
||||||
|
|
||||||
apply(plugin = "docker-compose")
|
apply(plugin = "docker-compose")
|
||||||
dockerCompose {
|
dockerCompose {
|
||||||
projectName = "dc-project"
|
projectName = "dc-project"
|
||||||
@@ -228,14 +218,12 @@ dockerCompose {
|
|||||||
useComposeFiles = listOf("docker-compose-test.yml")
|
useComposeFiles = listOf("docker-compose-test.yml")
|
||||||
startedServices = listOf("db", "elasticsearch")
|
startedServices = listOf("db", "elasticsearch")
|
||||||
stopContainers = false
|
stopContainers = false
|
||||||
isRequiredBy(project.tasks.named("testSql"))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
createNested("test").apply {
|
createNested("test").apply {
|
||||||
projectName = "dc-project_test"
|
projectName = "dc-project_test"
|
||||||
useComposeFiles = listOf("docker-compose-test.yml")
|
useComposeFiles = listOf("docker-compose-test.yml")
|
||||||
stopContainers = false
|
stopContainers = false
|
||||||
isRequiredBy(project.tasks.test)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,6 +308,12 @@ tasks.named("testComposeUp").configure {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.register("testWithDependencies", Test::class) {
|
||||||
|
group = "tests"
|
||||||
|
dependsOn(tasks.named("testComposeUp"))
|
||||||
|
dependsOn(tasks.ktlintCheck)
|
||||||
|
dependsOn(testSql)
|
||||||
|
}
|
||||||
tasks.register("testArticles", Test::class) {
|
tasks.register("testArticles", Test::class) {
|
||||||
group = "tests"
|
group = "tests"
|
||||||
useJUnitPlatform {
|
useJUnitPlatform {
|
||||||
@@ -368,7 +362,7 @@ tasks.register("testVotes", Test::class) {
|
|||||||
includeTags("vote")
|
includeTags("vote")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tasks.register("testWorkgroup", Test::class) {
|
tasks.register("testWorkgroups", Test::class) {
|
||||||
group = "tests"
|
group = "tests"
|
||||||
useJUnitPlatform {
|
useJUnitPlatform {
|
||||||
includeTags("workgroup")
|
includeTags("workgroup")
|
||||||
|
|||||||
Reference in New Issue
Block a user