Skip to content

Commit

Permalink
Polish (#12)
Browse files Browse the repository at this point in the history
* polishing stuff
  • Loading branch information
yisraelU authored Feb 20, 2024
1 parent 0ab28fd commit c133593
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 141 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ jobs:
if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-latest'
run: sbt '++ ${{ matrix.scala }}' scalafmtCheckAll 'project /' scalafmtSbtCheck

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

- name: Test
run: sbt '++ ${{ matrix.scala }}' test

Expand All @@ -67,11 +71,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 modules/codegen-cli/target modules/transformers/target modules/schema/target modules/compliance-tests/target modules/prelude/target modules/http/target project/target
run: mkdir -p target modules/schema/target modules/prelude/target modules/http/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 modules/codegen-cli/target modules/transformers/target modules/schema/target modules/compliance-tests/target modules/prelude/target modules/http/target project/target
run: tar cf targets.tar target modules/schema/target modules/prelude/target modules/http/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
85 changes: 22 additions & 63 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,66 +1,25 @@
#mill
out

# sbt
lib_managed
project/project
target

# Eclipse
.cache*
.classpath
.project
.scala_dependencies
.settings
.target
.worksheet

# IntelliJ
.idea
.idea_modules
*.iml

# ENSIME
.ensime
.ensime_lucene
.ensime_cache

# Mac
.DS_Store

# Akka Persistence
journal
snapshots

# Log files
*.log

#Floobits
.floo

# Local Dynamo DB
dynamodb_lib
*.db

# Node
node_modules
website/translated_docs
website/build/
website/yarn.lock
website/node_modules
website/i18n/*

.bloop
target/
project/plugins/project/
boot/
lib_managed/
src_managed/

# vim
*.sw?

# intellij
.idea/

# ignore [ce]tags files
tags

# metals
.metals/
.bsp/
.bloop/
metals.sbt
.vscode
.history
.metals
project/metals.sbt
.ammonite

# Version file
version

# BSP files
.bsp

.direnv
# npm
node_modules/
15 changes: 4 additions & 11 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
version = "3.1.2"
runner.dialect = scala213
project {
excludePaths = [
"glob:**/core/src/generated/*.scala",
"glob:**/example/src/smithy4s/**/*.scala",
"glob:**/schematic-core/src/generated/*.scala",
"glob:**/schematic-scalacheck/src/generated/*.scala"
]
}

version = 3.7.1
runner.dialect = scala213source3
docstrings.style = keep

