Skip to content

Commit 0e6953f

Browse files
committed
Merge branch 'release/0.9.0'
2 parents 03476f5 + 73de371 commit 0e6953f

13 files changed

Lines changed: 97 additions & 199 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- name: Checkout
10-
uses: actions/checkout@v4.1.4
10+
uses: actions/checkout@v4.2.2
1111
- name: Set up JDK
1212
uses: actions/setup-java@v4
1313
with:
@@ -16,7 +16,7 @@ jobs:
1616
- name: Run tests
1717
run: sbt coverage test coverageReport
1818
- name: Upload coverage reports
19-
uses: codecov/codecov-action@v4
19+
uses: codecov/codecov-action@v5
2020
with:
2121
fail_ci_if_error: true
2222
verbose: true
@@ -27,7 +27,7 @@ jobs:
2727
runs-on: ubuntu-latest
2828
steps:
2929
- name: Checkout
30-
uses: actions/checkout@v4.1.4
30+
uses: actions/checkout@v4.2.2
3131
- name: Create GitHub release draft
3232
uses: release-drafter/release-drafter@v6
3333
env:
@@ -43,14 +43,14 @@ jobs:
4343
packages: write
4444
steps:
4545
- name: Checkout
46-
uses: actions/checkout@v4.1.4
46+
uses: actions/checkout@v4.2.2
4747
- name: Set up JDK
4848
uses: actions/setup-java@v4
4949
with:
5050
distribution: 'adopt'
5151
java-version: 11
5252
- name: Login to GitHub Container Registry
53-
uses: docker/login-action@v3.1.0
53+
uses: docker/login-action@v3.3.0
5454
with:
5555
registry: ghcr.io
5656
username: ${{ github.repository_owner }}
@@ -68,7 +68,7 @@ jobs:
6868
docker tag $IMAGE_GHCR $IMAGE_GCR
6969
echo "image_gcr=$IMAGE_GCR" >> $GITHUB_ENV
7070
- name: Login to Google Container Registry
71-
uses: docker/login-action@v3.1.0
71+
uses: docker/login-action@v3.3.0
7272
with:
7373
registry: eu.gcr.io
7474
username: _json_key

.scalafmt.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
version = "3.8.1"
1+
version = "3.8.3"
22

33
maxColumn = 140
44
align.preset = most
55
continuationIndent.defnSite = 2
66
rewrite.rules = [SortImports, AvoidInfix, PreferCurlyFors, RedundantBraces, RedundantParens]
7-
runner.dialect = scala213source3
7+
runner.dialect = scala3

Dockerfile

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,9 @@
1-
FROM ghcr.io/graalvm/graalvm-ce:ol8-java17-22.3.3 as builder
1+
FROM ghcr.io/graalvm/native-image-community:23.0.1-muslib-ol9 as builder
22

33
ARG upx_compression
44
ARG print_reports
5-
RUN gu install native-image
65
RUN curl -L https://www.scala-sbt.org/sbt-rpm.repo | tee /etc/yum.repos.d/sbt-rpm.repo && microdnf install sbt git xz
76

8-
# BEGIN INSTALL PRE-REQUISITES FOR STATIC NATIVE IMAGES WITH GRAAL >= 20.2.0
9-
# See:
10-
# - https://github.com/oracle/graal/issues/2824#issuecomment-685159371
11-
# - https://github.com/oracle/graal/blob/vm-20.3.0/substratevm/StaticImages.md
12-
ARG TOOLCHAIN_DIR="/toolchain"
13-
14-
RUN mkdir ${TOOLCHAIN_DIR} && \
15-
curl -L -o musl.tar.gz https://more.musl.cc/10.2.1/x86_64-linux-musl/x86_64-linux-musl-native.tgz && \
16-
tar -xvzf musl.tar.gz -C ${TOOLCHAIN_DIR} --strip-components 1 && \
17-
rm -f /musl.tar.gz
18-
19-
ENV PATH="$PATH:${TOOLCHAIN_DIR}/bin"
20-
ENV CC="${TOOLCHAIN_DIR}/bin/gcc"
21-
22-
RUN curl -L -o zlib.tar.gz https://zlib.net/fossils/zlib-1.2.12.tar.gz && \
23-
mkdir zlib && tar -xvzf zlib.tar.gz -C zlib --strip-components 1 && cd zlib && \
24-
./configure --static --prefix=${TOOLCHAIN_DIR} && \
25-
make && make install && \
26-
cd / && rm -rf /zlib && rm -f /zlib.tar.gz
27-
#END INSTALL PRE-REQUISITES FOR STATIC NATIVE IMAGES WITH GRAAL >= 20.2.0
28-
297
COPY . /build
308
WORKDIR /build
319
RUN sbt graalvm-native-image:packageBin

