From f646df4b40a5a6b666a383e6c34f999755b5b8e4 Mon Sep 17 00:00:00 2001 From: "Taro L. Saito" Date: Sun, 29 Sep 2024 15:36:06 -0700 Subject: [PATCH] internal: Add Scala 3.5.x CI test (#3590) --- .github/workflows/test.yml | 20 +++++++++++++++++++ .../airframe/http/router/RouteMatcher.scala | 2 +- .../surface/PathDependentTypeTest.scala | 16 +++++++++++---- airspec/build.sbt | 3 ++- build.sbt | 2 +- 5 files changed, 36 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0451d54a41..08067924dc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -96,6 +96,26 @@ jobs: check_name: Test Report Scala 3.x annotate_only: true detailed_summary: true + test_3_latest: + name: Scala 3.5.x + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '21' + - name: Scala 3.5.x test + # Test only Scala 3 supported projects + run: SCALA_VERSION=3.5.1 ./sbt "projectDotty/test; dottyTest/run" + - name: Publish Test Report + uses: mikepenz/action-junit-report@v4 + if: always() # always run even if the previous step fails + with: + report_paths: '**/target/test-reports/TEST-*.xml' + check_name: Test Report Scala 3.5.x + annotate_only: true + detailed_summary: true test_3_latest_jdk: name: Scala 3 / JDK17 runs-on: ubuntu-latest diff --git a/airframe-http/.jvm/src/main/scala/wvlet/airframe/http/router/RouteMatcher.scala b/airframe-http/.jvm/src/main/scala/wvlet/airframe/http/router/RouteMatcher.scala index f9c35ddfa4..e0a9802cab 100644 --- a/airframe-http/.jvm/src/main/scala/wvlet/airframe/http/router/RouteMatcher.scala +++ b/airframe-http/.jvm/src/main/scala/wvlet/airframe/http/router/RouteMatcher.scala @@ -56,7 +56,7 @@ object RouteMatcher extends LogSupport { } def findRoute[Req](request: Req)(implicit tp: HttpRequestAdapter[Req]): Option[RouteMatch] = { - routesByMethod.get(tp.methodOf(request)).flatMap { nextRouter => nextRouter.findRoute(request)(tp) } + routesByMethod.get(tp.methodOf(request)).flatMap { nextRouter => nextRouter.findRoute(request)(using tp) } } } diff --git a/airframe-surface/src/test/scala-3/wvlet/airframe/surface/PathDependentTypeTest.scala b/airframe-surface/src/test/scala-3/wvlet/airframe/surface/PathDependentTypeTest.scala index 007a96384a..f8568e8fc2 100644 --- a/airframe-surface/src/test/scala-3/wvlet/airframe/surface/PathDependentTypeTest.scala +++ b/airframe-surface/src/test/scala-3/wvlet/airframe/surface/PathDependentTypeTest.scala @@ -30,12 +30,20 @@ class PathDependentTypeTest extends AirSpec: test("pass dependent types") { val s = Surface.of[MyProfile#Backend] - s.name shouldBe "Backend" - s.toString shouldBe "Backend:=MyBackend" + if s.name == "MyBackend" then + // Scala 3.5.x or later + s.toString shouldBe "MyBackend" + else + s.name shouldBe "Backend" + s.toString shouldBe "Backend:=MyBackend" } test("nested path dependent types") { val s = Surface.of[MyProfile#Backend#Database] - s.name shouldBe "Database" - s.toString shouldBe "Database:=DatabaseDef" + if s.name == "DatabaseDef" then + // Scala 3.5.x or later + s.toString shouldBe "DatabaseDef" + else + s.name shouldBe "Database" + s.toString shouldBe "Database:=DatabaseDef" } diff --git a/airspec/build.sbt b/airspec/build.sbt index f520a56162..f42d1c1ace 100644 --- a/airspec/build.sbt +++ b/airspec/build.sbt @@ -130,7 +130,8 @@ def excludePomDependency(excludes: Seq[String]) = { node: XmlNode => }).transform(node).head } -/** AirSpec build definitions. +/** + * AirSpec build definitions. * * To make AirSpec a standalone library without any cyclic project references, AirSpec embeds the source code of * airframe-log, di, surface, etc. diff --git a/build.sbt b/build.sbt index c8703f0cef..ce84da5b12 100644 --- a/build.sbt +++ b/build.sbt @@ -3,7 +3,7 @@ import xerial.sbt.pack.PackPlugin.{projectSettings, publishPackArchiveTgz} val SCALA_2_12 = "2.12.20" val SCALA_2_13 = "2.13.15" -val SCALA_3 = "3.3.4" +val SCALA_3 = sys.env.getOrElse("SCALA_VERSION", "3.3.4") val uptoScala2 = SCALA_2_13 :: SCALA_2_12 :: Nil val targetScalaVersions = SCALA_3 :: uptoScala2