Skip to content

Commit

Permalink
Merge branch 'main' into update/munit-cats-effect-3-2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
armanbilge committed Sep 11, 2024
2 parents a267001 + 3a1c304 commit 4cea824
Show file tree
Hide file tree
Showing 17 changed files with 846 additions and 71 deletions.
77 changes: 22 additions & 55 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,13 @@ jobs:
matrix:
os: [ubuntu-latest]
scala: [2.12, 3, 2.13]
java: [corretto@8, corretto@11, corretto@17]
java: [corretto@11, corretto@17]
project: [rootJS, rootJVM, rootSbtScalafix]
exclude:
- scala: 2.12
java: corretto@11
- scala: 2.12
java: corretto@17
- scala: 3
java: corretto@11
- scala: 3
java: corretto@17
- project: rootJS
java: corretto@11
- project: rootJS
java: corretto@17
- project: rootJS
Expand All @@ -55,24 +49,15 @@ jobs:
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- name: Install sbt
if: contains(runner.os, 'macos')
run: brew install sbt

- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Java (corretto@8)
id: setup-java-corretto-8
if: matrix.java == 'corretto@8'
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 8
cache: sbt

- name: sbt update
if: matrix.java == 'corretto@8' && steps.setup-java-corretto-8.outputs.cache-hit == 'false'
run: sbt +update

- name: Setup Java (corretto@11)
id: setup-java-corretto-11
if: matrix.java == 'corretto@11'
Expand Down Expand Up @@ -109,11 +94,11 @@ jobs:
run: sbt githubWorkflowCheck

- name: Check headers and formatting
if: matrix.java == 'corretto@8' && matrix.os == 'ubuntu-latest'
if: matrix.java == 'corretto@11' && matrix.os == 'ubuntu-latest'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck

- name: Check scalafix lints
if: matrix.java == 'corretto@8' && matrix.os == 'ubuntu-latest'
if: matrix.java == 'corretto@11' && matrix.os == 'ubuntu-latest'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' 'scalafixAll --check'

- name: scalaJSLink
Expand All @@ -124,20 +109,20 @@ jobs:
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test

- name: Check binary compatibility
if: matrix.java == 'corretto@8' && matrix.os == 'ubuntu-latest'
if: matrix.java == 'corretto@11' && matrix.os == 'ubuntu-latest'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues

- name: Generate API documentation
if: matrix.java == 'corretto@8' && matrix.os == 'ubuntu-latest'
if: matrix.java == 'corretto@11' && matrix.os == 'ubuntu-latest'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc

- name: Make target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: mkdir -p lambda-cloudformation-custom-resource/.js/target lambda-http4s/.jvm/target unidocs/target lambda-http4s/.js/target lambda/js/target scalafix/rules/target lambda/jvm/target sbt-lambda/target lambda-cloudformation-custom-resource/.jvm/target project/target
run: mkdir -p lambda-cloudformation-custom-resource/.js/target lambda-http4s/.jvm/target unidocs/target lambda-http4s/.js/target lambda/js/target scalafix/rules/target lambda/jvm/target sbt-lambda/target google-cloud-http4s/jvm/target lambda-cloudformation-custom-resource/.jvm/target google-cloud-http4s/js/target project/target

- name: Compress target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: tar cf targets.tar lambda-cloudformation-custom-resource/.js/target lambda-http4s/.jvm/target unidocs/target lambda-http4s/.js/target lambda/js/target scalafix/rules/target lambda/jvm/target sbt-lambda/target lambda-cloudformation-custom-resource/.jvm/target project/target
run: tar cf targets.tar lambda-cloudformation-custom-resource/.js/target lambda-http4s/.jvm/target unidocs/target lambda-http4s/.js/target lambda/js/target scalafix/rules/target lambda/jvm/target sbt-lambda/target google-cloud-http4s/jvm/target lambda-cloudformation-custom-resource/.jvm/target google-cloud-http4s/js/target project/target

- name: Upload target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
Expand All @@ -153,27 +138,18 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
java: [corretto@8]
java: [corretto@11]
runs-on: ${{ matrix.os }}
steps:
- name: Install sbt
if: contains(runner.os, 'macos')
run: brew install sbt

- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Java (corretto@8)
id: setup-java-corretto-8
if: matrix.java == 'corretto@8'
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 8
cache: sbt

