Skip to content

Commit

Permalink
Github actions update (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
landlockedsurfer authored Jan 30, 2021
1 parent 500fdff commit 95b7871
Show file tree
Hide file tree
Showing 14 changed files with 436 additions and 16 deletions.
33 changes: 33 additions & 0 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
rules = [
Disable
DisableSyntax
ExplicitResultTypes
LeakingImplicitClassVal
NoAutoTupling
NoValInForComprehension
OrganizeImports
ProcedureSyntax
RemoveUnused
]

Disable {
ifSynthetic = [
"scala/Option.option2Iterable"
"scala/Predef.any2stringadd"
]
}

OrganizeImports {
expandRelative = true
groupedImports = Merge
groups = [
"re:javax?\\.",
"scala.",
"*",
"zio."
]
}

RemoveUnused {
imports = false // handled by OrganizeImports
}
27 changes: 24 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ inThisBuild(

ThisBuild / publishTo := sonatypePublishToBundle.value

addCommandAlias("fmt", "all scalafmtSbt scalafmt test:scalafmt")
addCommandAlias("check", "all scalafmtSbtCheck scalafmtCheck test:scalafmtCheck")
addCommandAlias("testRelease", ";set every isSnapshot := false;+clean;+compile")
addCommandAlias("prepare", "fix; fmt")
addCommandAlias("fmt", "all scalafmtSbt scalafmtAll")
addCommandAlias("fmtCheck", "all scalafmtSbtCheck scalafmtCheckAll")
addCommandAlias("fix", "scalafixAll")
addCommandAlias("fixCheck", "scalafixAll --check")

lazy val root = project
.in(file("."))
Expand All @@ -60,3 +62,22 @@ lazy val core = project
"org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided
)
)

lazy val docs = project
.in(file("zio-schema-docs"))
.settings(
skip.in(publish) := true,
moduleName := "zio-schema-docs",
scalacOptions -= "-Yno-imports",
scalacOptions -= "-Xfatal-warnings",
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % zioVersion
),
unidocProjectFilter in (ScalaUnidoc, unidoc) := inProjects(root),
target in (ScalaUnidoc, unidoc) := (baseDirectory in LocalRootProject).value / "website" / "static" / "api",
cleanFiles += (target in (ScalaUnidoc, unidoc)).value,
docusaurusCreateSite := docusaurusCreateSite.dependsOn(unidoc in Compile).value,
docusaurusPublishGhpages := docusaurusPublishGhpages.dependsOn(unidoc in Compile).value
)
.dependsOn(root)
.enablePlugins(MdocPlugin, DocusaurusPlugin, ScalaUnidocPlugin)
1 change: 0 additions & 1 deletion core/src/main/scala/zio/schema/codec/Codec.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package zio.schema.codec

import zio.schema._

import zio.stream.ZTransducer

trait Codec {
Expand Down
7 changes: 4 additions & 3 deletions core/src/main/scala/zio/schema/codec/ProtobufCodec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import java.nio.charset.StandardCharsets
import java.nio.{ ByteBuffer, ByteOrder }
import java.time._

import zio.stream.ZTransducer
import zio.schema._
import zio.stream.ZTransducer
import zio.{ Chunk, ZIO }

object ProtobufCodec extends Codec {
Expand Down Expand Up @@ -612,8 +612,9 @@ object ProtobufCodec extends Codec {
case _: Schema.Enumeration => None
case Schema.Transform(codec, f, _) => defaultValue(codec).flatMap(f(_).toOption)
case Schema.Primitive(standardType) => defaultValue(standardType)
case Schema.Tuple(left, right) => defaultValue(left).zip(defaultValue(right)).headOption
case _: Schema.Optional[_] => Some(None)
case Schema.Tuple(left, right) =>
if (defaultValue(left).isEmpty || defaultValue(right).isEmpty) None else Some((left, right))
case _: Schema.Optional[_] => Some(None)
}

private def defaultValue(standardType: StandardType[_]): Option[Any] = standardType match {
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/zio/schema/macros.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package zio.schema

import magnolia._

import scala.language.experimental.macros

import magnolia._

object DeriveSchema {

type Typeclass[A] = Schema[A]
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/scala/zio/schema/DeriveSchemaSpec.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package zio.schema

import zio.Chunk
import zio.test.{ DefaultRunnableSpec, assert, suite, test }
import zio.schema.SchemaAssertions.hasSameSchema
import zio.test.{ DefaultRunnableSpec, ZSpec, assert, suite, test }

object DeriveSchemaSpec extends DefaultRunnableSpec {

Expand All @@ -14,7 +14,7 @@ object DeriveSchemaSpec extends DefaultRunnableSpec {
extends Status
case object Pending extends Status

override def spec = suite("DeriveSchemaSpec")(
override def spec: ZSpec[Environment, Failure] = suite("DeriveSchemaSpec")(
test("DeriveSchema correctly derives schema for UserId case class") {

val userIdSchema: Schema[UserId] = DeriveSchema.gen
Expand Down
6 changes: 3 additions & 3 deletions core/src/test/scala/zio/schema/codec/ProtobufCodecSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import java.time.{
ZonedDateTime
}

import scala.util.Try

import zio.Chunk
import zio.schema.Schema.Primitive
import zio.schema.{ Schema, StandardType }
import zio.stream.{ ZSink, ZStream }
import zio.test.Assertion._
import zio.test._
import zio.schema.{ Schema, StandardType }

import scala.util.Try

// TODO: use generators instead of manual encode/decode
object ProtobufCodecSpec extends DefaultRunnableSpec {
Expand Down
46 changes: 46 additions & 0 deletions docs/about/code_of_conduct.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
id: about_coc
title: "ZIO Code of Conduct"
---

We are committed to providing a friendly, safe and welcoming
environment for all, regardless of level of experience, gender, gender
identity and expression, sexual orientation, disability, personal
appearance, body size, race, ethnicity, age, religion, nationality, or
other such characteristics.

The ZIO project follows the [Scala Code of Conduct](https://www.scala-lang.org/conduct/), with
an additional clause regarding moderation that is detailed below. All participants, contributors and
members are expected to follow the Scala Code of Conduct when discussing the project on the available
communication channels. If you are being harassed, please contact us immediately so that we can support you.

## Moderation and Steering Committee

The ZIO project is moderated by the Steering Committee team members:

- Itamar Ravid [@iravid](https://github.com/iravid)
- John De Goes [@jdegoes](https://github.com/jdegoes)
- Kai [@neko-kai](https://github.com/neko-kai)
- Paul Shirshov [@pshirshov](https://github.com/pshirshov)
- Pierre Ricadat [@ghostdogpr](https://github.com/ghostdogpr)
- Salar Rahmanian [@softinio](https://github.com/softinio)
- Wiem Zine El Abidine [@wi101](https://github.com/wi101)

The ZIO project requires that drastic moderation actions detailed in the code of
conduct - for example, removing a user from the Gitter channel - be agreed upon
a group of over 2/3rds of the steering committee.

For any questions, concerns, or moderation requests please contact any member of
the project, or the people listed above.

## BDFL

In addition to the above, the ZIO project's BDFL (benevolent dictator for life) is
John De Goes (@jdegoes), owing to his original founding of the project and continued
investments in it. While John adheres to the same code of conduct as everyone else,
he is entitled to override moderation decisions made by the steering committee.

We do not take the BDFL position lightly, especially with regards to moderation. John
has consistently shown he is level-headed and able to handle conflict responsibly. Feel
free to reach out to any member of the steering committee, including John himself,
with any concern you might have.
Loading

0 comments on commit 95b7871

Please sign in to comment.