diff --git a/.github/workflows/ci-delta-app.yml b/.github/workflows/ci-delta-app.yml index f39c72ddbf..268bb4c314 100644 --- a/.github/workflows/ci-delta-app.yml +++ b/.github/workflows/ci-delta-app.yml @@ -14,6 +14,12 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: + - name: Setup JDK + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + check-latest: true - name: Checkout uses: actions/checkout@v3 with: diff --git a/.github/workflows/ci-delta-core.yml b/.github/workflows/ci-delta-core.yml index 41282247e0..eda3b1be86 100644 --- a/.github/workflows/ci-delta-core.yml +++ b/.github/workflows/ci-delta-core.yml @@ -18,6 +18,12 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: + - name: Setup JDK + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + check-latest: true - name: Checkout uses: actions/checkout@v3 with: diff --git a/.github/workflows/ci-delta-plugins.yml b/.github/workflows/ci-delta-plugins.yml index ebf32a57fb..a0a76d67a3 100644 --- a/.github/workflows/ci-delta-plugins.yml +++ b/.github/workflows/ci-delta-plugins.yml @@ -19,6 +19,12 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: + - name: Setup JDK + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + check-latest: true - name: Checkout uses: actions/checkout@v3 with: diff --git a/.github/workflows/ci-delta-static-analysis.yml b/.github/workflows/ci-delta-static-analysis.yml index 393748bb32..b5f49c1094 100644 --- a/.github/workflows/ci-delta-static-analysis.yml +++ b/.github/workflows/ci-delta-static-analysis.yml @@ -14,6 +14,12 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: + - name: Setup JDK + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + check-latest: true - name: Checkout uses: actions/checkout@v3 with: diff --git a/.github/workflows/ci-docs-ext-links.yml b/.github/workflows/ci-docs-ext-links.yml index 39b18650ed..b0d81dc736 100644 --- a/.github/workflows/ci-docs-ext-links.yml +++ b/.github/workflows/ci-docs-ext-links.yml @@ -9,6 +9,12 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 20 steps: + - name: Setup JDK + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + check-latest: true - name: Checkout uses: actions/checkout@v3 - name: Review diff --git a/.github/workflows/ci-docs.yml b/.github/workflows/ci-docs.yml index 200d46b6a6..f68c169139 100644 --- a/.github/workflows/ci-docs.yml +++ b/.github/workflows/ci-docs.yml @@ -13,6 +13,12 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 20 steps: + - name: Setup JDK + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + check-latest: true - name: Checkout uses: actions/checkout@v3 with: diff --git a/.github/workflows/ci-integration-tests.yml b/.github/workflows/ci-integration-tests.yml index 74de8c7157..9c567fd708 100644 --- a/.github/workflows/ci-integration-tests.yml +++ b/.github/workflows/ci-integration-tests.yml @@ -15,6 +15,12 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: + - name: Setup JDK + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + check-latest: true - name: Checkout uses: actions/checkout@v3 with: diff --git a/.github/workflows/ci-release-docker.yml b/.github/workflows/ci-release-docker.yml index f4d7b9f06f..d2710f8d07 100644 --- a/.github/workflows/ci-release-docker.yml +++ b/.github/workflows/ci-release-docker.yml @@ -15,6 +15,13 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 + - name: Setup JDK + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + check-latest: true + cache: 'sbt' - name: Set up proxy for docker buildx run: | echo http_proxy=${http_proxy} >> $GITHUB_ENV diff --git a/.github/workflows/ci-release-sonatype.yml b/.github/workflows/ci-release-sonatype.yml index 648d455b62..8e8e5c0c63 100644 --- a/.github/workflows/ci-release-sonatype.yml +++ b/.github/workflows/ci-release-sonatype.yml @@ -21,5 +21,12 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 + - name: Setup JDK + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + check-latest: true + cache: 'sbt' - name: Publish To Sonatype run: sbt -Dsbt.color=always -Dsbt.supershell=false ci-release \ No newline at end of file diff --git a/.github/workflows/ci-snapshot.yml b/.github/workflows/ci-snapshot.yml index 76bf2022b2..fd9118ee48 100644 --- a/.github/workflows/ci-snapshot.yml +++ b/.github/workflows/ci-snapshot.yml @@ -22,6 +22,13 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 + - name: Setup JDK + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + check-latest: true + cache: 'sbt' - name: Set up proxy for docker buildx run: | echo http_proxy=${http_proxy} >> $GITHUB_ENV diff --git a/.github/workflows/ci-storage.yml b/.github/workflows/ci-storage.yml index 3149158617..f6f8fbc3d4 100644 --- a/.github/workflows/ci-storage.yml +++ b/.github/workflows/ci-storage.yml @@ -14,6 +14,12 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: + - name: Setup JDK + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + check-latest: true - name: Checkout uses: actions/checkout@v3 with: diff --git a/build.sbt b/build.sbt index 609fe4a147..ccf5ce7c3d 100755 --- a/build.sbt +++ b/build.sbt @@ -383,6 +383,7 @@ lazy val app = project ) ) }, + Test / javaOptions += cglibFix, Test / fork := true, Test / test := { val _ = copyPlugins.value @@ -913,7 +914,7 @@ lazy val compilation = { Seq( scalaVersion := scalaCompilerVersion, scalacOptions ~= { options: Seq[String] => options.filterNot(Set("-Wself-implicit", "-Xlint:infer-any", "-Wnonunit-statement")) }, - javaSpecificationVersion := "11", + javaSpecificationVersion := "17", javacOptions ++= Seq( "-source", javaSpecificationVersion.value, @@ -977,12 +978,15 @@ lazy val servicePackaging = { else version.value }, Docker / daemonUser := "nexus", - dockerBaseImage := "eclipse-temurin:11-jre", + dockerBaseImage := "eclipse-temurin:17-jre", dockerBuildxPlatforms := Seq("linux/arm64/v8", "linux/amd64"), dockerExposedPorts := Seq(8080), dockerUsername := Some("bluebrain"), dockerUpdateLatest := false, - dockerChmodType := DockerChmodType.UserGroupWriteExecute + dockerChmodType := DockerChmodType.UserGroupWriteExecute, + dockerEnvVars := Map( + "JAVA_OPTS" -> cglibFix + ) ) } @@ -1066,3 +1070,6 @@ def unitTestsWithCoverageCommandsForModules(modules: List[String]) = { addCommandAlias("core-unit-tests-with-coverage", unitTestsWithCoverageCommandsForModules(coreModules)) addCommandAlias("app-unit-tests-with-coverage", unitTestsWithCoverageCommandsForModules(List("app"))) addCommandAlias("plugins-unit-tests-with-coverage", unitTestsWithCoverageCommandsForModules(List("plugins"))) + +// This option allows distage 1.0.10 to run on JDK 17+ +val cglibFix = "--add-opens=java.base/java.lang=ALL-UNNAMED" \ No newline at end of file diff --git a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/slowqueries/BlazegraphSlowQueryStoreSuite.scala b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/slowqueries/BlazegraphSlowQueryStoreSuite.scala index a1ef6362a0..67df0bdda1 100644 --- a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/slowqueries/BlazegraphSlowQueryStoreSuite.scala +++ b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/slowqueries/BlazegraphSlowQueryStoreSuite.scala @@ -1,18 +1,19 @@ package ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.slowqueries +import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.slowqueries.BlazegraphSlowQueryStoreSuite._ import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.slowqueries.model.BlazegraphSlowQuery import ch.epfl.bluebrain.nexus.delta.rdf.IriOrBNode.Iri import ch.epfl.bluebrain.nexus.delta.rdf.query.SparqlQuery import ch.epfl.bluebrain.nexus.delta.sdk.views.ViewRef import ch.epfl.bluebrain.nexus.delta.sourcing.model.{Identity, Label, ProjectRef} +import ch.epfl.bluebrain.nexus.delta.sourcing.postgres.Doobie import ch.epfl.bluebrain.nexus.testkit.IOFixedClock import ch.epfl.bluebrain.nexus.testkit.bio.BioSuite -import ch.epfl.bluebrain.nexus.delta.sourcing.postgres.Doobie import munit.AnyFixture +import java.time.temporal.ChronoUnit import java.time.{Duration, Instant} import scala.concurrent.duration.DurationInt -import BlazegraphSlowQueryStoreSuite._ class BlazegraphSlowQueryStoreSuite extends BioSuite @@ -31,7 +32,7 @@ class BlazegraphSlowQueryStoreSuite SparqlQuery(""), failed = true, 1.second, - Instant.now(), + Instant.now().truncatedTo(ChronoUnit.MILLIS), Identity.User("Ted Lasso", Label.unsafe("epfl")) ) @@ -69,7 +70,7 @@ object BlazegraphSlowQueryStoreSuite { ) } - private val Now = Instant.now() + private val Now = Instant.now().truncatedTo(ChronoUnit.MILLIS) private val OneWeekAgo = Now.minus(Duration.ofDays(7)) private val EightDaysAgo = Now.minus(Duration.ofDays(8)) private val RecentQuery = queryAtTime(Now)