Skip to content

Commit

Permalink
Merge branch 'series/0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
armanbilge committed Aug 26, 2022
2 parents 55a2f02 + eae6845 commit 298ba60
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 16 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ jobs:
if: matrix.java == 'temurin@8'
run: 'sbt ''++${{ matrix.scala }}'' ''set Global / useJSEnv := JSEnv.${{ matrix.jsenv }}'' doc'

- name: Monitor artifact size
if: matrix.jsenv == 'Chrome'
run: 'sbt ''++${{ matrix.scala }}'' ''set Global / useJSEnv := JSEnv.${{ matrix.jsenv }}'' artifactSizeTest/bundleMon'

- name: Check scalafix lints
if: matrix.java == 'temurin@8' && !startsWith(matrix.scala, '3.')
run: 'sbt ''++${{ matrix.scala }}'' ''set Global / useJSEnv := JSEnv.${{ matrix.jsenv }}'' ''scalafixAll --check'''
Expand All @@ -106,11 +110,11 @@ jobs:

- name: Make target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: mkdir -p target site/target tests/target dom/target tests-nodejs/target jsdocs/target project/target
run: mkdir -p target site/target tests/target dom/target artifact-size-test/target tests-nodejs/target jsdocs/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 target site/target tests/target dom/target tests-nodejs/target jsdocs/target project/target
run: tar cf targets.tar target site/target tests/target dom/target artifact-size-test/target tests-nodejs/target jsdocs/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 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.5.8
version = 3.5.9

runner.dialect = Scala213Source3

Expand Down
29 changes: 29 additions & 0 deletions artifact-size-test/src/main/scala/Main.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2021 http4s.org
*
* 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.
*/

import cats.effect._
import cats.effect.unsafe.implicits._
import io.circe._
import org.http4s.circe._
import org.http4s.client._
import org.http4s.dom._

object Main {
val client: Client[IO] = FetchClientBuilder[IO].create

def main(args: Array[String]): Unit =
client.expect[Json]("https://api.github.com/repos/http4s/http4s").unsafeRunAndForget()
}
41 changes: 33 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,18 @@ Global / fileServicePort := {
import cats.data.Kleisli
import cats.effect.IO
import cats.effect.unsafe.implicits.global
import com.comcast.ip4s._
import org.http4s._
import org.http4s.dsl.io._
import org.http4s.blaze.server.BlazeServerBuilder
import org.http4s.ember.server.EmberServerBuilder
import org.http4s.server.staticcontent._
import java.net.InetSocketAddress

(for {
deferredPort <- IO.deferred[Int]
_ <- BlazeServerBuilder[IO]
.bindSocketAddress(new InetSocketAddress("localhost", 0))
_ <- EmberServerBuilder
.default[IO]
.withPort(port"0")
.withHttpWebSocketApp { wsb =>
HttpRoutes
.of[IO] {
Expand All @@ -91,7 +93,7 @@ Global / fileServicePort := {
}
.orNotFound
}
.resource
.build
.map(_.address.getPort)
.evalTap(deferredPort.complete(_))
.useForever
Expand Down Expand Up @@ -120,16 +122,18 @@ ThisBuild / Test / jsEnv := {
}
}

val catsEffectVersion = "3.3.13"
val fs2Version = "3.2.9"
val catsEffectVersion = "3.3.14"
val fs2Version = "3.2.12"
val http4sVersion = "1.0.0-M34"
val scalaJSDomVersion = "2.2.0"
val circeVersion = "0.14.2"
val munitVersion = "0.7.29"
val munitCEVersion = "1.0.7"

lazy val root =
project.in(file(".")).aggregate(dom, tests, nodeJSTests).enablePlugins(NoPublishPlugin)
lazy val root = project
.in(file("."))
.aggregate(dom, tests, nodeJSTests, artifactSizeTest)
.enablePlugins(NoPublishPlugin)

lazy val dom = project
.in(file("dom"))
Expand Down Expand Up @@ -194,6 +198,27 @@ lazy val nodeJSTests = project
.dependsOn(dom)
.enablePlugins(ScalaJSPlugin, NoPublishPlugin)

lazy val artifactSizeTest = project
.in(file("artifact-size-test"))
.settings(
scalaJSUseMainModuleInitializer := true,
libraryDependencies ++= Seq(
"org.http4s" %%% "http4s-circe" % http4sVersion
),
bundleMonCheckRun := true,
bundleMonCommitStatus := false,
bundleMonPrComment := false
)
.dependsOn(dom)
.enablePlugins(BundleMonPlugin, NoPublishPlugin)

ThisBuild / githubWorkflowBuild +=
WorkflowStep.Sbt(
List("artifactSizeTest/bundleMon"),
name = Some("Monitor artifact size"),
cond = Some("matrix.jsenv == 'Chrome'")
)

lazy val jsdocs =
project
.dependsOn(dom)
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.6.2
sbt.version=1.7.1
9 changes: 5 additions & 4 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
val http4sVersion = "0.23.13"
val http4sVersion = "0.23.15"

enablePlugins(BuildInfoPlugin)
buildInfoKeys += "http4sVersion" -> http4sVersion

libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "1.1.1"
libraryDependencies += "org.http4s" %% "http4s-dsl" % http4sVersion
libraryDependencies += "org.http4s" %% "http4s-blaze-server" % "0.23.12"
libraryDependencies += "org.http4s" %% "http4s-ember-server" % http4sVersion

addSbtPlugin("org.http4s" % "sbt-http4s-org" % "0.14.3")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.2")
addSbtPlugin("org.http4s" % "sbt-http4s-org" % "0.14.4")
addSbtPlugin("com.armanbilge" % "sbt-bundlemon" % "0.1.3")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.3")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")

0 comments on commit 298ba60

Please sign in to comment.