- name: sbt update
if: matrix.java == 'corretto@8' && steps.setup-java-corretto-8.outputs.cache-hit == 'false'
run: sbt +update

- name: Setup Java (corretto@11)
id: setup-java-corretto-11
if: matrix.java == 'corretto@11'
Expand Down Expand Up @@ -276,31 +252,22 @@ jobs:

dependency-submission:
name: Submit Dependencies
if: github.event_name != 'pull_request'
if: github.event.repository.fork == false && github.event_name != 'pull_request'
strategy:
matrix:
os: [ubuntu-latest]
java: [corretto@8]
java: [corretto@11]
runs-on: ${{ matrix.os }}
steps:
- name: Install sbt
if: contains(runner.os, 'macos')
run: brew install sbt

- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Java (corretto@8)
id: setup-java-corretto-8
if: matrix.java == 'corretto@8'
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 8
cache: sbt

- name: sbt update
if: matrix.java == 'corretto@8' && steps.setup-java-corretto-8.outputs.cache-hit == 'false'
run: sbt +update

- name: Setup Java (corretto@11)
id: setup-java-corretto-11
if: matrix.java == 'corretto@11'
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.8.1
version = 3.8.3

runner.dialect = Scala213Source3
fileOverride {
Expand Down
62 changes: 50 additions & 12 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ThisBuild / developers := List(
tlGitHubDev("djspiewak", "Daniel Spiewak")
)

ThisBuild / githubWorkflowJavaVersions := Seq("8", "11", "17").map(JavaSpec.corretto(_))
ThisBuild / githubWorkflowJavaVersions := Seq("11", "17").map(JavaSpec.corretto(_))

ThisBuild / githubWorkflowBuildMatrixExclusions ++=
List("rootJS", "rootJVM").map(p => MatrixExclude(Map("project" -> p, "scala" -> "2.12"))) ++
Expand All @@ -51,13 +51,14 @@ val Scala3 = "3.3.3"
ThisBuild / crossScalaVersions := Seq(Scala212, Scala3, Scala213)

val catsEffectVersion = "3.5.4"
val circeVersion = "0.14.7"
val fs2Version = "3.10.2"
val http4sVersion = "0.23.27"
val natchezVersion = "0.3.5"
val circeVersion = "0.14.10"
val fs2Version = "3.11.0"
val http4sVersion = "0.23.27-10-fa6e976-SNAPSHOT"
val natchezVersion = "0.3.6"
val munitScalaCheckVersion = "1.0.0-M12"
val munitCEVersion = "2.0.0"
val scalacheckEffectVersion = "1.0.4"
ThisBuild / resolvers += "s01-oss-sonatype-org-snapshots" at "https://s01.oss.sonatype.org/content/repositories/snapshots"

lazy val commonSettings = Seq(
crossScalaVersions := Seq(Scala3, Scala213)
Expand All @@ -69,6 +70,7 @@ lazy val root =
lambda,
lambdaHttp4s,
lambdaCloudFormationCustomResource,
googleCloudHttp4s,
examples,
unidocs
)
Expand All @@ -91,8 +93,8 @@ lazy val lambda = crossProject(JSPlatform, JVMPlatform)
"org.tpolecat" %%% "natchez-core" % natchezVersion,
"io.circe" %%% "circe-scodec" % circeVersion,
"io.circe" %%% "circe-jawn" % circeVersion,
"com.comcast" %%% "ip4s-core" % "3.5.0",
"org.scodec" %%% "scodec-bits" % "1.2.0",
"com.comcast" %%% "ip4s-core" % "3.6.0",
"org.scodec" %%% "scodec-bits" % "1.2.1",
"org.scalameta" %%% "munit-scalacheck" % munitScalaCheckVersion % Test,
"org.typelevel" %%% "munit-cats-effect" % munitCEVersion % Test,
"io.circe" %%% "circe-literal" % circeVersion % Test
Expand All @@ -105,7 +107,7 @@ lazy val lambda = crossProject(JSPlatform, JVMPlatform)
.jsSettings(
libraryDependencies ++= Seq(
"io.circe" %%% "circe-scalajs" % circeVersion,
"io.github.cquiroz" %%% "scala-java-time" % "2.5.0"
"io.github.cquiroz" %%% "scala-java-time" % "2.6.0"
)
)
.jvmSettings(
Expand Down Expand Up @@ -155,7 +157,7 @@ lazy val lambdaCloudFormationCustomResource = crossProject(JSPlatform, JVMPlatfo
case _ => Nil
}),
libraryDependencies ++= Seq(
"io.monix" %%% "newtypes-core" % "0.2.3",
"io.monix" %%% "newtypes-core" % "0.3.0",
"org.http4s" %%% "http4s-client" % http4sVersion,
"org.http4s" %%% "http4s-circe" % http4sVersion,
"org.http4s" %%% "http4s-dsl" % http4sVersion % Test,
Expand All @@ -171,19 +173,28 @@ lazy val lambdaCloudFormationCustomResource = crossProject(JSPlatform, JVMPlatfo
.dependsOn(lambda)

lazy val examples = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("examples"))
.settings(
libraryDependencies ++= Seq(
"org.http4s" %%% "http4s-dsl" % http4sVersion,
"org.http4s" %%% "http4s-ember-client" % http4sVersion,
"org.tpolecat" %%% "natchez-xray" % natchezVersion,
"org.tpolecat" %%% "natchez-http4s" % "0.5.0",
"org.tpolecat" %%% "natchez-http4s" % "0.6.0",
"org.tpolecat" %%% "skunk-core" % "0.6.4"
)
)
.settings(commonSettings)
.dependsOn(lambda, lambdaHttp4s)
.dependsOn(lambda, lambdaHttp4s, googleCloudHttp4s)
.jsSettings(
scalaJSUseMainModuleInitializer := true,
Compile / mainClass := Some("feral.examples.http4sGoogleCloudHandler"),
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }
)
.jvmSettings(
libraryDependencies ++= Seq(
"com.google.cloud.functions.invoker" % "java-function-invoker" % "1.3.1"
)
)
.enablePlugins(NoPublishPlugin)

lazy val unidocs = project
Expand Down Expand Up @@ -224,3 +235,30 @@ lazy val scalafix = tlScalafixProject
startYear := Some(2023),
crossScalaVersions := Seq(Scala212)
)

