Skip to content

Commit

Permalink
Update to the latest standard (zio#298)
Browse files Browse the repository at this point in the history
* Update to the latest standard

* fix

* New Scala versions

* new Scalafix

* Don't do Scala 3 because of missing Magnolia

* Don't do Scala 3 because of missing Magnolia
  • Loading branch information
sideeffffect authored Jun 7, 2021
1 parent 57d2336 commit a5c1ca0
Show file tree
Hide file tree
Showing 53 changed files with 457 additions and 365 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @zio/zio-json
47 changes: 32 additions & 15 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,36 @@
name-template: 'v$NEXT_PATCH_VERSION'
tag-template: 'v$NEXT_PATCH_VERSION'
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
template: |
# What's Changed
$CHANGES
categories:
- title: '🚀 Features'
labels:
- 'feature'
- title: '🐛 Bug Fixes'
- title: 'Breaking'
label: 'type: breaking'
- title: 'New'
label: 'type: feature'
- title: 'Bug Fixes'
label: 'type: bug'
- title: 'Maintenance'
label: 'type: maintenance'
- title: 'Documentation'
label: 'type: docs'
- title: 'Dependency Updates'
label: 'type: dependencies'

version-resolver:
major:
labels:
- 'bug'
- title: '🧰 Maintenance'
- 'type: breaking'
minor:
labels:
- 'build'
- title: '🌱 Dependency Updates'
- 'type: feature'
patch:
labels:
- 'dependency-update'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
template: |
## Changes
$CHANGES
- 'type: bug'
- 'type: maintenance'
- 'type: docs'
- 'type: dependencies'
- 'type: security'

exclude-labels:
- 'skip-changelog'
13 changes: 13 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"automerge": true,
"rebaseWhen": "conflicted",
"labels": ["type: dependencies"],
"packageRules": [
{
"matchManagers": [
"sbt"
],
"enabled": false
}
]
}
4 changes: 2 additions & 2 deletions .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
auto-approve:
runs-on: ubuntu-20.04
steps:
- uses: hmarr/auto-approve-action@v2.0.0
if: github.actor == 'scala-steward'
- uses: hmarr/auto-approve-action@v2.1.0
if: github.actor == 'scala-steward' || github.actor == 'renovate[bot]'
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
66 changes: 34 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: CI

env:
JDK_JAVA_OPTIONS: -XX:+PrintCommandLineFlags # JDK_JAVA_OPTIONS is _the_ env. variable to use for modern Java
JVM_OPTS: -XX:+PrintCommandLineFlags # for Java 8 only (sadly, it is not modern enough for JDK_JAVA_OPTIONS)

on:
pull_request:
push:
Expand All @@ -11,8 +15,7 @@ on:
jobs:
lint:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
timeout-minutes: 30
steps:
- name: Checkout current branch
uses: actions/[email protected]
Expand All @@ -21,17 +24,16 @@ jobs:
- name: Setup Scala and Java
uses: olafurpg/setup-scala@v10
- name: Cache scala dependencies
uses: coursier/cache-action@v5
uses: coursier/cache-action@v6
- name: Lint code
run: sbt fmtCheck fixCheck
run: sbt check

benchmarks:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
java: ['[email protected]', '[email protected]']
scala: ['2.13.5']
steps:
- name: Checkout current branch
uses: actions/[email protected]
Expand All @@ -42,42 +44,32 @@ jobs:
with:
java-version: ${{ matrix.java }}
- name: Cache scala dependencies
uses: coursier/cache-action@v5
uses: coursier/cache-action@v6
- name: Compile benchmarks
run: sbt ++${{ matrix.scala }}! jmh:compile
run: sbt jmh:compile

testJS:
mdoc:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
java: ['[email protected]', '[email protected]']
scala: ['2.12.13', '2.13.5']
timeout-minutes: 60
steps:
- name: Checkout current branch
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup Scala and Java
uses: olafurpg/setup-scala@v10
with:
java-version: ${{ matrix.java }}
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '10'
- name: Cache scala dependencies
uses: coursier/cache-action@v5
- name: Run tests
run: sbt ++${{ matrix.scala }}! testJS
uses: coursier/cache-action@v6
- name: Check Document Generation
run: sbt docs/docusaurusCreateSite

testJVM:
test:
runs-on: ubuntu-20.04
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
java: ['[email protected]', '[email protected]']
scala: ['2.12.13', '2.13.5']
scala: ['2.12.14', '2.13.6']
platform: ['JVM', 'JS']
steps:
- name: Checkout current branch
uses: actions/[email protected]
Expand All @@ -88,25 +80,35 @@ jobs:
with:
java-version: ${{ matrix.java }}
- name: Cache scala dependencies
uses: coursier/cache-action@v5
uses: coursier/cache-action@v6
- name: Run tests
if: ${{ !startsWith(matrix.scala, '3.0.') }}
run: sbt ++${{ matrix.scala }}! test${{ matrix.platform }}
- name: Run dotty tests
if: ${{ startsWith(matrix.scala, '3.0.') && matrix.platform == 'JVM' }}
run: sbt ++${{ matrix.scala }}! testJVM

ci:
runs-on: ubuntu-20.04
needs: [lint, mdoc, benchmarks, test]
steps:
- name: Aggregate of lint, and all tests
run: echo "ci passed"

