Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
Merge pull request #8 from khajavi/publish-docs-to-npm-registry
Browse files Browse the repository at this point in the history
Publish Docs to The NPM Registry
  • Loading branch information
khajavi authored Jan 23, 2023
2 parents a3878cd + 5514b6b commit ff0930b
Show file tree
Hide file tree
Showing 17 changed files with 947 additions and 258 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
- name: Cache scala dependencies
uses: coursier/cache-action@v6
- name: Check Website Generation
run: ./sbt docs/docusaurusCreateSite
run: ./sbt docs/compileDocs

test:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -126,7 +126,7 @@ jobs:

ci:
runs-on: ubuntu-20.04
needs: [lint, doc, publishLocal, website, test, testJvms, testPlatforms]
needs: [lint, publishLocal, website, test, testJvms, testPlatforms]
steps:
- name: Aggregate of lint, and all tests
run: echo "ci passed"
Expand Down
106 changes: 91 additions & 15 deletions .github/workflows/site.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,96 @@
name: Website
# 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.

on:
push:
branches: [master]
name: Website
'on':
workflow_dispatch: {}
release:
types:
- published

- published
push:
branches:
- main
pull_request: {}
jobs:
publish:
runs-on: ubuntu-20.04
timeout-minutes: 30
if: github.event_name != 'pull_request'
build:
name: Build and Test
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
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: Check if the README file is up to date
run: sbt docs/checkReadme
- name: Check if the site workflow is up to date
run: sbt docs/checkGithubWorkflow
- name: Check website build process
run: sbt docs/clean; sbt docs/buildWebsite
publish-docs:
name: Publish Docs
runs-on: ubuntu-latest
if: ${{ ((github.event_name == 'release') && (github.event.action == 'published')) || (github.event_name == 'workflow_dispatch') }}
steps:
- uses: actions/checkout@v3
- uses: olafurpg/setup-scala@v13
- run: sbt docs/docusaurusPublishGhpages
env:
GIT_DEPLOY_KEY: ${{ secrets.GIT_DEPLOY_KEY }}
- 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
if: ${{ (github.event_name == 'push') || ((github.event_name == 'release') && (github.event.action == 'published')) }}
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/[email protected]
with:
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.
branch: zio-sbt-website/update-readme
commit-message: Update README.md
delete-branch: true
title: Update README.md
35 changes: 24 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# ZIO Deriving
[//]: # (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][Badge-Stage]][Link-Stage-Page] | ![CI][Badge-CI] | [![Release Artifacts][Badge-SonatypeReleases]][Link-SonatypeReleases] | [![Snapshot Artifacts][Badge-SonatypeSnapshots]][Link-SonatypeSnapshots] | [![Badge-Discord]][Link-Discord] |
# ZIO Deriving

# Summary

Expand Down Expand Up @@ -558,12 +558,25 @@ So when generating typeclasses, make sure to wrap the dependencies with `Lazy`.

If you look at the actual definitions of the AC/DC typeclasses, you'll see that they are all by-name, to accomodate for this. Implementators may want to cache the values in a `lazy val`. Another design choice for zio-deriving would be to use `Lazy` in the AC/DC API but it felt like pollution.

[Badge-SonatypeReleases]: https://img.shields.io/nexus/r/https/oss.sonatype.org/dev.zio/zio-deriving_2.12.svg "Sonatype Releases"
[Badge-SonatypeSnapshots]: https://img.shields.io/nexus/s/https/oss.sonatype.org/dev.zio/zio-deriving_2.12.svg "Sonatype Snapshots"
## Documentation

Learn more on the [ZIO Deriving homepage](https://zio.dev/ecosystem/)!

## 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.dev/about/code-of-conduct)

## Support

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

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

## License

[License](LICENSE)
54 changes: 38 additions & 16 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
organization := "dev.zio"
name := "zio-deriving"
name := "zio-deriving"

// there's nothing stopping 2.10 being supported except the need to rewrite all
// the macros using the 2.10 API... and capping the codegen to an arity of 22.
ThisBuild / crossScalaVersions := List("3.1.1", "2.13.8", "2.12.15", "2.11.12")
ThisBuild / scalaVersion := "2.13.8"
ThisBuild / scalaVersion := "2.13.8"

scalacOptions ++= Seq(
"-deprecation",
Expand All @@ -15,10 +15,10 @@ scalacOptions ++= Seq(
Compile / console / scalacOptions -= "-Ywarn-unused"

Compile / unmanagedSourceDirectories ++= {
val dir = (Compile / scalaSource).value.getPath
val dir = (Compile / scalaSource).value.getPath
val Some((major, minor)) = CrossVersion.partialVersion(scalaVersion.value)
val specific = (major, minor) match {
case (3, _) => file(s"$dir-2.13+3.x") :: Nil
val specific = (major, minor) match {
case (3, _) => file(s"$dir-2.13+3.x") :: Nil
case (2, 13) => file(s"$dir-2.11+2.12+2.13") :: file(s"$dir-2.13+3.x") :: Nil
case (2, 12) => file(s"$dir-2.11+2.12+2.13") :: file(s"$dir-2.11+2.12") :: Nil
case (2, 11) => file(s"$dir-2.11+2.12+2.13") :: file(s"$dir-2.11+2.12") :: Nil
Expand All @@ -34,25 +34,28 @@ libraryDependencies ++= Seq(
)
crossPaths := false // https://github.com/sbt/junit-interface/issues/35
testOptions += Tests.Argument(TestFrameworks.JUnit, "-v")
fork := true
fork := true

libraryDependencies ++= {
if (scalaVersion.value.startsWith("3.")) Seq(
"org.scala-lang" % "scala3-compiler_3" % scalaVersion.value % "provided"
) else Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value % "provided"
)
if (scalaVersion.value.startsWith("3."))
Seq(
"org.scala-lang" % "scala3-compiler_3" % scalaVersion.value % "provided"
)
else
Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value % "provided"
)
}

Compile / sourceManaged := {
val dir = (Compile / sourceManaged).value
val dir = (Compile / sourceManaged).value
val Some((major, minor)) = CrossVersion.partialVersion(scalaVersion.value)
dir / s"scala-${major}.${minor}"
}

Compile / sourceGenerators += Def.task {
val dir = (Compile / sourceManaged).value
val data = dir / "zio"/ "deriving" / "data.scala"
val dir = (Compile / sourceManaged).value
val data = dir / "zio" / "deriving" / "data.scala"
IO.write(data, ShapelyCodeGen.data)
val derivable = dir / "zio" / "deriving" / "derivable.scala"
IO.write(derivable, ShapelyCodeGen.derivable)
Expand All @@ -63,16 +66,35 @@ Compile / sourceGenerators += Def.task {
val Some((major, _)) = CrossVersion.partialVersion(scalaVersion.value)
if (major < 3) Nil
else {
val dir = (Compile / sourceManaged).value
val dir = (Compile / sourceManaged).value
val file = dir / "zio" / "deriving" / "compat.scala"
IO.write(file, ShapelyCodeGen.compat)
Seq(file)
}
}.taskValue

Test / sourceGenerators += Def.task {
val dir = (Compile / sourceManaged).value
val dir = (Compile / sourceManaged).value
val enums = dir / "wheels" / "enums" / "GeneratedEnums.scala"
IO.write(enums, ExamplesCodeGen.enums)
Seq(enums)
}.taskValue

lazy val docs = project
.in(file("zio-deriving-docs"))
.settings(
moduleName := "zio-deriving-docs",
scalacOptions -= "-Yno-imports",
scalacOptions -= "-Xfatal-warnings",
projectName := "ZIO Deriving",
mainModuleName := moduleName.value,
projectStage := ProjectStage.Development,
docsPublishBranch := "main",
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(),
checkArtifactBuildProcessWorkflowStep := None
)
.enablePlugins(WebsitePlugin)

addCommandAlias("fmt", "all scalafmtSbt scalafmt test:scalafmt")
addCommandAlias("fix", "; all compile:scalafix test:scalafix; all scalafmtSbt scalafmtAll")
addCommandAlias("check", "; scalafmtSbtCheck; scalafmtCheckAll; compile:scalafix --check; test:scalafix --check")
Loading

0 comments on commit ff0930b

Please sign in to comment.