Skip to content

Commit

Permalink
Merge branch 'release/0.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
usommerl committed Jan 17, 2022
2 parents 8b8caec + 2bd38ac commit 6c4d5b6
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 43 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2.4.0
- name: Set up JDK
uses: actions/setup-java@v2
with:
Expand All @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2.4.0
- name: Create GitHub release draft
uses: release-drafter/release-drafter@v5
env:
Expand All @@ -34,14 +34,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2.4.0
- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 11
- name: Login to GitHub Container Registry
uses: docker/login-action@v1.10.0
uses: docker/login-action@v1.12.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
Expand All @@ -52,16 +52,16 @@ jobs:
run: sbt ';docker;dockerPush'
- name: Remove image with UPX compressed executable
run: docker rmi $(docker images -q 'ghcr.io/usommerl/graalnative4s*upx*')
- name: Tag remaining image for gcr.io
- name: Tag remaining image for Google Container Registry
run: |
export IMAGE_GHCR=$(docker images ghcr.io/usommerl/graalnative4s --format "{{.Repository}}:{{.Tag}}")
export IMAGE_GCR=$(echo $IMAGE_GHCR | sed 's/ghcr.io\/usommerl/eu.gcr.io\/usommerl-02/')
docker tag $IMAGE_GHCR $IMAGE_GCR
echo "image_gcr=$IMAGE_GCR" >> $GITHUB_ENV
- name: Login to Google Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v1.12.0
with:
registry: gcr.io
registry: eu.gcr.io
username: _json_key
password: ${{ secrets.GCP_SA_KEY_JSON }}
- name: Push image to Google Container Registry
Expand Down
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.0.3"
version = "3.3.1"

maxColumn = 140
align.preset = most
Expand Down
21 changes: 9 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/graalvm/graalvm-ce:java11-21.2.0 as builder
FROM ghcr.io/graalvm/graalvm-ce:java11-21.3.0 as builder

ARG upx_compression
ARG print_reports
Expand All @@ -9,22 +9,19 @@ RUN curl -L https://www.scala-sbt.org/sbt-rpm.repo | tee /etc/yum.repos.d/sbt-rp
# See:
# - https://github.com/oracle/graal/issues/2824#issuecomment-685159371
# - https://github.com/oracle/graal/blob/vm-20.3.0/substratevm/StaticImages.md
ARG RESULT_LIB="/staticlibs"
ARG TOOLCHAIN_DIR="/toolchain"

RUN mkdir ${RESULT_LIB} && \
curl -L -o musl.tar.gz https://musl.libc.org/releases/musl-1.2.2.tar.gz && \
mkdir musl && tar -xvzf musl.tar.gz -C musl --strip-components 1 && cd musl && \
./configure --disable-shared --prefix=${RESULT_LIB} && \
make && make install && \
cd / && rm -rf /muscl && rm -f /musl.tar.gz && \
cp /usr/lib/gcc/x86_64-redhat-linux/8/libstdc++.a ${RESULT_LIB}/lib/
RUN mkdir ${TOOLCHAIN_DIR} && \
curl -L -o musl.tar.gz https://more.musl.cc/10.2.1/x86_64-linux-musl/x86_64-linux-musl-native.tgz && \
tar -xvzf musl.tar.gz -C ${TOOLCHAIN_DIR} --strip-components 1 && \
rm -f /musl.tar.gz

ENV PATH="$PATH:${RESULT_LIB}/bin"
ENV CC="musl-gcc"
ENV PATH="$PATH:${TOOLCHAIN_DIR}/bin"
ENV CC="${TOOLCHAIN_DIR}/bin/gcc"

RUN curl -L -o zlib.tar.gz https://zlib.net/zlib-1.2.11.tar.gz && \
mkdir zlib && tar -xvzf zlib.tar.gz -C zlib --strip-components 1 && cd zlib && \
./configure --static --prefix=${RESULT_LIB} && \
./configure --static --prefix=${TOOLCHAIN_DIR} && \
make && make install && \
cd / && rm -rf /zlib && rm -f /zlib.tar.gz
#END INSTALL PRE-REQUISITES FOR STATIC NATIVE IMAGES WITH GRAAL >= 20.2.0
Expand Down
14 changes: 7 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
ThisBuild / scalaVersion := "2.13.6"
ThisBuild / scalaVersion := "2.13.8"
ThisBuild / organization := "dev.usommerl"
ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.5.0"
ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.6.0"