lazy val googleCloudHttp4s = crossProject(JSPlatform, JVMPlatform)
.in(file("google-cloud-http4s"))
.settings(
name := "feral-google-cloud-http4s",
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-effect" % catsEffectVersion,
"org.scodec" %%% "scodec-bits" % "1.2.0",
"org.http4s" %%% "http4s-server" % http4sVersion,
"org.scalameta" %%% "munit-scalacheck" % munitVersion % Test,
"org.typelevel" %%% "munit-cats-effect-3" % munitCEVersion % Test
),
tlVersionIntroduced := List("2.13", "3").map(_ -> "0.3.1").toMap
)
.settings(commonSettings)
.jsSettings(
libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % "2.5.0"
)
)
.jvmSettings(
Test / fork := true,
libraryDependencies ++= Seq(
"com.google.cloud.functions" % "functions-framework-api" % "1.1.0" % Provided,
"co.fs2" %%% "fs2-io" % fs2Version
)
)
38 changes: 38 additions & 0 deletions examples/js/src/main/scala/feral/examples/Http4sGoogleCloud.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright 2021 Typelevel
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package feral.examples

import cats.effect._
import feral.googlecloud._
import org.http4s._
import org.http4s.dsl.io._

object http4sGoogleCloudHandler extends IOGoogleCloudHttp {
def handler = {
val app = HttpRoutes
.of[IO] {
case GET -> Root / "hello" / name =>
Ok(s"Hello, $name.")
}
.orNotFound

Resource.pure(app)

/*Resource.pure(HttpApp.pure(Response[IO](Status.Ok)))*/
}

}
38 changes: 38 additions & 0 deletions examples/jvm/src/main/scala/feral/examples/Http4sGoogleCloud.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright 2021 Typelevel
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package feral.examples

import cats.effect._
import feral.googlecloud._
import org.http4s._
import org.http4s.dsl.io._

class http4sGoogleCloudHandler extends IOGoogleCloudHttp {
def handler = {
val app = HttpRoutes
.of[IO] {
case GET -> Root / "hello" / name =>
Ok(s"Hello, $name.")
}
.orNotFound

Resource.pure(app)

/*Resource.pure(HttpApp.pure(Response[IO](Status.Ok)))*/
}

}
Loading

0 comments on commit 4cea824

Please sign in to comment.