Skip to content

Commit

Permalink
porting documentation changes from series/1.x to series/2.x (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
googley42 authored Jan 15, 2023
1 parent 20c0567 commit f4ec390
Show file tree
Hide file tree
Showing 34 changed files with 363 additions and 854 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI
on:
pull_request:
push:
branches: ['master', 'zio2']
branches: ['series/2.x']
release:
types:
- published
Expand Down Expand Up @@ -46,10 +46,33 @@ jobs:
- name: Run integration tests
run: sbt -J-XX:+UseG1GC -J-Xmx6g -J-Xms6g -J-Xss16m ++${{ matrix.scala }}! it:test

mdoc:
runs-on: ubuntu-20.04
timeout-minutes: 30
if: github.event_name != 'pull_request'
steps:
- name: Checkout current branch
uses: actions/[email protected]
- name: Setup Scala and Java
uses: olafurpg/setup-scala@v13
- name: Setup GPG
uses: olafurpg/setup-gpg@v3
- name: Cache scala dependencies
uses: coursier/cache-action@v6
- name: Check Document Generation
run: ./sbt docs/compileDocs

ci:
runs-on: ubuntu-20.04
needs: [build, lint, mdoc]
steps:
- name: Report successful build
run: echo "ci passed"

publish:
runs-on: ubuntu-20.04
timeout-minutes: 30
needs: [build,lint]
needs: [ci]
if: github.event_name != 'pull_request'
steps:
- uses: actions/[email protected]
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# This file was autogenerated using `zio-sbt-website` via `sbt generateGithubWorkflow`
# task and should be included in the git repository. Please do not edit it manually.

name: Website
'on':
workflow_dispatch: {}
release:
types:
- published
push:
branches:
- series/2.x
jobs:
publish-docs:
name: Publish Docs
runs-on: ubuntu-latest
if: ${{ ((github.event_name == 'release') && (github.event.action == 'published')) || (github.event_name == 'workflow_dispatch') }}
steps:
- name: Git Checkout
uses: actions/[email protected]
with:
fetch-depth: '0'
- name: Setup Scala
uses: actions/[email protected]
with:
distribution: temurin
java-version: 17
check-latest: true
- name: Setup NodeJs
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: https://registry.npmjs.org
- name: Publish Docs to NPM Registry
run: sbt docs/publishToNpm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
generate-readme:
name: Generate README
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/[email protected]
with:
ref: ${{ github.head_ref }}
fetch-depth: '0'
- name: Setup Scala
uses: actions/[email protected]
with:
distribution: temurin
java-version: 17
check-latest: true
- name: Generate Readme
run: sbt docs/generateReadme
- name: Commit Changes
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add README.md
git commit -m "Update README.md" || echo "No changes to commit"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
title: Update README.md
commit-message: Update README.md
branch: zio-sbt-website/update-readme
body: |
Autogenerated changes after running the `sbt docs/generateReadme` command of the [zio-sbt-website](https://zio.dev/zio-sbt) plugin.
I will automatically update the README.md file whenever there is new change for README.md, e.g.
- After each release, I will update the version in the installation section.
- After any changes to the "docs/index.md" file, I will update the README.md file accordingly.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -477,3 +477,4 @@ shell.nix
# direnv
.envrc
.direnv
/.vscode/
82 changes: 36 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
# zio-dynamodb
[//]: # (This file was autogenerated using `zio-sbt-website` plugin via `sbt generateReadme` command.)
[//]: # (So please do not edit it manually. Instead, change "docs/index.md" file or sbt setting keys)
[//]: # (e.g. "readmeDocumentation" and "readmeSupport".)

| Project Stage | CI | Release | Snapshot | Discord |
| --- | --- | --- | --- | --- |
| [![Project stage][Stage]][Stage-Page] | ![CI][Badge-CI] | [![Release Artifacts][Badge-SonatypeReleases]][Link-SonatypeReleases] | [![Snapshot Artifacts][Badge-SonatypeSnapshots]][Link-SonatypeSnapshots] | [![Badge-Discord]][Link-Discord] |
# ZIO DynamoDB

# Summary
Simple, type-safe, and efficient access to DynamoDB

# Documentation
|Project Stage | CI | Release | Snapshot | Discord | Github |
|--------------|----|---------|----------|---------|--------|
|[![Experimental](https://img.shields.io/badge/Project%20Stage-Experimental-yellowgreen.svg)](https://github.com/zio/zio/wiki/Project-Stages) |![CI Badge](https://github.com/zio/zio-dynamodb/workflows/CI/badge.svg) |[![Sonatype Releases](https://img.shields.io/nexus/r/https/oss.sonatype.org/dev.zio/zio-dynamodb_2.12.svg)](https://oss.sonatype.org/content/repositories/releases/dev/zio/zio-dynamodb_2.12/) |[![Sonatype Snapshots](https://img.shields.io/nexus/s/https/oss.sonatype.org/dev.zio/zio-dynamodb_2.12.svg)](https://oss.sonatype.org/content/repositories/snapshots/dev/zio/zio-dynamodb_2.12/) |[![Chat on Discord!](https://img.shields.io/discord/629491597070827530?logo=discord)](https://discord.gg/2ccFBr4) |[![ZIO DynamoDB](https://img.shields.io/github/stars/zio/zio-dynamodb?style=social)](https://github.com/zio/zio-dynamodb) |

### Getting Started
## Introduction

```sbt
// only snapshots are published at the moment
resolvers += Resolver.sonatypeRepo("snapshots")
ZIO DynamoDB is a library that is used for type-safe, efficient, and boilerplate free access to AWS's DynamoDB service. It provides a type-safe API for many query types and the number of type-safe APIs is expanding. ZIO DynamoDB will automatically batch queries and execute unbatchable queries in parallel.

// add zio-dynamodb to your dependencies - lookup the latest snapshot version here https://oss.sonatype.org/content/repositories/snapshots/dev/zio/zio-dynamodb_2.13/
Under the hood we use the excellent [ZIO AWS](docs/https://zio.dev/zio-aws) library for type-safe DynamoDB access, and the awesome [ZIO Schema](https://zio.dev/zio-schema) library for schema derived codecs (see here for documentation on how to [customise these through annotations](codec-customization.md)).

## Installation

To use ZIO DynamoDB, we need to add the following lines to our `build.sbt` file:

```scala
libraryDependencies ++= Seq(
// ...
"dev.zio" %% "zio-dynamodb" % "0.0.1<LATEST_VERSION>"
"dev.zio" %% "zio-dynamodb" % "0.2.0-RC2"
)
```

For examples please see [examples sbt module](examples/src/main/scala/zio/dynamodb/examples). Below is `Main.scala` from that module.
## Example

```scala
package zio.dynamodb.examples
For examples please see [examples sbt module](../examples/src/main/scala/zio/dynamodb/examples). Below is `Main.scala` from that module:

```scala
import io.github.vigoo.zioaws.http4s
import zio.{ App, ExitCode, Has, URIO, ZLayer }
import zio.dynamodb.DynamoDBQuery.{ get, put }
Expand All @@ -36,7 +40,7 @@ import io.github.vigoo.zioaws.core.config
import io.github.vigoo.zioaws.dynamodb
import zio.clock.Clock

object Main extends ZIOAppDefault {
object Main extends App {

final case class Person(id: Int, firstName: String)
object Person {
Expand All @@ -47,55 +51,41 @@ object Main extends ZIOAppDefault {
private val program = for {
_ <- put("tableName", examplePerson).execute
person <- get[Person]("tableName", PrimaryKey("id" -> 1)).execute
_ <- zio.Console.printLine(s"hello $person")
_ <- zio.console.putStrLn(s"hello $person")
} yield ()

override def run = {
override def run(args: List[String]): URIO[zio.ZEnv, ExitCode] = {

val dynamoDbLayer =
http4s.Http4sClient.default >>> config.AwsConfig.default >>> dynamodb.DynamoDb.live // uses real AWS dynamodb
val executorLayer = dynamoDbLayer >>> DynamoDBExecutor.live
val dynamoDbLayer = http4s.default >>> config.default >>> dynamodb.live // uses real AWS dynamodb
val executorLayer = (dynamoDbLayer ++ ZLayer.identity[Has[Clock.Service]]) >>> DynamoDBExecutor.live

program.provide(executorLayer)
program.provideCustomLayer(executorLayer).exitCode
}
}

```

For examples on how to use the DynamoDBLocal in memory database please see the [integration tests](dynamodb/src/it/scala/zio/dynamodb/LiveSpec.scala)
and [StudentZioDynamoDbExample](examples/src/main/scala/zio/dynamodb/examples/dynamodblocal/StudentZioDynamoDbExample.scala)
For examples on how to use the DynamoDBLocal in memory database please see the [integration tests](../dynamodb/src/it/scala/zio/dynamodb/LiveSpec.scala)
and [StudentZioDynamoDbExample](../examples/src/main/scala/zio/dynamodb/examples/dynamodblocal/StudentZioDynamoDbExample.scala)

Under the hood we use the excellent [ZIO AWS](https://github.com/zio/zio-aws) library for type-safe DynamoDB access, and
the awesome [ZIO Schema](https://github.com/zio/zio-schema) library for schema derived codecs (see here for documentation
on how to [customise these through annotations](docs/usecases/codec-customisation.md)).
## Documentation

Microsite content to come soon.
Learn more on the [ZIO DynamoDB homepage](https://zio.dev/zio-dynamodb/)!

## Contributing

[ZIO DynamoDB Microsite](https://zio.github.io/zio-dynamodb/)

# Contributing
[Documentation for contributors](https://zio.github.io/zio-dynamodb/docs/about/about_contributing)
For the general guidelines, see ZIO [contributor's guide](https://zio.dev/about/contributing).

## Code of Conduct

See the [Code of Conduct](https://zio.github.io/zio-dynamodb/docs/about/about_coc)
See the [Code of Conduct](https://zio.dev/about/code-of-conduct)

## Support

Come chat with us on [![Badge-Discord]][Link-Discord].


# License
[License](LICENSE)

[Badge-SonatypeReleases]: https://img.shields.io/nexus/r/https/oss.sonatype.org/dev.zio/zio-dynamodb_2.12.svg "Sonatype Releases"
[Badge-SonatypeSnapshots]: https://img.shields.io/nexus/s/https/oss.sonatype.org/dev.zio/zio-dynamodb_2.12.svg "Sonatype Snapshots"
[Badge-Discord]: https://img.shields.io/discord/629491597070827530?logo=discord "chat on discord"
[Link-SonatypeReleases]: https://oss.sonatype.org/content/repositories/releases/dev/zio/zio-dynamodb_2.12/ "Sonatype Releases"
[Link-SonatypeSnapshots]: https://oss.sonatype.org/content/repositories/snapshots/dev/zio/zio-dynamodb_2.12/ "Sonatype Snapshots"
[Link-Discord]: https://discord.gg/2ccFBr4 "Discord"
[Badge-CI]: https://github.com/zio/zio-dynamodb/workflows/CI/badge.svg
[Stage]: https://img.shields.io/badge/Project%20Stage-Experimental-yellow.svg
[Stage-Page]: https://github.com/zio/zio/wiki/Project-Stages

## License

[License](LICENSE)
21 changes: 12 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import BuildHelper._
inThisBuild(
List(
organization := "dev.zio",
homepage := Some(url("https://zio.github.io/zio-dynamodb/")),
homepage := Some(url("https://zio.dev/zio-dynamodb/")),
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
developers := List(
Developer(
Expand All @@ -23,7 +23,7 @@ inThisBuild(
pgpPublicRing := file("/tmp/public.asc"),
pgpSecretRing := file("/tmp/secret.asc"),
scmInfo := Some(
ScmInfo(url("https://github.com/googley42/zio-dynamodb"), "scm:git:[email protected]:googley42/zio-dynamodb.git")
ScmInfo(url("https://github.com/zio/zio-dynamodb"), "scm:git:[email protected]:zio/zio-dynamodb.git")
)
)
)
Expand Down Expand Up @@ -62,7 +62,7 @@ lazy val root =
project
.in(file("."))
.settings(skip in publish := true)
.aggregate(zioDynamodb, examples)
.aggregate(zioDynamodb, examples, docs)

lazy val zioDynamodb = module("zio-dynamodb", "dynamodb")
.enablePlugins(BuildInfoPlugin)
Expand Down Expand Up @@ -323,10 +323,13 @@ lazy val docs = project
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
projectName := "ZIO DynamoDB",
badgeInfo := Some(
BadgeInfo(
artifact = "zio-dynamodb_2.12",
projectStage = ProjectStage.Experimental
)
),
docsPublishBranch := "series/2.x"
)
.enablePlugins(MdocPlugin, DocusaurusPlugin, ScalaUnidocPlugin)
.enablePlugins(WebsitePlugin)
45 changes: 0 additions & 45 deletions docs/about/code_of_conduct.md

This file was deleted.

Loading

0 comments on commit f4ec390

Please sign in to comment.