From 28c49c41085e63feb649539c93303604ed8abea2 Mon Sep 17 00:00:00 2001 From: Thijs Broersen Date: Fri, 13 Dec 2024 10:03:31 +0100 Subject: [PATCH] use zio-json explicitEmptyCollections --- .github/workflows/ci.yml | 1 - project/plugins.sbt | 8 +- zio-sbt-ci/build.sbt | 6 +- .../main/scala/zio/sbt/ZioSbtCiPlugin.scala | 104 ++++++++---------- zio-sbt-ecosystem/build.sbt | 8 +- zio-sbt-githubactions/build.sbt | 6 +- .../zio/sbt/githubactions/ScalaWorkflow.scala | 74 +++++-------- .../scala/zio/sbt/githubactions/model.scala | 44 +++++--- .../scala/zio/sbt/githubactions/package.scala | 8 ++ zio-sbt-website/build.sbt | 6 +- 10 files changed, 132 insertions(+), 133 deletions(-) create mode 100644 zio-sbt-githubactions/src/main/scala/zio/sbt/githubactions/package.scala diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f898f29..4b8b32e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,6 @@ name: CI env: JDK_JAVA_OPTIONS: -XX:+PrintCommandLineFlags 'on': - workflow_dispatch: {} release: types: - published diff --git a/project/plugins.sbt b/project/plugins.sbt index 1586863d..9f1882ac 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -26,6 +26,8 @@ addSbtPlugin("org.portable-scala" % "sbt-platform-deps" % "1.0.2") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.7") libraryDependencies += "org.snakeyaml" % "snakeyaml-engine" % "2.8" -libraryDependencies += "dev.zio" %% "zio" % "2.1.9" -libraryDependencies += "dev.zio" %% "zio-json" % "0.7.3" -libraryDependencies += "dev.zio" %% "zio-json-yaml" % "0.7.3" +libraryDependencies += "dev.zio" %% "zio" % "2.1.13" +libraryDependencies += "dev.zio" %% "zio-json" % "0.7.3+19-9339fbba-SNAPSHOT" +libraryDependencies += "dev.zio" %% "zio-json-yaml" % "0.7.3+19-9339fbba-SNAPSHOT" + +resolvers ++= Resolver.sonatypeOssRepos("snapshots") diff --git a/zio-sbt-ci/build.sbt b/zio-sbt-ci/build.sbt index f959f826..aaba83b4 100644 --- a/zio-sbt-ci/build.sbt +++ b/zio-sbt-ci/build.sbt @@ -1,3 +1,5 @@ libraryDependencies += "dev.zio" %% "zio" % "2.1.13" -libraryDependencies += "dev.zio" %% "zio-json" % "0.7.3" -libraryDependencies += "dev.zio" %% "zio-json-yaml" % "0.7.3" +libraryDependencies += "dev.zio" %% "zio-json" % "0.7.3+19-9339fbba-SNAPSHOT" +libraryDependencies += "dev.zio" %% "zio-json-yaml" % "0.7.3+19-9339fbba-SNAPSHOT" + +resolvers ++= Resolver.sonatypeOssRepos("snapshots") diff --git a/zio-sbt-ci/src/main/scala/zio/sbt/ZioSbtCiPlugin.scala b/zio-sbt-ci/src/main/scala/zio/sbt/ZioSbtCiPlugin.scala index 82ae8781..9be4cb1c 100644 --- a/zio-sbt-ci/src/main/scala/zio/sbt/ZioSbtCiPlugin.scala +++ b/zio-sbt-ci/src/main/scala/zio/sbt/ZioSbtCiPlugin.scala @@ -329,7 +329,7 @@ object ZioSbtCiPlugin extends AutoPlugin { Seq( Job( name = "ci", - needs = Some(pullRequestApprovalJobs), + needs = pullRequestApprovalJobs, steps = Seq( SingleStep( name = "Report Successful CI", @@ -372,52 +372,44 @@ object ZioSbtCiPlugin extends AutoPlugin { name = "Generate Token", id = Some("generate-token"), uses = Some(ActionRef(V("zio/generate-github-app-token"))), - `with` = Some( - ListMap( - "app_id" -> "${{ secrets.APP_ID }}".toJsonAST.right.get, - "app_private_key" -> "${{ secrets.APP_PRIVATE_KEY }}".toJsonAST.right.get - ) + `with` = ListMap( + "app_id" -> "${{ secrets.APP_ID }}".toJsonAST.right.get, + "app_private_key" -> "${{ secrets.APP_PRIVATE_KEY }}".toJsonAST.right.get ) ), Step.SingleStep( name = "Create Pull Request", id = Some("cpr"), uses = Some(ActionRef(V("peter-evans/create-pull-request"))), - `with` = Some( - ListMap( - "title" -> "Update README.md".toJsonAST.right.get, - "commit-message" -> "Update README.md".toJsonAST.right.get, - "branch" -> "zio-sbt-website/update-readme".toJsonAST.right.get, - "delete-branch" -> true.toJsonAST.right.get, - "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.""".stripMargin.toJsonAST.right.get, - "token" -> "${{ steps.generate-token.outputs.token }}".toJsonAST.right.get - ) + `with` = ListMap( + "title" -> "Update README.md".toJsonAST.right.get, + "commit-message" -> "Update README.md".toJsonAST.right.get, + "branch" -> "zio-sbt-website/update-readme".toJsonAST.right.get, + "delete-branch" -> true.toJsonAST.right.get, + "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.""".stripMargin.toJsonAST.right.get, + "token" -> "${{ steps.generate-token.outputs.token }}".toJsonAST.right.get ) ), Step.SingleStep( name = "Approve PR", `if` = Some(Condition.Expression("steps.cpr.outputs.pull-request-number")), - env = Some( - ListMap( - "GITHUB_TOKEN" -> "${{ secrets.GITHUB_TOKEN }}", - "PR_URL" -> "${{ steps.cpr.outputs.pull-request-url }}" - ) + env = ListMap( + "GITHUB_TOKEN" -> "${{ secrets.GITHUB_TOKEN }}", + "PR_URL" -> "${{ steps.cpr.outputs.pull-request-url }}" ), run = Some("gh pr review \"$PR_URL\" --approve") ), Step.SingleStep( name = "Enable Auto-Merge", `if` = Some(Condition.Expression("steps.cpr.outputs.pull-request-number")), - env = Some( - ListMap( - "GITHUB_TOKEN" -> "${{ secrets.GITHUB_TOKEN }}", - "PR_URL" -> "${{ steps.cpr.outputs.pull-request-url }}" - ) + env = ListMap( + "GITHUB_TOKEN" -> "${{ secrets.GITHUB_TOKEN }}", + "PR_URL" -> "${{ steps.cpr.outputs.pull-request-url }}" ), run = Some("gh pr merge --auto --squash \"$PR_URL\" || gh pr merge --squash \"$PR_URL\"") ) @@ -437,7 +429,7 @@ object ZioSbtCiPlugin extends AutoPlugin { Seq( Job( name = "Release", - needs = Some(jobs), + needs = jobs, `if` = Some(Condition.Expression("github.event_name != 'pull_request'")), steps = (if (swapSizeGB > 0) Seq(setSwapSpace) else Seq.empty) ++ Seq( @@ -462,7 +454,7 @@ object ZioSbtCiPlugin extends AutoPlugin { Seq( Job( name = "Release Docs", - needs = Some(Seq("release")), + needs = Seq("release"), `if` = Some( Condition.Expression("github.event_name == 'release'") && Condition.Expression("github.event.action == 'published'") || Condition.Expression( @@ -481,7 +473,7 @@ object ZioSbtCiPlugin extends AutoPlugin { ), Job( name = "Notify Docs Release", - needs = Some(Seq("release-docs")), + needs = Seq("release-docs"), `if` = Some( Condition.Expression("github.event_name == 'release'") && Condition.Expression("github.event.action == 'published'") @@ -541,12 +533,12 @@ object ZioSbtCiPlugin extends AutoPlugin { val workflow = Workflow( name = workflowName, - env = Some(jvmMap ++ nodeMap), + env = jvmMap ++ nodeMap, on = Some( Triggers( release = Some(Trigger.Release(Seq(Trigger.ReleaseType.Published))), - push = Some(Trigger.Push(branches = Some(enabledBranches.map(Branch.Named)).filter(_.nonEmpty))), - pullRequest = Some(Trigger.PullRequest(branchesIgnore = Some(Seq(Branch.Named("gh-pages"))))) + push = Some(Trigger.Push(branches = enabledBranches.map(Branch.Named))).filter(_.branches.nonEmpty), + pullRequest = Some(Trigger.PullRequest(branchesIgnore = Seq(Branch.Named("gh-pages")))) ) ), jobs = ListMap( @@ -555,7 +547,9 @@ object ZioSbtCiPlugin extends AutoPlugin { ) ) - val yaml: String = workflow.toJsonAST.flatMap(_.toYaml(yamlOptions).left.map(_.getMessage())) match { + val yaml: String = zio.json.ast.Json.decoder + .decodeJson(workflow.toJson) + .flatMap(_.toYaml(yamlOptions).left.map(_.getMessage())) match { case Right(value) => value case Left(error) => sys.error(s"Error generating workflow yaml: $error") } @@ -652,7 +646,7 @@ object ZioSbtCiPlugin extends AutoPlugin { Step.SingleStep( name = "Set Swap Space", uses = Some(ActionRef(V("pierotofy/set-swap-space"))), - `with` = Some(ListMap("swap-size-gb" -> swapSizeGB.toString.toJsonAST.right.get)) + `with` = ListMap("swap-size-gb" -> swapSizeGB.toString.toJsonAST.right.get) ) } @@ -661,7 +655,7 @@ object ZioSbtCiPlugin extends AutoPlugin { Step.SingleStep( name = "Git Checkout", uses = Some(ActionRef(V("actions/checkout"))), - `with` = Some(ListMap("fetch-depth" -> "0".toJsonAST.right.get)) + `with` = ListMap("fetch-depth" -> "0".toJsonAST.right.get) ) } @@ -673,12 +667,10 @@ object ZioSbtCiPlugin extends AutoPlugin { def SetupJava(version: String = "17"): Step.SingleStep = Step.SingleStep( name = "Setup Scala", uses = Some(ActionRef(V("actions/setup-java"))), - `with` = Some( - ListMap( - "distribution" -> "corretto".toJsonAST.right.get, - "java-version" -> version.toJsonAST.right.get, - "check-latest" -> true.toJsonAST.right.get - ) + `with` = ListMap( + "distribution" -> "corretto".toJsonAST.right.get, + "java-version" -> version.toJsonAST.right.get, + "check-latest" -> true.toJsonAST.right.get ) ) @@ -723,13 +715,11 @@ object ZioSbtCiPlugin extends AutoPlugin { Step.SingleStep( name = "Release", run = Some(prefixJobs + "sbt ci-release"), - env = Some( - ListMap( - "PGP_PASSPHRASE" -> "${{ secrets.PGP_PASSPHRASE }}", - "PGP_SECRET" -> "${{ secrets.PGP_SECRET }}", - "SONATYPE_PASSWORD" -> "${{ secrets.SONATYPE_PASSWORD }}", - "SONATYPE_USERNAME" -> "${{ secrets.SONATYPE_USERNAME }}" - ) + env = ListMap( + "PGP_PASSPHRASE" -> "${{ secrets.PGP_PASSPHRASE }}", + "PGP_SECRET" -> "${{ secrets.PGP_SECRET }}", + "SONATYPE_PASSWORD" -> "${{ secrets.SONATYPE_PASSWORD }}", + "SONATYPE_USERNAME" -> "${{ secrets.SONATYPE_USERNAME }}" ) ) } @@ -737,11 +727,9 @@ object ZioSbtCiPlugin extends AutoPlugin { val SetupNodeJs: Step.SingleStep = Step.SingleStep( name = "Setup NodeJs", uses = Some(ActionRef(V("actions/setup-node"))), - `with` = Some( - ListMap( - "node-version" -> "16.x".toJsonAST.right.get, - "registry-url" -> "https://registry.npmjs.org".toJsonAST.right.get - ) + `with` = ListMap( + "node-version" -> "16.x".toJsonAST.right.get, + "registry-url" -> "https://registry.npmjs.org".toJsonAST.right.get ) ) @@ -754,7 +742,7 @@ object ZioSbtCiPlugin extends AutoPlugin { Step.SingleStep( name = "Publish Docs to NPM Registry", run = Some(prefixJobs + s"sbt docs/${docsVersioning.npmCommand}"), - env = Some(ListMap("NODE_AUTH_TOKEN" -> "${{ secrets.NPM_TOKEN }}")) + env = ListMap("NODE_AUTH_TOKEN" -> "${{ secrets.NPM_TOKEN }}") ) } diff --git a/zio-sbt-ecosystem/build.sbt b/zio-sbt-ecosystem/build.sbt index 3cf71721..87193342 100644 --- a/zio-sbt-ecosystem/build.sbt +++ b/zio-sbt-ecosystem/build.sbt @@ -29,6 +29,8 @@ addSbtPlugin("pl.project13.scala" % "sbt-jcstress" % "0.2.0") // Binary Compatibility Plugin libraryDependencies += "dev.zio" %% "zio" % "2.1.13" -libraryDependencies += "dev.zio" %% "zio" % "2.1.9" -libraryDependencies += "dev.zio" %% "zio-json" % "0.7.3" -libraryDependencies += "dev.zio" %% "zio-json-yaml" % "0.7.3" +libraryDependencies += "dev.zio" %% "zio" % "2.1.13" +libraryDependencies += "dev.zio" %% "zio-json" % "0.7.3+19-9339fbba-SNAPSHOT" +libraryDependencies += "dev.zio" %% "zio-json-yaml" % "0.7.3+19-9339fbba-SNAPSHOT" + +resolvers ++= Resolver.sonatypeOssRepos("snapshots") diff --git a/zio-sbt-githubactions/build.sbt b/zio-sbt-githubactions/build.sbt index f959f826..aaba83b4 100644 --- a/zio-sbt-githubactions/build.sbt +++ b/zio-sbt-githubactions/build.sbt @@ -1,3 +1,5 @@ libraryDependencies += "dev.zio" %% "zio" % "2.1.13" -libraryDependencies += "dev.zio" %% "zio-json" % "0.7.3" -libraryDependencies += "dev.zio" %% "zio-json-yaml" % "0.7.3" +libraryDependencies += "dev.zio" %% "zio-json" % "0.7.3+19-9339fbba-SNAPSHOT" +libraryDependencies += "dev.zio" %% "zio-json-yaml" % "0.7.3+19-9339fbba-SNAPSHOT" + +resolvers ++= Resolver.sonatypeOssRepos("snapshots") diff --git a/zio-sbt-githubactions/src/main/scala/zio/sbt/githubactions/ScalaWorkflow.scala b/zio-sbt-githubactions/src/main/scala/zio/sbt/githubactions/ScalaWorkflow.scala index a8350785..f8a99987 100644 --- a/zio-sbt-githubactions/src/main/scala/zio/sbt/githubactions/ScalaWorkflow.scala +++ b/zio-sbt-githubactions/src/main/scala/zio/sbt/githubactions/ScalaWorkflow.scala @@ -29,10 +29,8 @@ object ScalaWorkflow { SingleStep( name = "Checkout current branch", uses = Some(ActionRef("actions/checkout@v2")), - `with` = Some( - ListMap( - "fetch-depth" -> fetchDepth.toJsonAST.right.get - ) + `with` = ListMap( + "fetch-depth" -> fetchDepth.toJsonAST.right.get ) ) @@ -40,13 +38,11 @@ object ScalaWorkflow { SingleStep( name = "Setup Java and Scala", uses = Some(ActionRef("olafurpg/setup-scala@v11")), - `with` = Some( - ListMap( - "java-version" -> (javaVersion match { - case None => "${{ matrix.java }}" - case Some(version) => version.asString - }).toJsonAST.right.get - ) + `with` = ListMap( + "java-version" -> (javaVersion match { + case None => "${{ matrix.java }}" + case Some(version) => version.asString + }).toJsonAST.right.get ) ) @@ -54,14 +50,12 @@ object ScalaWorkflow { SingleStep( name = "Setup NodeJS", uses = Some(ActionRef("actions/setup-node@v3")), - `with` = Some( - ListMap( - "node-version" -> (javaVersion match { - case None => "16.x" - case Some(version) => version.asString - }).toJsonAST.right.get, - "registry-url" -> "https://registry.npmjs.org".toJsonAST.right.get - ) + `with` = ListMap( + "node-version" -> (javaVersion match { + case None => "16.x" + case Some(version) => version.asString + }).toJsonAST.right.get, + "registry-url" -> "https://registry.npmjs.org".toJsonAST.right.get ) ) @@ -81,16 +75,14 @@ object ScalaWorkflow { SingleStep( name = "Cache SBT", uses = Some(ActionRef("actions/cache@v2")), - `with` = Some( - ListMap( - "path" -> Seq( - "~/.ivy2/cache", - "~/.sbt", - "~/.coursier/cache/v1", - "~/.cache/coursier/v1" - ).mkString("\n").toJsonAST.right.get, - "key" -> s"$osS-sbt-$scalaS-$${{ hashFiles('**/*.sbt') }}-$${{ hashFiles('**/build.properties') }}".toJsonAST.right.get - ) + `with` = ListMap( + "path" -> Seq( + "~/.ivy2/cache", + "~/.sbt", + "~/.coursier/cache/v1", + "~/.cache/coursier/v1" + ).mkString("\n").toJsonAST.right.get, + "key" -> s"$osS-sbt-$scalaS-$${{ hashFiles('**/*.sbt') }}-$${{ hashFiles('**/build.properties') }}".toJsonAST.right.get ) ) } @@ -113,7 +105,7 @@ object ScalaWorkflow { run = Some( s"sbt -J-XX:+UseG1GC -J-Xmx${heapGb}g -J-Xms${heapGb}g -J-Xss${stackMb}m ${parameters.mkString(" ")}" ), - env = Some(env).filter(_.nonEmpty) + env = env ) def storeTargets( @@ -138,11 +130,9 @@ object ScalaWorkflow { SingleStep( s"Upload $id targets", uses = Some(ActionRef("actions/upload-artifact@v2")), - `with` = Some( - ListMap( - "name" -> s"target-$id-$osS-$scalaS-$javaS".toJsonAST.right.get, - "path" -> "targets.tar".toJsonAST.right.get - ) + `with` = ListMap( + "name" -> s"target-$id-$osS-$scalaS-$javaS".toJsonAST.right.get, + "path" -> "targets.tar".toJsonAST.right.get ) ) ) @@ -164,10 +154,8 @@ object ScalaWorkflow { SingleStep( s"Download stored $id targets", uses = Some(ActionRef("actions/download-artifact@v2")), - `with` = Some( - ListMap( - "name" -> s"target-$id-$osS-$scalaS-$javaS".toJsonAST.right.get - ) + `with` = ListMap( + "name" -> s"target-$id-$osS-$scalaS-$javaS".toJsonAST.right.get ) ), SingleStep( @@ -194,17 +182,15 @@ object ScalaWorkflow { SingleStep( "Load PGP secret", run = Some(".github/import-key.sh"), - env = Some(ListMap("PGP_SECRET" -> "${{ secrets.PGP_SECRET }}")) + env = ListMap("PGP_SECRET" -> "${{ secrets.PGP_SECRET }}") ) def turnstyle(): Step = SingleStep( "Turnstyle", uses = Some(ActionRef("softprops/turnstyle@v1")), - env = Some( - ListMap( - "GITHUB_TOKEN" -> "${{ secrets.ADMIN_GITHUB_TOKEN }}" - ) + env = ListMap( + "GITHUB_TOKEN" -> "${{ secrets.ADMIN_GITHUB_TOKEN }}" ) ) diff --git a/zio-sbt-githubactions/src/main/scala/zio/sbt/githubactions/model.scala b/zio-sbt-githubactions/src/main/scala/zio/sbt/githubactions/model.scala index 3dd349b6..026836aa 100644 --- a/zio-sbt-githubactions/src/main/scala/zio/sbt/githubactions/model.scala +++ b/zio-sbt-githubactions/src/main/scala/zio/sbt/githubactions/model.scala @@ -76,7 +76,7 @@ object Trigger { } case class WorkflowDispatch( - inputs: Option[ListMap[String, InputValue]] = None + inputs: ListMap[String, InputValue] = ListMap.empty ) extends Trigger object WorkflowDispatch { @@ -120,10 +120,10 @@ object Trigger { @jsonMemberNames(KebabCase) case class PullRequest( - // types: Option[Seq[PullRequestType]] = None, - branches: Option[Seq[Branch]] = None, - branchesIgnore: Option[Seq[Branch]] = None, - paths: Option[Seq[String]] = None + // types: Seq[PullRequestType] = Seq.empty, + branches: Seq[Branch] = Seq.empty, + branchesIgnore: Seq[Branch] = Seq.empty, + paths: Seq[String] = Seq.empty ) extends Trigger object PullRequest { @@ -131,8 +131,8 @@ object Trigger { } case class Push( - branches: Option[Seq[Branch]] = None, - branchesIgnore: Option[Seq[Branch]] = None + branches: Seq[Branch] = Seq.empty, + branchesIgnore: Seq[Branch] = Seq.empty ) extends Trigger object Push { @@ -140,8 +140,8 @@ object Trigger { } case class Create( - branches: Option[Seq[Branch]] = None, - branchesIgnore: Option[Seq[Branch]] = None + branches: Seq[Branch] = Seq.empty, + branchesIgnore: Seq[Branch] = Seq.empty ) extends Trigger object Create { @@ -227,10 +227,14 @@ object Step { id: Option[String] = None, uses: Option[ActionRef] = None, `if`: Option[Condition] = None, - `with`: Option[ListMap[String, Json]] = None, + `with`: ListMap[String, Json] = ListMap.empty, run: Option[String] = None, - env: Option[ListMap[String, String]] = None + env: ListMap[String, String] = ListMap.empty ) extends Step { + + @deprecated("Use `if` instead", "0.4.0-alpha.29") + def condition: Option[Condition] = `if` + override def when(condition: Condition): Step = copy(`if` = Some(condition)) @@ -273,8 +277,8 @@ object ServicePort { case class Service( name: String, image: ImageRef, - env: Option[Map[String, String]] = None, - ports: Option[Seq[ServicePort]] = None + env: Map[String, String] = Map.empty, + ports: Seq[ServicePort] = Seq.empty ) object Service { implicit lazy val codec: JsonCodec[Service] = DeriveJsonCodec.gen[Service] @@ -287,14 +291,17 @@ case class Job( timeoutMinutes: Option[Int] = None, continueOnError: Boolean = false, strategy: Option[Strategy] = None, - needs: Option[Seq[String]] = None, - services: Option[Seq[Service]] = None, + needs: Seq[String] = Seq.empty, + services: Seq[Service] = Seq.empty, `if`: Option[Condition] = None, steps: Seq[Step] = Seq.empty ) { def id: String = name.toLowerCase().replace(" ", "-") + @deprecated("Use `if` instead", "0.4.0-alpha.29") + def condition: Option[Condition] = `if` + def withStrategy(strategy: Strategy): Job = copy(strategy = Some(strategy)) @@ -306,7 +313,7 @@ case class Job( } def withServices(services: Service*): Job = - copy(services = Some(services)) + copy(services = services) def withRunsOn(runsOn: String): Job = copy(runsOn = runsOn) @@ -323,7 +330,7 @@ case class Job( def withStrategy(strategy: Option[Strategy]): Job = copy(strategy = strategy) - def withNeeds(needs: Option[Seq[String]]): Job = + def withNeeds(needs: Seq[String]): Job = copy(needs = needs) } @@ -331,6 +338,7 @@ object Job { implicit lazy val stepsCodec: JsonCodec[Seq[Step]] = JsonCodec.seq[Step.SingleStep].transform[Seq[Step]](identity, _.flatMap(_.flatten)) implicit lazy val codec: JsonCodec[Job] = DeriveJsonCodec.gen[Job] + } @jsonMemberNames(KebabCase) @@ -345,7 +353,7 @@ object Concurrency { case class Workflow( name: String, - env: Option[ListMap[String, String]] = None, + env: ListMap[String, String] = ListMap.empty, on: Option[Triggers] = None, concurrency: Concurrency = Concurrency( "${{ github.workflow }}-${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.run_id || github.ref }}" diff --git a/zio-sbt-githubactions/src/main/scala/zio/sbt/githubactions/package.scala b/zio-sbt-githubactions/src/main/scala/zio/sbt/githubactions/package.scala new file mode 100644 index 00000000..112f9c6b --- /dev/null +++ b/zio-sbt-githubactions/src/main/scala/zio/sbt/githubactions/package.scala @@ -0,0 +1,8 @@ +package zio.sbt + +import zio.json.JsonCodecConfiguration + +package object githubactions { + implicit val jsonConfig: JsonCodecConfiguration = + JsonCodecConfiguration.default.copy(explicitEmptyCollections = false) +} diff --git a/zio-sbt-website/build.sbt b/zio-sbt-website/build.sbt index 2bc7157b..a899ecea 100644 --- a/zio-sbt-website/build.sbt +++ b/zio-sbt-website/build.sbt @@ -3,5 +3,7 @@ addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0") addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings" % "3.0.2") libraryDependencies += "dev.zio" %% "zio" % "2.1.13" -libraryDependencies += "dev.zio" %% "zio-json" % "0.7.3" -libraryDependencies += "dev.zio" %% "zio-json-yaml" % "0.7.3" +libraryDependencies += "dev.zio" %% "zio-json" % "0.7.3+19-9339fbba-SNAPSHOT" +libraryDependencies += "dev.zio" %% "zio-json-yaml" % "0.7.3+19-9339fbba-SNAPSHOT" + +resolvers ++= Resolver.sonatypeOssRepos("snapshots")