build.sbt

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
ThisBuild / scalaVersion := "2.13.13"
2-
ThisBuild / organization := "dev.usommerl"
3-
ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.6.0"
1+
ThisBuild / scalaVersion := "3.5.2"
2+
ThisBuild / organization := "dev.usommerl"
43

54
ThisBuild / libraryDependencySchemes += "com.softwaremill.sttp.apispec" %% "openapi-model" % "early-semver"
65
ThisBuild / libraryDependencySchemes += "com.softwaremill.sttp.apispec" %% "apispec-model" % "early-semver"
76

87
val v = new {
9-
val apispec = "0.9.0"
10-
val circe = "0.14.6"
11-
val ciris = "3.5.0"
12-
val http4s = "0.23.26"
13-
val odin = "0.13.0"
14-
val tapir = "1.10.5"
15-
val munit = "0.7.29"
16-
val munitCE = "1.0.7"
8+
val apispec = "0.11.3"
9+
val circe = "0.14.10"
10+
val ciris = "3.6.0"
11+
val http4s = "0.23.29"
12+
val odin = "0.14.0"
13+
val tapir = "1.11.9"
14+
val munit = "1.0.2"
15+
val munitCE = "2.0.0"
1716
}
1817

1918
val upx = "UPX_COMPRESSION"
@@ -22,19 +21,17 @@ lazy val graalnative4s = project
2221
.in(file("."))
2322
.enablePlugins(BuildInfoPlugin, sbtdocker.DockerPlugin, GraalVMNativeImagePlugin)
2423
.settings(
25-
scalacOptions ++= Seq("-Xsource:3-cross"),
2624
libraryDependencies ++= Seq(
27-
compilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1"),
2825
"com.softwaremill.sttp.apispec" %% "openapi-circe-yaml" % v.apispec,
2926
"com.softwaremill.sttp.tapir" %% "tapir-core" % v.tapir,
3027
"com.softwaremill.sttp.tapir" %% "tapir-http4s-server" % v.tapir,
3128
"com.softwaremill.sttp.tapir" %% "tapir-json-circe" % v.tapir,
3229
"com.softwaremill.sttp.tapir" %% "tapir-openapi-docs" % v.tapir,
3330
"com.softwaremill.sttp.tapir" %% "tapir-refined" % v.tapir,
3431
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui" % v.tapir,
35-
"com.github.valskalla" %% "odin-core" % v.odin,
36-
"com.github.valskalla" %% "odin-json" % v.odin,
37-
"com.github.valskalla" %% "odin-slf4j" % v.odin,
32+
"dev.scalafreaks" %% "odin-core" % v.odin,
33+
"dev.scalafreaks" %% "odin-json" % v.odin,
34+
"dev.scalafreaks" %% "odin-slf4j" % v.odin,
3835
"io.circe" %% "circe-core" % v.circe,
3936
"io.circe" %% "circe-generic" % v.circe,
4037
"io.circe" %% "circe-parser" % v.circe,
@@ -45,7 +42,7 @@ lazy val graalnative4s = project
4542
"org.http4s" %% "http4s-circe" % v.http4s,
4643
"org.http4s" %% "http4s-dsl" % v.http4s,
4744
"org.scalameta" %% "munit" % v.munit % Test,
48-
"org.typelevel" %% "munit-cats-effect-3" % v.munitCE % Test
45+
"org.typelevel" %% "munit-cats-effect" % v.munitCE % Test
4946
),
5047
testFrameworks += new TestFramework("munit.Framework"),
5148
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion, Test / libraryDependencies),

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.9.9
1+
sbt.version=1.10.5

