Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to the latest standard #339

Merged
merged 3 commits into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
* @zio/zio-nio

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 }}"
80 changes: 64 additions & 16 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 @@ -9,35 +13,79 @@ on:
- published

jobs:
build:
lint:
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- name: Checkout current branch
uses: actions/checkout@v2.3.4
with:
fetch-depth: 0
- name: Setup Scala and Java
uses: olafurpg/setup-scala@v10
- name: Cache scala dependencies
uses: coursier/cache-action@v6
- name: Lint code
run: sbt check

mdoc:
runs-on: ubuntu-20.04
timeout-minutes: 60
steps:
- name: Checkout current branch
uses: actions/checkout@v2.3.4
- name: Setup Scala and Java
uses: olafurpg/setup-scala@v10
- name: Cache scala dependencies
uses: coursier/cache-action@v6
- name: Check Document Generation
run: sbt docs/mdoc

test:
runs-on: ubuntu-20.04
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
java: ['adopt@1.8', 'adopt@1.11']
scala: ['2.11.12', '2.12.13', '2.13.4', '3.0.0-M3']
scala: ['2.11.12', '2.12.13', '2.13.5', '3.0.0-RC3']
steps:
- name: Checkout current branch
uses: actions/checkout@v2.3.4
with:
fetch-depth: 0
- name: Setup Scala and Java
uses: olafurpg/setup-scala@v10
with:
java-version: ${{ matrix.java }}
- name: Cache scala dependencies
uses: coursier/cache-action@v6
- name: Run tests
run: sbt ++${{ matrix.scala }}! test

ci:
runs-on: ubuntu-20.04
needs: [lint, mdoc, test]
steps:
- uses: actions/checkout@v2.3.4
- uses: olafurpg/setup-scala@v10
with:
java-version: ${{ matrix.java }}
- name: Cache scala dependencies
uses: coursier/cache-action@v5
- name: Lint code
run: sbt check
- name: Run tests
run: sbt ++${{ matrix.scala }}! test
- name: Report successful build
run: echo "ci passed"

publish:
runs-on: ubuntu-20.04
needs: [build]
timeout-minutes: 30
needs: [ci]
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v2.3.4
- name: Checkout current branch
uses: actions/checkout@v2.3.4
with:
fetch-depth: 0
- uses: olafurpg/setup-scala@v10
- run: sbt ci-release
- name: Setup Scala and Java
uses: olafurpg/setup-scala@v10
- name: Cache scala dependencies
uses: coursier/cache-action@v6
- name: Release artifacts
run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: Release Drafter

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

jobs:
update_release_draft:
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/mdoc.yml → .github/workflows/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ name: Website
on:
push:
branches: [master]
tags: ["*"]
release:
types:
- published

jobs:
publish:
runs-on: ubuntu-20.04
timeout-minutes: 30
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v2
- uses: olafurpg/setup-scala@v10
- uses: olafurpg/setup-gpg@v3
- run: sbt docs/docusaurusPublishGhpages
env:
GIT_DEPLOY_KEY: ${{ secrets.GIT_DEPLOY_KEY }}
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-nio"]
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
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v10.8.0
14.16.1
1 change: 0 additions & 1 deletion .scala-steward.conf

This file was deleted.

27 changes: 27 additions & 0 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
rules = [
Disable
DisableSyntax
ExplicitResultTypes
LeakingImplicitClassVal
NoAutoTupling
NoValInForComprehension
OrganizeImports
ProcedureSyntax
RemoveUnused
]

Disable {
ifSynthetic = [
"scala/Option.option2Iterable"
"scala/Predef.any2stringadd"
]
}

OrganizeImports {
# Allign with IntelliJ IDEA so that they don't fight each other
groupedImports = Merge
}

RemoveUnused {
imports = false // handled by OrganizeImports
}
49 changes: 23 additions & 26 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,27 @@ inThisBuild(
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
developers := List(
Developer("jdegoes", "John De Goes", "john@degoes.net", 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-nio/"),
"scm:git:git@github.com:zio/zio-nio.git"
)
)
)
)