fileOverride {
"glob:**/src-3/**.scala" {
"glob:**/scala-3/**" {
runner.dialect = scala3
}
}
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
## notes

## Published Modules
- ZIO Http
- ZIO Http Client and Server implementations for the [`alloy#simpleRestJsonProtocol`](https://github.com/disneystreaming/alloy)
- an opinionated rest-like protocol using json over http
- ZIO Prelude
- Automatic derivation of the following Typeclasses for Smithy4s generated schemas
- Debug
- Hash
- Equals
- ZIO Schema for automatic derivation of ZIO Schema for Smithy Models
- ZIO Http
- ZIO Http Client and Server implementations for the [`alloy#simpleRestJsonProtocol`](https://github.com/disneystreaming/alloy)
- an opinionated rest-like protocol using json over http


## Usage of ZIO Http Smithy4s integration
- see example client and server in `example` module
Expand Down
20 changes: 9 additions & 11 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,9 @@ import sys.process.*
import scala.collection.Seq

Global / onChangedBuildSource := ReloadOnSourceChanges
ThisBuild / tlCiHeaderCheck := false
ThisBuild / tlFatalWarnings := false
ThisBuild / tlCiMimaBinaryIssueCheck := false
ThisBuild / tlBaseVersion := "0.0"
ThisBuild / tlCiReleaseBranches := Seq("main")
ThisBuild / sonatypeProfileName := "io.github.yisraelu"
ThisBuild / scalaVersion := "2.13.12"
ThisBuild / tlJdkRelease := Some(11)
ThisBuild / tlCiDependencyGraphJob := false
val Scala213 = "2.13.12"
ThisBuild / scalaVersion := Scala213 // the default Scala

addCommandAlias(
"fmt",
";scalafmtAll;scalafmtSbt;"
Expand All @@ -27,7 +21,9 @@ addCompilerPlugin(
val complianceTestDependencies =
SettingKey[Seq[ModuleID]]("complianceTestDependencies")
val projectPrefix = "smithy4s-zio"

/*lazy val docs =
project.in(file("modules/site")).enablePlugins(TypelevelSitePlugin)
*/
lazy val root = project
.in(file("."))
.aggregate(allModules: _*)
Expand All @@ -51,6 +47,7 @@ lazy val `codegen-cli` = (project in file("modules/codegen-cli"))
Dependencies.Smithy4s.`codegen-cli`.value
)
)
.enablePlugins(NoPublishPlugin)

lazy val prelude = (project in file("modules/prelude"))
.settings(
Expand Down Expand Up @@ -100,7 +97,7 @@ lazy val `compliance-tests` = (project in file("modules/compliance-tests"))
Compile / smithy4sAllowedNamespaces := List("smithy.test"),
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
)
.enablePlugins(Smithy4sCodegenPlugin)
.enablePlugins(Smithy4sCodegenPlugin, NoPublishPlugin)

lazy val http = (project in file("modules/http"))
.dependsOn(
Expand Down Expand Up @@ -184,6 +181,7 @@ lazy val transformers = (project in file("modules/transformers"))
),
Compile / resourceDirectory := sourceDirectory.value / "resources"
)
.enablePlugins(NoPublishPlugin)

def dumpModel(config: Configuration): Def.Initialize[Task[Seq[File]]] =
Def.task {
Expand Down
25 changes: 25 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Smithy4s-ZIO

- A few small libs based off the great [Smithy4s](https://disneystreaming.github.io/smithy4s/) to enable integration with ZIO ecosystem.
#### Keep in mind this is WIP


## notes
- This doc assumes understanding of Smithy and Smithy4s. For all questions related to Smithy4s and the core concepts please see the Smithy4s documentation [here](https://disneystreaming.github.io/smithy4s/) and the [Smithy](https://awslabs.github.io/smithy/) documentation.


### Usage

This library is currently available for Scala binary versions 2.13 and 3.1.

To use the latest version, include the following in your `build.sbt`:

```scala
libraryDependencies ++= Seq(
"io.github.yisraelu" %% "quickstart" % "@VERSION@"
)
```


### Quickstart (borrows from Smithy4s example)
-
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ object asserts {
assertTrue(result.contains(expected))
.??(
s"$prefix the result value: ${pprint.apply(result)} contains the expected TestCase value ${pprint
.apply(expected)}."
.apply(expected)}."
)

}
Expand Down Expand Up @@ -100,7 +100,7 @@ object asserts {
): ComplianceResult = {
assertTrue(result === testCase).??(
s"$prefix the result value: ${pprint.apply(result)} is equal to the expected TestCase value ${pprint
.apply(testCase)}."
.apply(testCase)}."
)
}

Expand Down Expand Up @@ -202,15 +202,19 @@ object asserts {

expected
.map {
_.toList.collect { case (key, value) =>
headers.get(key) match {
case Some(v) if v == value => success
case Some(v) =>
asserts.fail(s"Header $key has value `$v` but expected `$value`")
case None =>
fail(s"Header $key is missing in the request.")
_.toList
.collect { case (key, value) =>
headers.get(key) match {
case Some(v) if v == value => success
case Some(v) =>
asserts.fail(
s"Header $key has value `$v` but expected `$value`"
)
case None =>
fail(s"Header $key is missing in the request.")
}
}
}.combineAll
.combineAll
}
.getOrElse {
success
Expand Down
9 changes: 0 additions & 9 deletions project/BuildPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@ import sbt.Keys.*

object BuildPlugin extends AutoPlugin {

lazy val doNotPublishArtifact = Seq(
publish / skip := true,
publish := {},
publishArtifact := false,
Compile / packageDoc / publishArtifact := false,
Compile / packageSrc / publishArtifact := false,
Compile / packageBin / publishArtifact := false
)

val scalaVersionSuffix = Def
.setting {
scalaBinaryVersion.value match {
Expand Down
9 changes: 5 additions & 4 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.2")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.9.1")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.6")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.15")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0")
addSbtPlugin("com.disneystreaming.smithy4s" % "smithy4s-sbt-codegen" % "0.18.8")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.3")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.6.5")
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.6.5")
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.6.6")
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.6.6")
addSbtPlugin("org.typelevel" % "sbt-typelevel-scalafix" % "0.6.6")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.15.0")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.5.2")
// sbt revolver
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
51 changes: 23 additions & 28 deletions publish.sbt
Original file line number Diff line number Diff line change
@@ -1,31 +1,26 @@
ThisBuild / organization := "io.github.yisraelu.smithy4s-zio"
ThisBuild / versionScheme := Some("early-semver")
import scala.collection.immutable.Seq

ThisBuild / scmInfo := Some(
ScmInfo(
url("https://github.com/yisraelu/smithy4s-zio"),
"scm:git@github.com:yisraelu/smithy4s-zio.git"
)
)
ThisBuild / tlBaseVersion := "0.0" // your current series x.y

inThisBuild(
List(
organization := "io.github.yisraelu",
homepage := Some(url("https://github.com/smithy4s-zio")),
description := "ZIO bindings for Smithy4s",
// Alternatively License.Apache2 see https://github.com/sbt/librarymanagement/blob/develop/core/src/main/scala/sbt/librarymanagement/License.scala
licenses := List(
"Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")
),
developers := List(
Developer(
id = "yisraelu",
name = "Yisrael Union",
email = "ysrlunion@gmail.com",
url = url("https://github.com/yisraelu")
)
)
)
ThisBuild / organization := "io.github.yisraelu"
ThisBuild / organizationName := "yisraelu"
ThisBuild / description := "ZIO bindings for Smithy4s"
ThisBuild / startYear := Some(2023)
ThisBuild / licenses := Seq(License.Apache2)
ThisBuild / developers := List(
// your GitHub handle and name
tlGitHubDev("yisraelu", "Yisrael Union")
)
ThisBuild / sonatypeCredentialHost := "s01.oss.sonatype.org"
sonatypeRepository := "https://s01.oss.sonatype.org/service/local"

// publish to s01.oss.sonatype.org (set to true to publish to oss.sonatype.org instead)
ThisBuild / tlSonatypeUseLegacyHost := false

// publish website from this branch
ThisBuild / tlSitePublishBranch := Some("main")

ThisBuild / tlCiHeaderCheck := false
ThisBuild / tlFatalWarnings := false
ThisBuild / tlCiMimaBinaryIssueCheck := false
ThisBuild / sonatypeProfileName := "io.github.yisraelu"
ThisBuild / tlJdkRelease := Some(11)
ThisBuild / tlCiDependencyGraphJob := false

0 comments on commit c133593

Please sign in to comment.