val v = new {
val circe = "0.14.1"
val ciris = "2.1.1"
val http4s = "0.23.3"
val odin = "0.12.0"
val tapir = "0.19.0-M8"
val ciris = "2.3.2"
val http4s = "0.23.7"
val odin = "0.13.0"
val tapir = "0.19.3"
val munit = "0.7.29"
val munitCE = "1.0.5"
val munitCE = "1.0.7"
}

val upx = "UPX_COMPRESSION"
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.5.5
sbt.version=1.6.1
10 changes: 5 additions & 5 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.30")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.34")
addSbtPlugin("com.alejandrohdezma" % "sbt-codecov" % "0.2.1")
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.1.0")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.7")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.20")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.8.2")
addSbtPlugin("se.marcuslonnberg" % "sbt-docker" % "1.8.2")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3")
addSbtPlugin("se.marcuslonnberg" % "sbt-docker" % "1.8.3")
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Args = --verbose \
--libc=musl \
--enable-http \
--enable-https \
--enable-all-security-services \
--report-unsupported-elements-at-runtime \
--initialize-at-build-time=scala.Symbol$ \
--allow-incomplete-classpath \
Expand Down
17 changes: 8 additions & 9 deletions src/main/scala/app/Api.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ object Api {
.servers(List(Server(config.serverUrl)))
.tags(apis.map(_.tag))

val swaggerUi = Http4sServerInterpreter().toRoutes(SwaggerUI[F](docs.toYaml))
val redirectRootToDocs = HttpRoutes.of[F] { case path @ GET -> Root => PermanentRedirect(Location(path.uri / "docs")) }

val routes: List[HttpRoutes[F]] = apis.map(_.routes) ++ List(swaggerUi, redirectRootToDocs)
val swaggerUi: HttpRoutes[F] = Http4sServerInterpreter().toRoutes(SwaggerUI[F](docs.toYaml))
val redirectRootToDocs: HttpRoutes[F] = HttpRoutes.of[F] { case path @ GET -> Root => PermanentRedirect(Location(path.uri / "docs")) }
val routes: List[HttpRoutes[F]] = apis.map(_.routes) ++ List(swaggerUi, redirectRootToDocs)

CORS.policy(routes.reduce(_ <+> _)).orNotFound
}
Expand All @@ -55,7 +54,7 @@ object Examples {
override lazy val serverEndpoints = List(info, hello)
type NonEmptyString = String Refined NonEmpty

private val info: ServerEndpoint[Unit, StatusCode, Info, Any, F] =
private val info: ServerEndpoint.Full[Unit, Unit, Unit, StatusCode, Info, Any, F] =
endpoint.get
.summary("Fetch general information about the application")
.tag(tag.name)
Expand All @@ -76,7 +75,7 @@ object Examples {
)
)

private val hello: ServerEndpoint[Option[NonEmptyString], StatusCode, String, Any, F] =
private val hello: ServerEndpoint.Full[Unit, Unit, Option[NonEmptyString], StatusCode, String, Any, F] =
endpoint.get
.summary("The infamous hello world endpoint")
.tag(tag.name)
Expand All @@ -100,7 +99,7 @@ object Examples {

abstract class TapirApi[F[_]: Async] {
def tag: Tag
def serverEndpoints: List[ServerEndpoint[_, _, _, Any, F]]
def endpoints: List[Endpoint[_, _, _, _]] = serverEndpoints.map(_.endpoint)
def routes: HttpRoutes[F] = Http4sServerInterpreter().toRoutes(serverEndpoints)
def serverEndpoints: List[ServerEndpoint[Any, F]]
def endpoints: List[Endpoint[_, _, _, _, _]] = serverEndpoints.map(_.endpoint)
def routes: HttpRoutes[F] = Http4sServerInterpreter().toRoutes(serverEndpoints)
}

0 comments on commit 6c4d5b6

Please sign in to comment.