Skip to content

Commit

Permalink
Merge branch 'tpolecat:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyhage authored Oct 3, 2022
2 parents 04c17b2 + f67acee commit f8b0d0b
Show file tree
Hide file tree
Showing 27 changed files with 437 additions and 208 deletions.
95 changes: 63 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ name: Continuous Integration

on:
pull_request:
branches: ['**']
branches: ['**', '!update/**', '!pr/**']
push:
branches: ['**']
branches: ['**', '!update/**', '!pr/**']
tags: [v*]

env:
Expand All @@ -28,8 +28,8 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.13, 2.13.8, 3.1.1]
java: [temurin@8]
scala: [2.12.16, 2.13.8, 3.1.3]
java: [temurin@11]
project: [rootJS, rootJVM]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -38,12 +38,21 @@ jobs:
with:
fetch-depth: 0

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v2
- name: Download Java (temurin@11)
id: download-java-temurin-11
if: matrix.java == 'temurin@11'
uses: typelevel/download-java@v1
with:
distribution: temurin
java-version: 8
java-version: 11

- name: Setup Java (temurin@11)
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v2
with:
distribution: jdkfile
java-version: 11
jdkFile: ${{ steps.download-java-temurin-11.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v2
Expand All @@ -66,11 +75,15 @@ jobs:
run: docker-compose up -d

- name: Check that workflows are up to date
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' 'project /' githubWorkflowCheck
run: sbt githubWorkflowCheck

- name: Check Headers
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' headerCheckAll

- name: Check headers and formatting
if: matrix.java == 'temurin@11'
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck

- name: scalaJSLink
if: matrix.project == 'rootJS'
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' Test/scalaJSLinkerResult
Expand All @@ -79,11 +92,11 @@ jobs:
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' test

- name: Check binary compatibility
if: matrix.java == 'temurin@8'
if: matrix.java == 'temurin@11'
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' mimaReportBinaryIssues

- name: Generate API documentation
if: matrix.java == 'temurin@8'
if: matrix.java == 'temurin@11'
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' doc

- name: Check Doc Site (2.13.8 JVM only)
Expand Down Expand Up @@ -113,20 +126,29 @@ jobs:
matrix:
os: [ubuntu-latest]
scala: [2.13.8]
java: [temurin@8]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v2
- name: Download Java (temurin@11)
id: download-java-temurin-11
if: matrix.java == 'temurin@11'
uses: typelevel/download-java@v1
with:
distribution: temurin
java-version: 8
java-version: 11

- name: Setup Java (temurin@11)
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v2
with:
distribution: jdkfile
java-version: 11
jdkFile: ${{ steps.download-java-temurin-11.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v2
Expand All @@ -140,22 +162,22 @@ jobs:
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Download target directories (2.12.13, rootJS)
- name: Download target directories (2.12.16, rootJS)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.13-rootJS
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.16-rootJS

- name: Inflate target directories (2.12.13, rootJS)
- name: Inflate target directories (2.12.16, rootJS)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.12.13, rootJVM)
- name: Download target directories (2.12.16, rootJVM)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.13-rootJVM
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.16-rootJVM

- name: Inflate target directories (2.12.13, rootJVM)
- name: Inflate target directories (2.12.16, rootJVM)
run: |
tar xf targets.tar
rm targets.tar
Expand All @@ -180,22 +202,22 @@ jobs:
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.1.1, rootJS)
- name: Download target directories (3.1.3, rootJS)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.1-rootJS
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.3-rootJS

- name: Inflate target directories (3.1.1, rootJS)
- name: Inflate target directories (3.1.3, rootJS)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.1.1, rootJVM)
- name: Download target directories (3.1.3, rootJVM)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.1-rootJVM
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.3-rootJVM

- name: Inflate target directories (3.1.1, rootJVM)
- name: Inflate target directories (3.1.3, rootJVM)
run: |
tar xf targets.tar
rm targets.tar
Expand Down Expand Up @@ -228,12 +250,21 @@ jobs:
with:
fetch-depth: 0

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v2
- name: Download Java (temurin@11)
id: download-java-temurin-11
if: matrix.java == 'temurin@11'
uses: typelevel/download-java@v1
with:
distribution: temurin
java-version: 8
java-version: 11

- name: Setup Java (temurin@11)
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v2
with:
distribution: jdkfile
java-version: 11
jdkFile: ${{ steps.download-java-temurin-11.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v2
Expand Down
3 changes: 3 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version = "3.5.9"
runner.dialect = Scala213Source3
project.includePaths = [] # disables formatting
62 changes: 29 additions & 33 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ThisBuild / tlBaseVersion := "0.3"
ThisBuild / tlBaseVersion := "0.4"

// Our Scala versions.
lazy val `scala-2.12` = "2.12.13"
lazy val `scala-2.12` = "2.12.16"
lazy val `scala-2.13` = "2.13.8"
lazy val `scala-3.0` = "3.1.1"
lazy val `scala-3.0` = "3.1.3"

ThisBuild / scalaVersion := `scala-2.13`
ThisBuild / crossScalaVersions :=
Expand All @@ -17,7 +17,8 @@ ThisBuild / developers := List(

ThisBuild / tlCiReleaseBranches := Seq("main") // publish snapshits on `main`
ThisBuild / tlSonatypeUseLegacyHost := false
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("8"))
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("11"))
ThisBuild / tlJdkRelease := Some(8)

lazy val setupCertAndDocker = Seq(
WorkflowStep.Run(
Expand Down Expand Up @@ -62,26 +63,21 @@ ThisBuild / githubWorkflowAddedJobs +=
)
)

// https://github.com/sbt/sbt/issues/6997
ThisBuild / libraryDependencySchemes ++= Seq(
"org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always
)

// This is used in a couple places
lazy val fs2Version = "3.2.4"
lazy val fs2Version = "3.2.14"
lazy val natchezVersion = "0.1.6"

// We do `evictionCheck` in CI
inThisBuild(Seq(
evictionRules ++= Seq(
"org.typelevel" % "cats-*" % "semver-spec",
"org.scala-js" % "scalajs-*" % "semver-spec",
"org.portable-scala" % "portable-scala-reflect_*" % "semver-spec",
"io.github.cquiroz" % "scala-java-time_*" % "semver-spec",
)
))

// Global Settings
lazy val commonSettings = Seq(

// Resolvers
resolvers += Resolver.sonatypeRepo("public"),
resolvers += Resolver.sonatypeRepo("snapshots"),
resolvers ++= Resolver.sonatypeOssRepos("public"),
resolvers ++= Resolver.sonatypeOssRepos("snapshots"),

// Headers
headerMappings := headerMappings.value + (HeaderFileType.scala -> HeaderCommentStyle.cppStyleLineComment),
Expand Down Expand Up @@ -147,28 +143,28 @@ lazy val core = crossProject(JVMPlatform, JSPlatform)
.settings(
name := "skunk-core",
description := "Tagless, non-blocking data access library for Postgres.",
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
scalacOptions ~= (_.filterNot(_ == "-source:3.0-migration")),
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % "2.7.0",
"org.typelevel" %%% "cats-effect" % "3.3.5",
"org.typelevel" %%% "cats-core" % "2.8.0",
"org.typelevel" %%% "cats-effect" % "3.3.14",
"co.fs2" %%% "fs2-core" % fs2Version,
"co.fs2" %%% "fs2-io" % fs2Version,
"org.scodec" %%% "scodec-bits" % "1.1.30",
"org.scodec" %%% "scodec-core" % (if (tlIsScala3.value) "2.0.0" else "1.11.9"),
"org.scodec" %%% "scodec-cats" % "1.1.0",
"org.scodec" %%% "scodec-bits" % "1.1.34",
"org.scodec" %%% "scodec-core" % (if (tlIsScala3.value) "2.2.0" else "1.11.10"),
"org.scodec" %%% "scodec-cats" % "1.2.0",
"org.tpolecat" %%% "natchez-core" % natchezVersion,
"org.tpolecat" %%% "sourcepos" % "1.0.1",
"org.scala-lang.modules" %%% "scala-collection-compat" % "2.6.0",
"org.scala-lang.modules" %%% "scala-collection-compat" % "2.8.1",
) ++ Seq(
"com.beachape" %%% "enumeratum" % "1.6.1",
).filterNot(_ => tlIsScala3.value)
).jvmSettings(
libraryDependencies += "com.ongres.scram" % "client" % "2.1",
).jsSettings(
libraryDependencies ++= Seq(
"com.armanbilge" %%% "saslprep" % "0.1.0",
"io.github.cquiroz" %%% "scala-java-time" % "2.3.0",
"io.github.cquiroz" %%% "locales-minimal-en_us-db" % "1.3.0"
"com.armanbilge" %%% "saslprep" % "0.1.1",
"io.github.cquiroz" %%% "scala-java-time" % "2.4.0",
"io.github.cquiroz" %%% "locales-minimal-en_us-db" % "1.4.1"
),
)

Expand All @@ -180,7 +176,7 @@ lazy val refined = crossProject(JVMPlatform, JSPlatform)
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
"eu.timepit" %%% "refined" % "0.9.28",
"eu.timepit" %%% "refined" % "0.9.29",
)
)