project/plugins.sbt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.0")
2-
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.0.1")
3-
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.2.0")
4-
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.12.0")
5-
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.10.0")
6-
addSbtPlugin("org.typelevel" % "sbt-tpolecat" % "0.5.1")
1+
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.13.0")
2+
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.1.0")
3+
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.3.0")
4+
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.13.1")
5+
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.10.4")
6+
addSbtPlugin("org.typelevel" % "sbt-tpolecat" % "0.5.2")
77
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
8-
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.11")
8+
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.2.2")
99
addSbtPlugin("se.marcuslonnberg" % "sbt-docker" % "1.11.0")

src/main/resources/META-INF/native-image/native-image.properties

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@ Args = --no-fallback \
33
--libc=musl \
44
--enable-http \
55
--enable-https \
6-
--report-unsupported-elements-at-runtime \
76
--initialize-at-build-time=scala.Symbol$ \
87
--install-exit-handlers \
8+
-H:+UnlockExperimentalVMOptions \
99
-H:+ReportExceptionStackTraces \
1010
-H:+ReportUnsupportedElementsAtRuntime \
1111
-H:+PrintClassInitialization \
12-
-H:+StackTrace \
1312
-H:+JNI \
1413
-H:+RemoveSaturatedTypeFlows \
15-
-H:-SpawnIsolates \
1614
-H:-UseServiceLoaderFeature

src/main/resources/META-INF/native-image/reflect-config.json

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
{
99
"name": "eu.timepit.refined.StringInference"
1010
},
11-
{
12-
"name": "eu.timepit.refined.api.Refined"
13-
},
1411
{
1512
"name": "eu.timepit.refined.boolean"
1613
},
@@ -822,69 +819,12 @@
822819
}
823820
]
824821
},
825-
{
826-
"name": "scala.reflect.api.Exprs"
827-
},
828-
{
829-
"name": "scala.reflect.api.JavaUniverse"
830-
},
831-
{
832-
"name": "scala.reflect.api.Mirror"
833-
},
834-
{
835-
"name": "scala.reflect.api.Quasiquotes"
836-
},
837-
{
838-
"name": "scala.reflect.api.TreeCreator"
839-
},
840-
{
841-
"name": "scala.reflect.api.Trees"
842-
},
843-
{
844-
"name": "scala.reflect.api.TypeCreator"
845-
},
846-
{
847-
"name": "scala.reflect.api.TypeTags"
848-
},
849-
{
850-
"name": "scala.reflect.api.Universe"
851-
},
852-
{
853-
"name": "scala.reflect.api.package"
854-
},
855-
{
856-
"name": "scala.reflect.internal.Symbols$Symbol[]"
857-
},
858-
{
859-
"name": "scala.reflect.internal.Types$Type[]"
860-
},
861-
{
862-
"name": "scala.reflect.internal.annotations.package"
863-
},
864-
{
865-
"name": "scala.reflect.internal.annotations.uncheckedBounds"
866-
},
867-
{
868-
"name": "scala.reflect.macros.blackbox.Context"
869-
},
870822
{
871823
"name": "scala.reflect.macros.internal.macroImpl"
872824
},
873-
{
874-
"name": "scala.reflect.macros.package"
875-
},
876-
{
877-
"name": "scala.reflect.macros.whitebox.Context"
878-
},
879825
{
880826
"name": "scala.reflect.package"
881827
},
882-
{
883-
"name": "scala.reflect.runtime.JavaMirrors$JavaMirror$JavaAnnotationProxy[]"
884-
},
885-
{
886-
"name": "scala.reflect.runtime.package"
887-
},
888828
{
889829
"name": "scala.runtime.AbstractFunction0"
890830
},

src/main/scala/app/Api.scala

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
package app
22