publish:
runs-on: ubuntu-20.04
needs: [lint, benchmarks, testJS, testJVM]
timeout-minutes: 30
needs: [ci]
if: github.event_name != 'pull_request'
steps:
- name: Checkout current branch
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup Scala and Java
- name: Setup Scala and Java
uses: olafurpg/setup-scala@v10
- name: Cache scala dependencies
uses: coursier/cache-action@v5
- name: Setup GPG
uses: olafurpg/setup-gpg@v3
uses: coursier/cache-action@v6
- name: Release artifacts
run: sbt ci-release
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Release Drafter

on:
push:
branches: ['master']
branches: ['develop']

jobs:
update_release_draft:
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/mdoc.yml → .github/workflows/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ name: Website

on:
push:
branches: [develop]
tags: ['v*']
branches: ['develop']
release:
types:
- published

jobs:
publish:
runs-on: ubuntu-20.04
timeout-minutes: 30
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: olafurpg/setup-scala@v10
- uses: olafurpg/setup-gpg@v3
- run: sbt docs/docusaurusPublishGhpages
env:
GIT_DEPLOY_KEY: ${{ secrets.GIT_DEPLOY_KEY }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,6 @@ project/secret
# mdoc
website/node_modules
website/build
website/i18n/en.json
website/i18n
website/static/api
website/yarn.lock
26 changes: 26 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
pull_request_rules:
- name: assign and label scala-steward's PRs
conditions:
- author=scala-steward
actions:
assign:
users: ["@zio/zio-json"]
label:
add: ["type: dependencies"]
- name: label scala-steward's breaking PRs
conditions:
- author=scala-steward
- "body~=(labels: library-update, semver-major)|(labels: sbt-plugin-update, semver-major)"
actions:
label:
add: ["type: breaking"]
- name: merge Scala Steward's PRs
conditions:
- base=master
- author=scala-steward
- "body~=(labels: library-update, semver-minor)|(labels: library-update, semver-patch)|(labels: sbt-plugin-update, semver-minor)|(labels: sbt-plugin-update, semver-patch)|(labels: scalafix-rule-update)|(labels: test-library-update)"
- "status-success=license/cla"
- "status-success=ci"
actions:
merge:
method: squash
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
14.16.1
8 changes: 1 addition & 7 deletions .scalafix.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,8 @@ Disable {
}

OrganizeImports {
expandRelative = true
# Allign with IntelliJ IDEA so that they don't fight each other
groupedImports = Merge
groups = [
"re:javax?\\.",
"scala.",
"*",
"zio."
]
}

RemoveUnused {
Expand Down
16 changes: 8 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,12 @@ inThisBuild(
"[email protected]",
url("http://degoes.net")
)
),
pgpPassphrase := sys.env.get("PGP_PASSWORD").map(_.toArray),
pgpPublicRing := file("/tmp/public.asc"),
pgpSecretRing := file("/tmp/secret.asc"),
scmInfo := Some(
ScmInfo(url("https://github.com/zio/zio-json/"), "scm:git:[email protected]:zio/zio-json.git")
)
)
)

addCommandAlias("fix", "scalafixAll")
addCommandAlias("fix", "; all compile:scalafix test:scalafix; all scalafmtSbt scalafmtAll")
addCommandAlias("check", "; scalafmtSbtCheck; scalafmtCheckAll; compile:scalafix --check; test:scalafix --check")
addCommandAlias("fixCheck", "scalafixAll --check")
addCommandAlias("fmt", "all scalafmtSbt scalafmtAll")
addCommandAlias("fmtCheck", "all scalafmtSbtCheck scalafmtCheckAll")
Expand Down Expand Up @@ -185,6 +180,7 @@ lazy val zioJson = crossProject(JSPlatform, JVMPlatform)
"org.typelevel" %% "jawn-ast" % "1.1.2" % "test"
)
)
.enablePlugins(BuildInfoPlugin)

lazy val zioJsonJS = zioJson.js
.settings(
Expand All @@ -209,6 +205,7 @@ lazy val zioJsonYaml = project
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
)
.dependsOn(zioJsonJVM)
.enablePlugins(BuildInfoPlugin)

lazy val zioJsonMacros = crossProject(JSPlatform, JVMPlatform)
.in(file("zio-json-macros"))
Expand Down Expand Up @@ -247,6 +244,7 @@ lazy val zioJsonInteropHttp4s = project
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
)
.dependsOn(zioJsonJVM)
.enablePlugins(BuildInfoPlugin)

lazy val zioJsonInteropRefined = crossProject(JSPlatform, JVMPlatform)
.in(file("zio-json-interop-refined"))
Expand All @@ -262,6 +260,7 @@ lazy val zioJsonInteropRefined = crossProject(JSPlatform, JVMPlatform)
),
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
)
.enablePlugins(BuildInfoPlugin)

lazy val zioJsonInteropScalaz7x = crossProject(JSPlatform, JVMPlatform)
.in(file("zio-json-interop-scalaz7x"))
Expand All @@ -277,6 +276,7 @@ lazy val zioJsonInteropScalaz7x = crossProject(JSPlatform, JVMPlatform)
),
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
)
.enablePlugins(BuildInfoPlugin)

lazy val docs = project
.in(file("zio-json-docs"))
Expand All @@ -286,7 +286,7 @@ lazy val docs = project
zioJsonInteropRefined.jvm
)
.settings(
skip.in(publish) := true,
publish / skip := true,
mdocVariables := Map(
"SNAPSHOT_VERSION" -> version.value,
"RELEASE_VERSION" -> previousStableVersion.value.getOrElse("can't find release"),
Expand Down
Loading

0 comments on commit a5c1ca0

Please sign in to comment.