Skip to content

Commit

Permalink
Merge pull request #213 from alexarchambault/develop
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
alexarchambault committed May 23, 2021
2 parents 41d1bb7 + a06018a commit a1c12b6
Show file tree
Hide file tree
Showing 34 changed files with 171 additions and 251 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
10 changes: 10 additions & 0 deletions .github/scripts/gpg-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env sh

# from https://github.com/coursier/apps/blob/f1d2bf568bf466a98569a85c3f23c5f3a8eb5360/.github/scripts/gpg-setup.sh

echo $PGP_SECRET | base64 --decode | gpg --import --no-tty --batch --yes

echo "allow-loopback-pinentry" >>~/.gnupg/gpg-agent.conf
echo "pinentry-mode loopback" >>~/.gnupg/gpg.conf

gpg-connect-agent reloadagent /bye
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI
on:
push:
branches:
- master
tags:
- "v*"
pull_request:

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
SCALA_VERSION: ["2.12.13", "2.13.6"]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true
- uses: coursier/cache-action@v6.1
- uses: laughedelic/coursier-setup@v1
with:
jvm: 8
apps: sbt-launcher:1.2.22
- name: Test
run: sbt ++${{ matrix.SCALA_VERSION }} test mimaReportBinaryIssues

publish:
needs: test
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true
- uses: coursier/cache-action@v6.1
- uses: laughedelic/coursier-setup@v1
with:
jvm: 8
apps: sbt-launcher:1.2.22
- run: .github/scripts/gpg-setup.sh
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
- name: Release
run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.idea
/.idea_modules
target/
.bsp/
35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ libraryDependencies +=
compilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.patch)
```

scalacheck-shapeless depends on shapeless 2.3 and scalacheck 1.14. It is built against scala 2.10, 2.11, and 2.12.
scalacheck-shapeless depends on shapeless 2.3 and scalacheck 1.14. It is built against scala 2.12, and 2.13.

If you are using shapeless 2.2 along with scalacheck 1.13, use the `1.0.0` version. If you are
using shapeless 2.2 along with scalacheck 1.12, see the
Expand Down
40 changes: 13 additions & 27 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@

import Aliases._
import Settings._

import sbtcrossproject.crossProject

inThisBuild(List(
Expand All @@ -16,15 +13,22 @@ inThisBuild(List(
))
))

lazy val core = crossProject(JSPlatform, JVMPlatform)
lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.settings(
shared,
name := "scalacheck-shapeless_1.14",
scalaVersion := Scala.scala213,
crossScalaVersions := Scala.all,
scalacOptions ++= Seq(
"-deprecation"
),
name := "scalacheck-shapeless_1.15",
moduleName := name.value, // keep the '.' in name ^
libs ++= Seq(
libraryDependencies ++= Seq(
Deps.scalacheck.value,
Deps.shapeless.value
)
Deps.shapeless.value,
Deps.utest.value % Test
),
testFrameworks += new TestFramework("utest.runner.Framework"),
mimaPreviousArtifacts := Set.empty
)
.jsSettings(
scalaJSStage.in(Test) := FastOptStage
Expand All @@ -33,25 +37,7 @@ lazy val core = crossProject(JSPlatform, JVMPlatform)
lazy val coreJVM = core.jvm
lazy val coreJS = core.js

lazy val test = crossProject(JSPlatform, JVMPlatform)
.dependsOn(core)
.disablePlugins(MimaPlugin)
.settings(
shared,
skip.in(publish) := true,
utest
)
.jsSettings(
scalaJSStage.in(Test) := FastOptStage
)

lazy val testJVM = test.jvm
lazy val testJS = test.js


disablePlugins(MimaPlugin)
skip.in(publish) := true
crossScalaVersions := Nil

ThisBuild / evictionRules += "org.scala-js" % "*" % "semver"
ThisBuild / compatibilityRules += "org.scala-js" % "*" % "semver"
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ object MkArbitrary extends MkArbitraryLowPriority {
)
)

@deprecated("Kept for binary compatibility purposes only.")
@deprecated("Kept for binary compatibility purposes only.", "1.1.7")
def genericCoproduct[S, C <: Coproduct](
gen: Generic.Aux[S, C],
mkArb: Lazy[MkCoproductArbitrary[C]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ object MkShrink {
def shrink = shrink0
}

private def lazyxmap[T, U](from: T => U, to: U => T)(st: => Shrink[T]): Shrink[U] = Shrink[U] { u: U
private def lazyxmap[T, U](from: T => U, to: U => T)(st: => Shrink[T]): Shrink[U] = Shrink[U] { u: U =>
st.shrink(to(u)).map(from)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.scalacheck

import org.scalacheck.derive._

import shapeless._
import shapeless.{test => _, _}
import shapeless.labelled.FieldType
import shapeless.record._
import shapeless.union._
Expand Down Expand Up @@ -487,12 +487,12 @@ object ArbitraryTests extends TestSuite {

val tests = TestSuite {

'compareSuccess - {
test("compareSuccess") {
val arb = Arbitrary.arbInt.arbitrary
compareArbitrary(arb, arb)
}

'compareFailure - {
test("compareFailure") {
val arb = Arbitrary.arbInt
val result =
try {
Expand All @@ -506,7 +506,7 @@ object ArbitraryTests extends TestSuite {
assert(result)
}

'empty - {
test("empty") {
val expectedArb =
MkArbitrary.genericProduct(
Generic[Empty.type],
Expand All @@ -517,7 +517,7 @@ object ArbitraryTests extends TestSuite {
compareArbitrary(expectedArb.arbitrary, gen)
}

'emptyCC - {
test("emptyCC") {
val expectedArb =
MkArbitrary.genericProduct(
Generic[EmptyCC],
Expand All @@ -528,114 +528,114 @@ object ArbitraryTests extends TestSuite {
compareArbitrary(expectedArb.arbitrary, gen)
}

'simple - {
test("simple") {
val gen = Arbitrary.arbitrary[Simple]
compareArbitrary(expectedSimpleArb.arbitrary, gen)
}

'simpleHList - {
test("simpleHList") {
val gen = Arbitrary.arbitrary[Int :: String :: Boolean :: HNil]
compareArbitrary(expectedIntStringBoolArb.arbitrary, gen)
}

'simpleCoproduct - {
test("simpleCoproduct") {
val gen = Arbitrary.arbitrary[Int :+: String :+: Boolean :+: CNil]
compareArbitrary(expectedIntStringBoolCoproductArb.arbitrary, gen)
}

'composed - {
test("composed") {
val gen = Arbitrary.arbitrary[Composed]
compareArbitrary(expectedComposedArb.arbitrary, gen)
}

'twiceComposed - {
test("twiceComposed") {
val gen = Arbitrary.arbitrary[TwiceComposed]
compareArbitrary(expectedTwiceComposedArb.arbitrary, gen)
}

'composedOptList - {
test("composedOptList") {
val gen = Arbitrary.arbitrary[ComposedOptList]
compareArbitrary(expectedComposedOptListArb.arbitrary, gen)
}

'base - {
test("base") {
val gen = Arbitrary.arbitrary[Base]
compareArbitrary(expectedBaseArb.arbitrary, gen)
}

'tree1 - {
test("tree1") {
val gen = Arbitrary.arbitrary[T1.Tree]
compareArbitrary(expectedT1TreeArbitrary.arbitrary, gen)
}

'tree2 - {
test("tree2") {
val gen = Arbitrary.arbitrary[T2.Tree]
compareArbitrary(expectedT2TreeArbitrary.arbitrary, gen)
}

'a - {
test("a") {
val gen = Arbitrary.arbitrary[A]
compareArbitrary(expectedAArbitrary.arbitrary, gen)
}

'd - {
test("d") {
val gen = Arbitrary.arbitrary[D]
compareArbitrary(expectedDArbitrary.arbitrary, gen)
}

'list - {
test("list") {
val expected = Arbitrary.arbContainer[List, Int](Arbitrary.arbInt, implicitly, identity)
val gen = Arbitrary.arbitrary[List[Int]]
compareArbitrary(expected.arbitrary, gen)
}

'option - {
test("option") {
val expected = Arbitrary.arbOption(Arbitrary.arbInt)
val gen = Arbitrary.arbitrary[Option[Int]]
compareArbitrary(expected.arbitrary, gen)
}

'singleton - {
'simple - {
test("singleton") {
test("simple") {
val expected = Arbitrary(Gen.const(2: Witness.`2`.T))
val gen = Arbitrary.arbitrary[Witness.`2`.T]
compareArbitrary(expected.arbitrary, gen)
}

'caseClass - {
test("caseClass") {
val gen = Arbitrary.arbitrary[CCWithSingleton]
compareArbitrary(expectedCCWithSingletonArb.arbitrary, gen)
}

'ADT - {
test("ADT") {
val gen = Arbitrary.arbitrary[BaseWithSingleton]
compareArbitrary(expectedBaseWithSingletonArb.arbitrary, gen)
}
}

'shapeless - {
'hlist - {
test("shapeless") {
test("hlist") {
val gen = Arbitrary.arbitrary[L]
compareArbitrary(expectetLArbitrary.arbitrary, gen)
}

'record - {
test("record") {
val gen = Arbitrary.arbitrary[Rec]
compareArbitrary(expectetRecArbitrary.arbitrary, gen)
}

'copproduct - {
test("copproduct") {
val gen = Arbitrary.arbitrary[C0]
compareArbitrary(expectetC0Arbitrary.arbitrary, gen)
}

'union - {
test("union") {
val gen = Arbitrary.arbitrary[Un]
compareArbitrary(expectedUnionArbitrary.arbitrary, gen)
}
}

'enumeration - {
test("enumeration") {
val expected = Arbitrary(Gen.oneOf(WeekDay.values.toSeq))
val gen = Arbitrary.arbitrary[WeekDay.Value]
compareArbitrary(expected.arbitrary, gen)
Expand Down
Loading

0 comments on commit a1c12b6

Please sign in to comment.