3-
import cats.Applicative
43
import cats.data.Kleisli
54
import cats.effect.kernel.Async
6-
import cats.implicits._
5+
import cats.syntax.all.*
76
import dev.usommerl.BuildInfo
87
import eu.timepit.refined.api.Refined
9-
import eu.timepit.refined.auto._
10-
import eu.timepit.refined.collection._
11-
import io.circe.generic.auto._
8+
import eu.timepit.refined.collection.*
9+
import io.circe.generic.auto.*
1210
import org.http4s.{HttpRoutes, Request, Response}
1311
import org.http4s.dsl.Http4sDsl
1412
import org.http4s.headers.Location
15-
import org.http4s.implicits._
13+
import org.http4s.implicits.*
1614
import org.http4s.server.middleware.CORS
1715
import sttp.model.StatusCode
1816
import sttp.apispec.openapi.OpenAPI
1917
import sttp.apispec.Tag
2018
import sttp.apispec.openapi.Info as OpenApiInfo
2119
import sttp.apispec.openapi.Server
22-
import sttp.apispec.openapi.circe.yaml._
23-
import sttp.tapir._
24-
import sttp.tapir.codec.refined._
25-
import sttp.tapir.docs.openapi._
26-
import sttp.tapir.generic.auto._
20+
import sttp.apispec.openapi.circe.yaml.*
21+
import sttp.tapir.*
22+
import sttp.tapir.codec.refined.*
23+
import sttp.tapir.docs.openapi.*
24+
import sttp.tapir.generic.auto.*
2725
import sttp.tapir.json.circe.jsonBody
2826
import sttp.tapir.server.ServerEndpoint
2927
import sttp.tapir.server.http4s.Http4sServerInterpreter
@@ -39,7 +37,7 @@ object Api {
3937

4038
val docs: OpenAPI = OpenAPIDocsInterpreter()
4139
.toOpenAPI(apis.flatMap(_.endpoints), OpenApiInfo(BuildInfo.name, BuildInfo.version, description = config.description))
42-
.servers(List(Server(config.serverUrl)))
40+
.servers(List(Server(config.server.toString)))
4341
.tags(apis.map(_.tag))
4442

4543
val swaggerUi: HttpRoutes[F] = Http4sServerInterpreter().toRoutes(SwaggerUI[F](docs.toYaml))
@@ -51,7 +49,7 @@ object Api {
5149
}
5250

5351
object Examples {
54-
def apply[F[_]: Async]()(implicit F: Applicative[F]) = new TapirApi[F] {
52+
def apply[F[_]: Async]() = new TapirApi[F] {
5553
override val tag: Tag = Tag("Getting started", None)
5654
override lazy val serverEndpoints: List[ServerEndpoint[Any, F]] = List(info, hello)
5755
type NonEmptyString = String Refined NonEmpty
@@ -64,17 +62,15 @@ object Examples {
6462
.out(jsonBody[Info])
6563
.errorOut(statusCode)
6664
.serverLogic(_ =>
67-
F.pure(
68-
Info(
69-
BuildInfo.name,
70-
BuildInfo.version,
71-
System.getProperty("java.vm.version"),
72-
BuildInfo.scalaVersion,
73-
BuildInfo.sbtVersion,
74-
BuildInfo.builtAtString,
75-
BuildInfo.test_libraryDependencies.sorted
76-
).asRight
77-
)
65+
Info(
66+
BuildInfo.name,
67+
BuildInfo.version,
68+
System.getProperty("java.vm.version"),
69+
BuildInfo.scalaVersion,
70+
BuildInfo.sbtVersion,
71+
BuildInfo.builtAtString,
72+
BuildInfo.test_libraryDependencies.sorted
73+
).asRight.pure
7874
)
7975

8076
private val hello: ServerEndpoint.Full[Unit, Unit, Option[NonEmptyString], StatusCode, String, Any, F] =
@@ -85,7 +81,7 @@ object Examples {
8581
.in(query[Option[NonEmptyString]]("name").description("Optional name to greet"))
8682
.out(stringBody)
8783
.errorOut(statusCode)
88-
.serverLogic(name => F.pure(s"Hello ${name.getOrElse("World")}!".asRight))
84+
.serverLogic(name => s"Hello ${name.getOrElse("World")}!".asRight.pure)
8985

9086
case class Info(
9187
name: String,
@@ -102,6 +98,6 @@ object Examples {
10298
abstract class TapirApi[F[_]: Async] {
10399
def tag: Tag
104100
def serverEndpoints: List[ServerEndpoint[Any, F]]
105-
def endpoints: List[Endpoint[_, _, _, _, _]] = serverEndpoints.map(_.endpoint)
101+
def endpoints: List[Endpoint[?, ?, ?, ?, ?]] = serverEndpoints.map(_.endpoint)
106102
def routes: HttpRoutes[F] = Http4sServerInterpreter().toRoutes(serverEndpoints)
107103
}

0 commit comments

Comments
 (0)