Skip to content

Commit

Permalink
Update ZIO and enable native multi-threading (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyri-petrou authored Aug 25, 2024
1 parent 3940d29 commit 3a3f1ca
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 55 deletions.
26 changes: 6 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ jobs:
name: Build
runs-on: ubuntu-latest
continue-on-error: true
env:
CI_RELEASE_MODE: '1'
steps:
- name: Git Checkout
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Install libuv
run: sudo apt-get update && sudo apt-get install -y libuv1-dev
- name: Setup Scala
uses: actions/setup-java@v4
with:
Expand All @@ -39,15 +39,13 @@ jobs:
- name: Cache Dependencies
uses: coursier/cache-action@v6
- name: Check all code compiles
run: sbt +Test/compile
run: sbt --client +Test/compile
- name: Check artifacts build process
run: sbt +publishLocal
run: sbt --client +publishLocal
- name: Check binary compatibility
run: sbt "+zioQueryJVM/mimaReportBinaryIssues; +zioQueryJS/mimaReportBinaryIssues"
env:
CI_RELEASE_MODE: '1'
run: sbt --client "+zioQueryJVM/mimaReportBinaryIssues; +zioQueryJS/mimaReportBinaryIssues"
- name: Check website build process
run: sbt docs/clean; sbt docs/buildWebsite
run: sbt --client "docs/buildWebsite"
lint:
name: Lint
runs-on: ubuntu-latest
Expand All @@ -57,8 +55,6 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Install libuv
run: sudo apt-get update && sudo apt-get install -y libuv1-dev
- name: Setup Scala
uses: actions/setup-java@v4
with:
Expand All @@ -67,8 +63,6 @@ jobs:
check-latest: true
- name: Cache Dependencies
uses: coursier/cache-action@v6
- name: Check if the site workflow is up to date
run: sbt ciCheckGithubWorkflow
- name: Lint
run: sbt lint
test:
Expand All @@ -90,8 +84,6 @@ jobs:
- ++2.13 zioQueryNative
- ++3.3 zioQueryNative
steps:
- name: Install libuv
run: sudo apt-get update && sudo apt-get install -y libuv1-dev
- name: Setup Scala
uses: actions/setup-java@v4
with:
Expand All @@ -116,8 +108,6 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Install libuv
run: sudo apt-get update && sudo apt-get install -y libuv1-dev
- name: Setup Scala
uses: actions/setup-java@v4
with:
Expand Down Expand Up @@ -190,8 +180,6 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Install libuv
run: sudo apt-get update && sudo apt-get install -y libuv1-dev
- name: Setup Scala
uses: actions/setup-java@v4
with:
Expand Down Expand Up @@ -220,8 +208,6 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Install libuv
run: sudo apt-get update && sudo apt-get install -y libuv1-dev
- name: Setup Scala
uses: actions/setup-java@v4
with:
Expand Down
41 changes: 9 additions & 32 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import com.typesafe.tools.mima.core.*
import explicitdeps.ExplicitDepsPlugin.autoImport.moduleFilterRemoveValue
import sbtcrossproject.CrossPlugin.autoImport.crossProject
import zio.sbt.githubactions.*

import scala.collection.immutable.TreeMap
import scala.scalanative.build.Mode

enablePlugins(ZioSbtEcosystemPlugin, ZioSbtCiPlugin)
enablePlugins(ZioSbtEcosystemPlugin)

crossScalaVersions := Seq.empty

Expand All @@ -19,7 +18,7 @@ lazy val allScalas = List("2.12", "2.13", "3.3")
inThisBuild(
List(
name := "ZIO Query",
zioVersion := "2.1.7",
zioVersion := "2.1.8",
scalaVersion := scalaV,
developers := List(
Developer(
Expand All @@ -29,26 +28,6 @@ inThisBuild(
url("https://github.com/kyri-petrou")
)
),
ciEnabledBranches := Seq("series/2.x"),
ciTargetJavaVersions := List("11", "21"),
ciTargetScalaVersions :=
Map(
(zioQueryJVM / thisProject).value.id -> allScalas,
(zioQueryJS / thisProject).value.id -> List("2.13", "3.3"),
(zioQueryNative / thisProject).value.id -> List("2.13", "3.3")
),
ciReleaseJobs :=
ciReleaseJobs.value.map { job =>
def mapStep(step: Step): Step = step match {
case Step.StepSequence(steps) => Step.StepSequence(steps.map(mapStep))
case s: Step.SingleStep if s.name.equalsIgnoreCase("Release") =>
val newMap = TreeMap.empty[String, String] ++ s.env.updated(ciReleaseModeKey, "1")
s.copy(env = newMap)
case s => s
}
val steps = job.steps.map(mapStep)
job.copy(steps = steps)
},
versionScheme := Some("early-semver")
)
)
Expand Down Expand Up @@ -114,7 +93,12 @@ lazy val zioQueryJS = zioQuery.js
lazy val zioQueryNative = zioQuery.native
.settings(
scala3Settings,
nativeConfig ~= { _.withMultithreading(false) }
nativeConfig ~= { cfg =>
val os = System.getProperty("os.name").toLowerCase
// See https://github.com/zio/zio/releases/tag/v2.1.8
if (os.contains("mac")) cfg.withMode(Mode.releaseFast)
else cfg
}
)

lazy val zioQueryJVM = zioQuery.jvm.settings(enableMimaSettingsJVM)
Expand Down Expand Up @@ -161,13 +145,6 @@ lazy val enableMimaSettingsJS =
mimaBinaryIssueFilters ++= Seq()
)

ThisBuild / ciCheckArtifactsBuildSteps +=
Step.SingleStep(
"Check binary compatibility",
env = Map(ciReleaseModeKey -> "1"),
run = Some("sbt \"+zioQueryJVM/mimaReportBinaryIssues; +zioQueryJS/mimaReportBinaryIssues\"")
)

lazy val ciReleaseModeKey = "CI_RELEASE_MODE"

lazy val isRelease = {
Expand Down
3 changes: 1 addition & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ val zioSbtVersion = "0.4.0-alpha.28"

addSbtPlugin("dev.zio" % "zio-sbt-ecosystem" % zioSbtVersion)
addSbtPlugin("dev.zio" % "zio-sbt-website" % zioSbtVersion)
addSbtPlugin("dev.zio" % "zio-sbt-ci" % zioSbtVersion)

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.1.0")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.4")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.12.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.4")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.5")

resolvers ++= Resolver.sonatypeOssRepos("public")
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import zio.test._

trait ZIOBaseSpec extends ZIOSpecDefault {
override def aspects: Chunk[TestAspectPoly] =
if (TestPlatform.isJVM) Chunk(TestAspect.timeout(60.seconds), TestAspect.timed)
if (TestPlatform.isJVM || TestPlatform.isNative) Chunk(TestAspect.timeout(60.seconds), TestAspect.timed)
else Chunk(TestAspect.timeout(60.seconds), TestAspect.sequential, TestAspect.timed)
}

0 comments on commit 3a3f1ca

Please sign in to comment.