ThisBuild / publishTo := sonatypePublishToBundle.value

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

val zioVersion = "1.0.7"

lazy val zioNioCore = project
.in(file("nio-core"))
.settings(stdSettings("zio-nio-core"))
.settings(
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % ZioCoreVersion,
"dev.zio" %% "zio-streams" % ZioCoreVersion,
"dev.zio" %% "zio-test" % ZioCoreVersion % Test,
"dev.zio" %% "zio-test-sbt" % ZioCoreVersion % Test
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-streams" % zioVersion,
("org.scala-lang.modules" %% "scala-collection-compat" % "2.4.3").cross(CrossVersion.for3Use2_13),
"dev.zio" %% "zio-test" % zioVersion % Test,
"dev.zio" %% "zio-test-sbt" % zioVersion % Test
),
testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework"))
)
Expand All @@ -45,10 +39,10 @@ lazy val zioNio = project
.settings(stdSettings("zio-nio"))
.settings(
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % ZioCoreVersion,
"dev.zio" %% "zio-streams" % ZioCoreVersion,
"dev.zio" %% "zio-test" % ZioCoreVersion % Test,
"dev.zio" %% "zio-test-sbt" % ZioCoreVersion % Test
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-streams" % zioVersion,
"dev.zio" %% "zio-test" % zioVersion % Test,
"dev.zio" %% "zio-test-sbt" % zioVersion % Test
),
testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework"))
)
Expand All @@ -57,21 +51,24 @@ lazy val zioNio = project
lazy val docs = project
.in(file("zio-nio-docs"))
.settings(
skip.in(publish) := true,
publish / skip := true,
moduleName := "zio-nio-docs",
scalacOptions -= "-Yno-imports",
scalacOptions -= "-Xfatal-warnings",
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % ZioCoreVersion
)
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(zioNioCore, zioNio),
ScalaUnidoc / unidoc / target := (LocalRootProject / baseDirectory).value / "website" / "static" / "api",
cleanFiles += (ScalaUnidoc / unidoc / target).value,
docusaurusCreateSite := docusaurusCreateSite.dependsOn(Compile / unidoc).value,
docusaurusPublishGhpages := docusaurusPublishGhpages.dependsOn(Compile / unidoc).value
)
.dependsOn(zioNio)
.enablePlugins(MdocPlugin, DocusaurusPlugin)
.dependsOn(zioNioCore, zioNio)
.enablePlugins(MdocPlugin, DocusaurusPlugin, ScalaUnidocPlugin)

lazy val examples = project
.in(file("examples"))
.settings(stdSettings("examples"))
.settings(
skip in publish := true,
publish / skip := true,
moduleName := "examples"
)
.settings(dottySettings)
Expand Down
7 changes: 3 additions & 4 deletions nio-core/src/main/scala/zio/nio/core/Buffer.scala
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
package zio.nio.core

import zio.{ Chunk, UIO, ZIO }

import java.nio.{
ByteOrder,
Buffer => JBuffer,
ByteBuffer => JByteBuffer,
ByteOrder,
CharBuffer => JCharBuffer,
DoubleBuffer => JDoubleBuffer,
FloatBuffer => JFloatBuffer,
IntBuffer => JIntBuffer,
LongBuffer => JLongBuffer,
ShortBuffer => JShortBuffer
}

import zio.{ Chunk, UIO, ZIO }

import scala.reflect.ClassTag

/**
Expand Down
3 changes: 2 additions & 1 deletion nio-core/src/main/scala/zio/nio/core/ByteBuffer.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package zio.nio.core

import zio.{ Chunk, UIO, ZIO }
import java.nio.{ ByteOrder, ByteBuffer => JByteBuffer }

import java.nio.{ ByteBuffer => JByteBuffer, ByteOrder }

/**
* A mutable buffer of bytes.
Expand Down
Loading