Expand All @@ -193,8 +189,8 @@ lazy val circe = crossProject(JVMPlatform, JSPlatform)
.settings(
name := "skunk-circe",
libraryDependencies ++= Seq(
"io.circe" %%% "circe-core" % "0.14.1",
"io.circe" %%% "circe-parser" % "0.14.1"
"io.circe" %%% "circe-core" % "0.14.2",
"io.circe" %%% "circe-parser" % "0.14.2"
)
)

Expand All @@ -209,10 +205,10 @@ lazy val tests = crossProject(JVMPlatform, JSPlatform)
libraryDependencies ++= Seq(
"org.scalameta" %%% "munit" % "0.7.29",
"org.scalameta" % "junit-interface" % "0.7.29",
"org.typelevel" %%% "scalacheck-effect-munit" % "1.0.3",
"org.typelevel" %%% "scalacheck-effect-munit" % "1.0.4",
"org.typelevel" %%% "munit-cats-effect-3" % "1.0.7",
"org.typelevel" %%% "cats-free" % "2.7.0",
"org.typelevel" %%% "cats-laws" % "2.7.0",
"org.typelevel" %%% "cats-free" % "2.8.0",
"org.typelevel" %%% "cats-laws" % "2.8.0",
"org.typelevel" %%% "discipline-munit" % "1.0.9",
) ++ Seq(
"io.chrisdavenport" %%% "cats-time" % "0.3.4",
Expand Down
7 changes: 7 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
coverage:
status:
project:
default:
target: auto
threshold: 1%

6 changes: 0 additions & 6 deletions modules/core/jvm/src/main/scala/SSLPlatform.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ import fs2.io.net.Network
import fs2.io.net.tls.TLSContext

private[skunk] trait SSLCompanionPlatform { this: SSL.type =>

/** `SSL` which trusts all certificates. */
object Trusted extends SSL {
def tlsContext[F[_]: Network](implicit ev: ApplicativeError[F, Throwable]): F[TLSContext[F]] =
Network[F].tlsContext.insecure
}

/** Creates a `SSL` from an `SSLContext`. */
def fromSSLContext(ctx: SSLContext): SSL =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package syntax

import cats.data.State
import cats.syntax.all._
import scala.language.experimental.macros
import scala.reflect.macros.whitebox
import skunk.data.Identifier
import skunk.util.Origin
Expand Down
11 changes: 8 additions & 3 deletions modules/core/shared/src/main/scala-3/syntax/CodecOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@ class CodecOps[A <: Tuple](self: Codec[A]) {
(other, self).contramapN(t => (t.head, t.tail))

def pimap[P <: Product](
using m: Mirror.ProductOf[P] { type MirroredElemTypes = A }
): Codec[P] =
self.imap(m.fromProduct)(p => Tuple.fromProductTyped(p))

// For binary compatibility with Skunk 0.3.1 and prior
private[skunk] def pimap[P <: Product](
using m: Mirror.ProductOf[P],
i: m.MirroredElemTypes =:= A
): Codec[P] =
self.imap(m.fromProduct)(p => i(Tuple.fromProductTyped(p)))

pimap(using m.asInstanceOf)
}

class CodecOpsLow[A](self: Codec[A]) {
Expand All @@ -50,4 +55,4 @@ trait ToCodecOpsLow {
new CodecOpsLow(self)
}

object codec extends ToCodecOps
object codec extends ToCodecOps
Loading

0 comments on commit f8b0d0b

Please sign in to comment.