Skip to content

Commit 88d7582

Browse files
authored
Run integration tests and examples in CI (#435)
Run `integrationTest` and `examplesTest` test suites in CI as part of PR checks and before publishing artifacts, as a final validation. #432 and this PR are aimed at preventing regressions such as #426. These test suites require a real Develocity server to make API requests to. This was previously not possible because the maintainer didn't have access to a Develocity server that could be used from a public GitHub repository's workflows. As a result, the `integrationTest` suite and the examples had to be manually ran locally against the Develocity server that was available. That was always done for significant PRs and before each release. Now, with access to a server that can be used in this repository, changes can be fully validated in CI, reducing the effort needed to make changes to the library. Also fix the `examplesTest` notebooks test which broke from the `@TempDir` annotation being accidentally removed in 309acfe. Since it was a trivial change, tests were not ran locally. After this PR, a commit such as this being merged will no longer be possible.
1 parent b53ecab commit 88d7582

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

.github/workflows/pr.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,16 @@ jobs:
1111

1212
kotlin-tests:
1313
runs-on: ubuntu-latest
14+
env:
15+
DEVELOCITY_API_URL: "${{ vars.DEVELOCITY_API_URL }}"
16+
DEVELOCITY_API_TOKEN: "${{ secrets.DEVELOCITY_API_TOKEN }}"
1417
steps:
1518
- name: Checkout
1619
uses: actions/checkout@v4
17-
- name: gradle test
20+
- name: gradle check
1821
uses: ./.github/actions/build
1922
with:
20-
args: >-
21-
test
22-
compileIntegrationTestKotlin
23-
compileExamplesTestKotlin
24-
:build-logic:check
25-
:library:apiCheck
23+
args: check
2624

2725
python-tests:
2826
runs-on: ubuntu-latest

.github/workflows/publish-library.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ jobs:
2424

2525
build-and-publish:
2626
runs-on: ubuntu-latest
27+
env:
28+
DEVELOCITY_API_URL: "${{ vars.DEVELOCITY_API_URL }}"
29+
DEVELOCITY_API_TOKEN: "${{ secrets.DEVELOCITY_API_TOKEN }}"
2730
steps:
2831
- name: Checkout
2932
uses: actions/checkout@v4
@@ -35,6 +38,7 @@ jobs:
3538
with:
3639
dry-run: ${{ inputs.dry_run }}
3740
args: >-
41+
check
3842
publishDevelocityApiKotlinPublicationToMavenCentralRepository
3943
publishRelocationPublicationToMavenCentralRepository
4044
--rerun-tasks

build-logic/src/main/kotlin/com/gabrielfeo/kotlin-jvm-library.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,11 @@ testing {
2424
}
2525
}
2626
}
27+
28+
val testTasks = tasks.named {
29+
it == "check" || it.contains("test", ignoreCase = true)
30+
}
31+
32+
tasks.named { it.startsWith("publish") }.configureEach {
33+
shouldRunAfter(testTasks)
34+
}

library/src/examplesTest/kotlin/com/gabrielfeo/develocity/api/example/notebook/NotebooksTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ import org.junit.jupiter.api.Assertions.assertTrue
66
import org.junit.jupiter.api.BeforeEach
77
import org.junit.jupiter.api.Test
88
import org.junit.jupiter.api.assertDoesNotThrow
9+
import org.junit.jupiter.api.io.TempDir
910
import java.nio.file.Path
1011
import kotlin.io.path.Path
1112
import kotlin.io.path.absolute
1213
import kotlin.io.path.div
1314

1415
class NotebooksTest {
1516

17+
@TempDir
1618
lateinit var tempDir: Path
1719

1820
lateinit var venv: PythonVenv

0 commit comments

Comments
 (0)