Skip to content

Commit 9cf592b

Browse files
committed
build: split integration test and run in parallel
1 parent 1e90f8a commit 9cf592b

4 files changed

Lines changed: 43 additions & 3 deletions

File tree

.github/workflows/build-and-test.yml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
with:
2626
java-version: '17'
2727
distribution: 'zulu'
28+
cache: 'gradle'
2829

2930
- name: Cache SonarQube packages
3031
uses: actions/cache@v4
@@ -39,7 +40,7 @@ jobs:
3940
- name: Build & Test with Gradle
4041
env:
4142
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
42-
run: ./gradlew build sonar -Ddb=all
43+
run: ./gradlew check sonar
4344

4445
- name: Upload Test Report
4546
uses: actions/upload-artifact@v4
@@ -60,6 +61,7 @@ jobs:
6061
uses: EnricoMi/publish-unit-test-result-action@v2
6162
if: always()
6263
with:
64+
check_name: Unit Tests
6365
files: |
6466
**/build/test-results/*/TEST-*.xml
6567
@@ -71,3 +73,41 @@ jobs:
7173
build/reports/kover/report.xml
7274
title: Code Coverage
7375
update-comment: true
76+
integration-test:
77+
name: Integration tests
78+
runs-on: ubuntu-latest
79+
needs:
80+
- build
81+
strategy:
82+
matrix:
83+
db: [ POSTGRESQL, MYSQL, SQLITE, MSSQLSERVER, ORACLE ]
84+
steps:
85+
- uses: actions/checkout@v4
86+
with:
87+
fetch-depth: 0
88+
89+
- name: Set up JDK 17
90+
uses: actions/setup-java@v4
91+
with:
92+
java-version: '17'
93+
distribution: 'zulu'
94+
cache: 'gradle'
95+
96+
- name: Integration tests
97+
run: ./gradlew integrationTest -Ddb=${{ matrix.db }}
98+
99+
- name: Upload Test Report
100+
uses: actions/upload-artifact@v4
101+
if: always() # always run even if the previous step fails
102+
with:
103+
name: ${{ matrix.db }}-test-results
104+
path: '**/build/test-results/integrationTest/TEST-*.xml'
105+
retention-days: 1
106+
107+
- name: Publish Test Results
108+
uses: EnricoMi/publish-unit-test-result-action@v2
109+
if: always()
110+
with:
111+
check_name: ${{ matrix.db }} Integration Tests
112+
files: |
113+
**/build/test-results/integrationTest/TEST-*.xml

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ subprojects {
2525
version = projectVersion
2626
}
2727

28-
tasks.build {
28+
tasks.check {
2929
dependsOn(":koverHtmlReport")
3030
dependsOn(":koverXmlReport")
3131
}

buildSrc/src/main/kotlin/kapper.library-conventions.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ tasks.named<Test>("test") {
112112

113113
tasks.check {
114114
dependsOn(tasks.ktlintCheck)
115-
dependsOn("integrationTest")
116115
dependsOn(tasks.koverVerify)
117116
}
118117

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
22
org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true
3+
org.gradle.caching=true

0 commit comments

Comments
 (0)