Skip to content

Commit

Permalink
Updating to use Java 17 now that several dependencies are requiring J…
Browse files Browse the repository at this point in the history
…ava 17+ (#1276)

* Updating to use Java 17 now that several dependencies are requiring Java 17+

* More updates for Java 17

* Updating Gradle plugin tests to work with Java 17

* Updates for instant precision in Java 17

* Fixing task dependencies
  • Loading branch information
craigatk committed Apr 12, 2024
1 parent d2cafc2 commit 0c724a8
Show file tree
Hide file tree
Showing 23 changed files with 81 additions and 90 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/example-projects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: 'temurin'
cache: 'gradle'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: 'temurin'
cache: 'gradle'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/node-script-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 18
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: 'temurin'
cache: 'gradle'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-gradle-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: 'temurin'
cache: 'gradle'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 18
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: 'temurin'
cache: 'gradle'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/server-load-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: 'temurin'
cache: 'gradle'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/server-ui-functional-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 18
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: 'temurin'
cache: 'gradle'

Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Full list of releases and packaged server .jar file for each release: https://github.com/craigatk/projektor/releases

* v5.0.0
* BREAKING CHANGE: Projektor server is now built with Java 17 and requires Java 17+ to run
* v4.39.0
* Adding API endpoint for fetching recent test runs for a repo
* v4.38.1
Expand All @@ -19,7 +21,7 @@ Full list of releases and packaged server .jar file for each release: https://gi
* v4.35.0
* Use mainline when no branch specified when getting repo current coverage
* v4.34.0
* Adding /api endpoints for getting org and repo current coverage perecentage
* Adding /api endpoints for getting org and repo current coverage percentage
* v4.33.2
* Adding test file name to failed tests view on dashboard
* v4.33.1
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ including the change in coverage percentage in the PR.

Details on how to set this up are at https://projektor.dev/docs/github-pull-request/

## Changelog

### Projektor server

[Projektor server changelog](CHANGELOG.md)

### Projektor Gradle plugin

[Projektor Gradle plugin changelog](https://projektor.dev/docs/gradle-plugin/#changelog)

### Projektor Node script

[Projektor Node script changelog](https://projektor.dev/docs/node-script/#changelog)

## Development

For information on how Projektor is developed, how to build it from source and deploy it yourself, and other
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ strikt_version=0.34.1
wiremockVersion=2.35.2

github_api_version=1.321
logbackVersion=1.4.7
logbackVersion=1.4.14

ok_http3_version=4.12.0

Expand Down
2 changes: 1 addition & 1 deletion gradle/kotlin.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: "kotlin"
apply plugin: "org.jlleitschuh.gradle.ktlint"

sourceCompatibility = 11
sourceCompatibility = 17

compileKotlin {
kotlinOptions.jvmTarget = "$sourceCompatibility"
Expand Down
4 changes: 2 additions & 2 deletions publishers/gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ repositories {
}

group = "dev.projektor"
version = "8.7.0"
version = "9.0.0"

dependencies {
implementation "com.squareup.okhttp3:okhttp:${ok_http3_version}"
Expand Down Expand Up @@ -103,10 +103,10 @@ task startServerDaemon(type: com.github.psxpaul.task.JavaExecFork) {
'javadocJar',
'pluginUnderTestMetadata',
'sourcesJar',
'test',
'processFunctionalTestResources',
'processTestResources',
'validatePlugins'
mustRunAfter 'test'
classpath = tasks.getByPath(':server:server-app:shadowJar').outputs.files
main = 'io.ktor.server.netty.EngineMain'
stopAfter = functionalTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ class MultiProjectCoverageFunctionalSpec extends MultiProjectFunctionalSpecifica
assert overallStatsResponse.successful

CoverageStats overallStats = overallStatsResponse.body()
assert overallStats.statementStat.covered == 20
assert overallStats.statementStat.missed == 16
assert overallStats.statementStat.total == 36
assert overallStats.statementStat.coveredPercentage == 55.56
assert overallStats.statementStat.covered == 25
assert overallStats.statementStat.missed == 5
assert overallStats.statementStat.total == 30
assert overallStats.statementStat.coveredPercentage == 83.33

assert overallStats.lineStat.covered == 5
assert overallStats.lineStat.missed == 1
Expand Down Expand Up @@ -138,10 +138,10 @@ class MultiProjectCoverageFunctionalSpec extends MultiProjectFunctionalSpecifica
assert overallStatsResponse1.successful

CoverageStats overallStats = overallStatsResponse1.body()
assert overallStats.statementStat.covered == 20
assert overallStats.statementStat.missed == 16
assert overallStats.statementStat.total == 36
assert overallStats.statementStat.coveredPercentage == 55.56
assert overallStats.statementStat.covered == 25
assert overallStats.statementStat.missed == 5
assert overallStats.statementStat.total == 30
assert overallStats.statementStat.coveredPercentage == 83.33

assert overallStats.lineStat.covered == 5
assert overallStats.lineStat.missed == 1
Expand Down Expand Up @@ -178,7 +178,7 @@ class MultiProjectCoverageFunctionalSpec extends MultiProjectFunctionalSpecifica
Coverage coverage2 = coverageResponse2.body()
assert coverage2.previousTestRunId == testId1

assert coverage2.overallStats.statementStat.coveredPercentage == 55.56
assert coverage2.overallStats.statementStat.coveredPercentage == 83.33
assert coverage2.overallStats.statementStat.coveredPercentageDelta == 0.00

assert coverage2.overallStats.lineStat.coveredPercentage == 83.33
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ class SingleProjectCoverageFunctionalSpec extends ProjektorPluginFunctionalSpeci
assert overallStatsResponse.successful

CoverageStats overallStats = overallStatsResponse.body()
assert overallStats.statementStat.covered == 8
assert overallStats.statementStat.missed == 4
assert overallStats.statementStat.total == 12
assert overallStats.statementStat.coveredPercentage == 66.67
assert overallStats.statementStat.covered == 10
assert overallStats.statementStat.missed == 0
assert overallStats.statementStat.total == 10
assert overallStats.statementStat.coveredPercentage == 100.00

assert overallStats.lineStat.covered == 2
assert overallStats.lineStat.missed == 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ include 'project1', 'project2', 'project3'
}
dependencies {
testImplementation('org.spockframework:spock-core:1.3-groovy-2.5')
testImplementation('org.spockframework:spock-core:2.3-groovy-3.0')
}
test {
useJUnitPlatform()
}
projektor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class CoverageMultiTaskSpec extends SingleProjectSpec {
coverageFilePayloads.size() == 1

coverageFilePayloads[0].reportContents.contains("MyClass")
coverageFilePayloads[0].reportContents.contains('<counter type="LINE" missed="0" covered="2"/>')
coverageFilePayloads[0].reportContents.contains('<counter type="LINE" missed="1" covered="1"/>')

where:
gradleVersion | _
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ class KotlinDslSpec extends ProjectSpec {
}
dependencies {
"testImplementation"("org.spockframework:spock-core:1.3-groovy-2.5")
"testImplementation"("org.spockframework:spock-core:2.3-groovy-3.0")
}
tasks.named<Test>("test") {
useJUnitPlatform()
}
configure<projektor.plugin.ProjektorPublishPluginExtension> {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ class BuildFileWriter {
}
dependencies {
implementation('org.codehaus.groovy:groovy-all:2.5.13')
implementation('org.codehaus.groovy:groovy-all:3.0.21')
testImplementation('org.spockframework:spock-core:1.3-groovy-2.5')
testImplementation('org.spockframework:spock-core:2.3-groovy-3.0')
}
test {
useJUnitPlatform()
}
${config.includeJacocoPlugin ? "jacocoTestReport { dependsOn test }": ""}
Expand Down
6 changes: 3 additions & 3 deletions server/server-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ dependencies {
implementation "io.ktor:ktor-server-metrics-micrometer:$ktor_version"
implementation 'io.micrometer:micrometer-registry-influx:1.12.5'

implementation "net.javacrumbs.shedlock:shedlock-provider-jdbc-template:4.47.0"
implementation "net.javacrumbs.shedlock:shedlock-provider-jdbc-template:5.12.0"

implementation 'org.simpleflatmapper:sfm-jooq:8.2.3'
implementation 'org.simpleflatmapper:sfm-jooq:9.0.0'

implementation "ch.qos.logback:logback-classic:$logbackVersion"
implementation "net.logstash.logback:logstash-logback-encoder:7.4"
Expand Down Expand Up @@ -121,7 +121,7 @@ heroku {
includes = ["${projectDir}/build/libs/server-app-1.0-all.jar".toString(), "${projectDir}/opentelemetry/opentelemetry-javaagent.jar".toString()]
includeBuildDir = false
appName = "projektorlive"
jdkVersion = "11"
jdkVersion = "17"
}

deployHeroku.dependsOn('assembleFull')
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package projektor.schedule
import net.javacrumbs.shedlock.core.DefaultLockingTaskExecutor
import net.javacrumbs.shedlock.core.LockConfiguration
import net.javacrumbs.shedlock.provider.jdbctemplate.JdbcTemplateLockProvider
import java.time.Duration
import java.time.Instant
import javax.sql.DataSource

Expand All @@ -11,8 +12,9 @@ class SchedulerLock(dataSource: DataSource) {
private val executor = DefaultLockingTaskExecutor(lockProvider)

fun executeWithLock(runnable: Runnable, lockConfig: SchedulerLockConfig) {
val lockAtMostUntil: Instant = Instant.now().plusSeconds(lockConfig.lockMinutes * 60)
executor.executeWithLock(runnable, LockConfiguration(lockConfig.lockName, lockAtMostUntil))
val lockAtMostFor: Duration = Duration.ofMinutes(lockConfig.lockMinutes)
val lockAtLeastFor: Duration = Duration.ofSeconds(15)
executor.executeWithLock(runnable, LockConfiguration(Instant.now(), lockConfig.lockName, lockAtMostFor, lockAtLeastFor))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import strikt.assertions.isNotNull
import strikt.assertions.isNull
import strikt.assertions.isTrue
import java.time.ZoneOffset
import java.time.temporal.ChronoUnit

class PreviousTestRunServiceTest : DatabaseRepositoryTestCase() {

Expand Down Expand Up @@ -222,7 +223,7 @@ class PreviousTestRunServiceTest : DatabaseRepositoryTestCase() {
val recentTestRun = runBlocking { previousTestRunService.findMostRecentRunWithCoverage(repoName, projectName, BranchSearch(branchType = BranchType.MAINLINE)) }
expectThat(recentTestRun).isNotNull().and {
get { publicId }.isEqualTo(newPublicId)
get { createdTimestamp }.isEqualTo(newTestRun.createdTimestamp.toInstant(ZoneOffset.UTC))
get { createdTimestamp.truncatedTo(ChronoUnit.MILLIS) }.isEqualTo(newTestRun.createdTimestamp.toInstant(ZoneOffset.UTC).truncatedTo(ChronoUnit.MILLIS))
get { branch }.isEqualTo("main")
}
}
Expand Down Expand Up @@ -263,7 +264,7 @@ class PreviousTestRunServiceTest : DatabaseRepositoryTestCase() {
val recentTestRun = runBlocking { previousTestRunService.findMostRecentRun(repoName, null, BranchSearch(branchType = BranchType.MAINLINE)) }
expectThat(recentTestRun).isNotNull().and {
get { publicId }.isEqualTo(newPublicId)
get { createdTimestamp }.isEqualTo(newTestRun.createdTimestamp.toInstant(ZoneOffset.UTC))
get { createdTimestamp.truncatedTo(ChronoUnit.MILLIS) }.isEqualTo(newTestRun.createdTimestamp.toInstant(ZoneOffset.UTC).truncatedTo(ChronoUnit.MILLIS))
get { branch }.isEqualTo("main")
}
}
Expand Down Expand Up @@ -306,7 +307,7 @@ class PreviousTestRunServiceTest : DatabaseRepositoryTestCase() {
val recentTestRun = runBlocking { previousTestRunService.findMostRecentRun(repoName, projectName, BranchSearch(branchType = BranchType.MAINLINE)) }
expectThat(recentTestRun).isNotNull().and {
get { publicId }.isEqualTo(newPublicId)
get { createdTimestamp }.isEqualTo(newTestRun.createdTimestamp.toInstant(ZoneOffset.UTC))
get { createdTimestamp.truncatedTo(ChronoUnit.MILLIS) }.isEqualTo(newTestRun.createdTimestamp.toInstant(ZoneOffset.UTC).truncatedTo(ChronoUnit.MILLIS))
get { branch }.isEqualTo("main")
get { passed }.isTrue()
}
Expand Down
Loading

0 comments on commit 0c724a8

Please sign in to comment.