Skip to content

Commit 7d23664

Browse files
authored
Merge pull request #6 from djspiewak/build/redo
Swapped to sbt-spiewak and implemented ci-release things
2 parents ae63cd0 + 11de558 commit 7d23664

6 files changed

Lines changed: 122 additions & 104 deletions

File tree

.github/workflows/ci.yml

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
strategy:
2828
matrix:
2929
os: [ubuntu-latest]
30-
scala: [2.12.11, 2.13.2, 0.25.0, 0.26.0-RC1]
30+
scala: [0.25.0, 0.26.0-RC1, 2.12.11, 2.13.2]
3131
java: [adopt@1.8]
3232
runs-on: ${{ matrix.os }}
3333
steps:
@@ -81,8 +81,7 @@ jobs:
8181
- name: Check that workflows are up to date
8282
run: sbt ++${{ matrix.scala }} githubWorkflowCheck
8383

84-
- name: Build project
85-
run: sbt ++${{ matrix.scala }} test
84+
- run: sbt ++${{ matrix.scala }} ci
8685

8786
- name: Upload target directory 'target' (${{ matrix.scala }})
8887
uses: actions/upload-artifact@v1
@@ -127,7 +126,7 @@ jobs:
127126
strategy:
128127
matrix:
129128
os: [ubuntu-latest]
130-
scala: [2.12.10]
129+
scala: [2.13.2]
131130
java: [adopt@1.8]
132131
runs-on: ${{ matrix.os }}
133132
steps:
@@ -178,18 +177,6 @@ jobs:
178177
path: ~/.sbt
179178
key: ${{ runner.os }}-sbt-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
180179

181-
- name: Download target directory 'target' (2.12.11)
182-
uses: actions/download-artifact@v1
183-
with:
184-
name: target-${{ matrix.os }}-2.12.11-${{ matrix.java }}-target
185-
path: target
186-
187-
- name: Download target directory 'target' (2.13.2)
188-
uses: actions/download-artifact@v1
189-
with:
190-
name: target-${{ matrix.os }}-2.13.2-${{ matrix.java }}-target
191-
path: target
192-
193180
- name: Download target directory 'target' (0.25.0)
194181
uses: actions/download-artifact@v1
195182
with:
@@ -202,17 +189,17 @@ jobs:
202189
name: target-${{ matrix.os }}-0.26.0-RC1-${{ matrix.java }}-target
203190
path: target
204191

205-
- name: Download target directory 'munit/jvm/target' (2.12.11)
192+
- name: Download target directory 'target' (2.12.11)
206193
uses: actions/download-artifact@v1
207194
with:
208-
name: target-${{ matrix.os }}-2.12.11-${{ matrix.java }}-munit_jvm_target
209-
path: munit/jvm/target
195+
name: target-${{ matrix.os }}-2.12.11-${{ matrix.java }}-target
196+
path: target
210197

211-
- name: Download target directory 'munit/jvm/target' (2.13.2)
198+
- name: Download target directory 'target' (2.13.2)
212199
uses: actions/download-artifact@v1
213200
with:
214-
name: target-${{ matrix.os }}-2.13.2-${{ matrix.java }}-munit_jvm_target
215-
path: munit/jvm/target
201+
name: target-${{ matrix.os }}-2.13.2-${{ matrix.java }}-target
202+
path: target
216203

217204
- name: Download target directory 'munit/jvm/target' (0.25.0)
218205
uses: actions/download-artifact@v1
@@ -226,17 +213,17 @@ jobs:
226213
name: target-${{ matrix.os }}-0.26.0-RC1-${{ matrix.java }}-munit_jvm_target
227214
path: munit/jvm/target
228215

229-
- name: Download target directory 'core/js/target' (2.12.11)
216+
- name: Download target directory 'munit/jvm/target' (2.12.11)
230217
uses: actions/download-artifact@v1
231218
with:
232-
name: target-${{ matrix.os }}-2.12.11-${{ matrix.java }}-core_js_target
233-
path: core/js/target
219+
name: target-${{ matrix.os }}-2.12.11-${{ matrix.java }}-munit_jvm_target
220+
path: munit/jvm/target
234221

235-
- name: Download target directory 'core/js/target' (2.13.2)
222+
- name: Download target directory 'munit/jvm/target' (2.13.2)
236223
uses: actions/download-artifact@v1
237224
with:
238-
name: target-${{ matrix.os }}-2.13.2-${{ matrix.java }}-core_js_target
239-
path: core/js/target
225+
name: target-${{ matrix.os }}-2.13.2-${{ matrix.java }}-munit_jvm_target
226+
path: munit/jvm/target
240227

241228
- name: Download target directory 'core/js/target' (0.25.0)
242229
uses: actions/download-artifact@v1
@@ -250,17 +237,17 @@ jobs:
250237
name: target-${{ matrix.os }}-0.26.0-RC1-${{ matrix.java }}-core_js_target
251238
path: core/js/target
252239

253-
- name: Download target directory 'core/jvm/target' (2.12.11)
240+
- name: Download target directory 'core/js/target' (2.12.11)
254241
uses: actions/download-artifact@v1
255242
with:
256-
name: target-${{ matrix.os }}-2.12.11-${{ matrix.java }}-core_jvm_target
257-
path: core/jvm/target
243+
name: target-${{ matrix.os }}-2.12.11-${{ matrix.java }}-core_js_target
244+
path: core/js/target
258245

259-
- name: Download target directory 'core/jvm/target' (2.13.2)
246+
- name: Download target directory 'core/js/target' (2.13.2)
260247
uses: actions/download-artifact@v1
261248
with:
262-
name: target-${{ matrix.os }}-2.13.2-${{ matrix.java }}-core_jvm_target
263-
path: core/jvm/target
249+
name: target-${{ matrix.os }}-2.13.2-${{ matrix.java }}-core_js_target
250+
path: core/js/target
264251

265252
- name: Download target directory 'core/jvm/target' (0.25.0)
266253
uses: actions/download-artifact@v1
@@ -274,17 +261,17 @@ jobs:
274261
name: target-${{ matrix.os }}-0.26.0-RC1-${{ matrix.java }}-core_jvm_target
275262
path: core/jvm/target
276263

277-
- name: Download target directory 'munit/js/target' (2.12.11)
264+
- name: Download target directory 'core/jvm/target' (2.12.11)
278265
uses: actions/download-artifact@v1
279266
with:
280-
name: target-${{ matrix.os }}-2.12.11-${{ matrix.java }}-munit_js_target
281-
path: munit/js/target
267+
name: target-${{ matrix.os }}-2.12.11-${{ matrix.java }}-core_jvm_target
268+
path: core/jvm/target
282269

283-
- name: Download target directory 'munit/js/target' (2.13.2)
270+
- name: Download target directory 'core/jvm/target' (2.13.2)
284271
uses: actions/download-artifact@v1
285272
with:
286-
name: target-${{ matrix.os }}-2.13.2-${{ matrix.java }}-munit_js_target
287-
path: munit/js/target
273+
name: target-${{ matrix.os }}-2.13.2-${{ matrix.java }}-core_jvm_target
274+
path: core/jvm/target
288275

289276
- name: Download target directory 'munit/js/target' (0.25.0)
290277
uses: actions/download-artifact@v1
@@ -298,10 +285,25 @@ jobs:
298285
name: target-${{ matrix.os }}-0.26.0-RC1-${{ matrix.java }}-munit_js_target
299286
path: munit/js/target
300287

288+
- name: Download target directory 'munit/js/target' (2.12.11)
289+
uses: actions/download-artifact@v1
290+
with:
291+
name: target-${{ matrix.os }}-2.12.11-${{ matrix.java }}-munit_js_target
292+
path: munit/js/target
293+
294+
- name: Download target directory 'munit/js/target' (2.13.2)
295+
uses: actions/download-artifact@v1
296+
with:
297+
name: target-${{ matrix.os }}-2.13.2-${{ matrix.java }}-munit_js_target
298+
path: munit/js/target
299+
301300
- name: Download target directory 'project/target'
302301
uses: actions/download-artifact@v1
303302
with:
304303
name: target-${{ matrix.os }}-${{ matrix.java }}-project_target
305304
path: project/target
306305

307-
- run: sbt ++${{ matrix.scala }} ci-release
306+
- name: Import signing key
307+
run: echo $PGP_SECRET | gpg --import
308+
309+
- run: sbt ++${{ matrix.scala }} release

build.sbt

Lines changed: 27 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
import sbtcrossproject.CrossPlugin.autoImport.crossProject
22
import sbtcrossproject.CrossPlugin.autoImport.CrossType
33

4-
ThisBuild / crossScalaVersions := List("2.12.11", "2.13.2", "0.25.0", "0.26.0-RC1")
4+
ThisBuild / baseVersion := "0.0"
5+
6+
ThisBuild / organization := "org.typelevel"
7+
ThisBuild / organizationName := "Typelevel"
8+
9+
ThisBuild / publishGithubUser := "mpilquist"
10+
ThisBuild / publishFullName := "Michael Pilquist"
11+
12+
ThisBuild / crossScalaVersions := List("0.25.0", "0.26.0-RC1", "2.12.11", "2.13.2")
513

614
ThisBuild / githubWorkflowPublishTargetBranches := Seq(
715
RefPredicate.Equals(Ref.Branch("main")),
@@ -14,87 +22,51 @@ ThisBuild / githubWorkflowEnv ++= Map(
1422
"PGP_PASSPHRASE" -> s"$${{ secrets.PGP_PASSPHRASE }}"
1523
)
1624
ThisBuild / githubWorkflowTargetTags += "v*"
17-
ThisBuild / githubWorkflowPublish := Seq(WorkflowStep.Sbt(List("ci-release")))
1825

26+
ThisBuild / githubWorkflowPublishPreamble +=
27+
WorkflowStep.Run(
28+
List("echo $PGP_SECRET | gpg --import"),
29+
name = Some("Import signing key"))
30+
31+
ThisBuild / githubWorkflowPublish := Seq(WorkflowStep.Sbt(List("release")))
1932

2033
lazy val root = project.in(file("."))
2134
.aggregate(core.jvm, core.js, munit.jvm, munit.js)
22-
.settings(
23-
publish := {},
24-
publishLocal := {},
25-
publishArtifact := false
26-
)
35+
.settings(noPublishSettings)
2736

2837
val commonSettings = Seq(
29-
organization := "org.typelevel",
3038
homepage := Some(url("https://github.com/typelevel/scalacheck-effect")),
3139
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
32-
developers := List(
33-
Developer(
34-
"mpilquist",
35-
"Michael Pilquist",
36-
"mpilquist@gmail.com",
37-
url("https://github.com/mpilquist")
38-
)
39-
),
40-
41-
scalacOptions ++= List("-feature", "-language:higherKinds,implicitConversions") ++
42-
(scalaBinaryVersion.value match {
43-
case v if v.startsWith("2.13") => List("-Xlint", "-Yrangepos")
44-
case v if v.startsWith("2.12") => Nil
45-
case v if v.startsWith("0.") => Nil
46-
case other => sys.error(s"Unsupported scala version: $other")
47-
}),
4840

4941
libraryDependencies ++= {
5042
if (isDotty.value) Nil
5143
else Seq(scalafixSemanticdb)
5244
},
5345

54-
crossScalaVersions := {
55-
val default = crossScalaVersions.value
56-
if (crossProjectPlatform.value.identifier != "jvm")
57-
default.filter(_.startsWith("2."))
58-
else
59-
default
60-
},
61-
62-
scalafmtOnCompile := true,
63-
64-
Compile / doc / sources := {
65-
val old = (Compile / doc / sources).value
66-
if (isDotty.value)
67-
Seq()
68-
else
69-
old
70-
},
71-
Test / doc / sources := {
72-
val old = (Test / doc / sources).value
73-
if (isDotty.value)
74-
Seq()
75-
else
76-
old
77-
}
46+
scalafmtOnCompile := true
7847
)
7948

8049
lazy val core = crossProject(JSPlatform, JVMPlatform).settings(commonSettings).settings(
8150
name := "scalacheck-effect",
8251

8352
libraryDependencies ++= List(
84-
("org.typelevel" %%% "cats-core" % "2.1.1").withDottyCompat(scalaVersion.value),
85-
("org.scalacheck" %% "scalacheck" % "1.14.3").withDottyCompat(scalaVersion.value)
86-
)
53+
"org.typelevel" %%% "cats-core" % "2.1.1",
54+
"org.scalacheck" %% "scalacheck" % "1.14.3"),
55+
56+
Compile / scalacOptions ~= { _.filterNot(_ == "-Xfatal-warnings") } // we need to turn this off because scalacheck's API uses Stream, which is deprecated
8757
)
58+
.settings(dottyLibrarySettings)
59+
.settings(dottyJsSettings(ThisBuild / crossScalaVersions))
8860

8961
lazy val munit = crossProject(JSPlatform, JVMPlatform).settings(commonSettings).settings(
9062
name := "scalacheck-effect-munit",
9163

92-
libraryDependencies ++= List(
93-
"org.scalameta" %%% "munit-scalacheck" % "0.7.10",
94-
("org.typelevel" %%% "cats-effect" % "2.1.4" % "test").withDottyCompat(scalaVersion.value)
95-
),
64+
libraryDependencies += "org.typelevel" %%% "cats-effect" % "2.1.4" % Test,
9665

9766
testFrameworks += new TestFramework("munit.Framework")
9867
).jsSettings(
9968
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule))
10069
).dependsOn(core)
70+
.settings(dottyLibrarySettings)
71+
.settings(dottyJsSettings(ThisBuild / crossScalaVersions))
72+
.settings(libraryDependencies += "org.scalameta" %%% "munit-scalacheck" % "0.7.10")

core/shared/src/main/scala/org/scalacheck/effect/PropF.scala

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2020 Typelevel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package org.scalacheck.effect
218

319
import scala.collection.immutable.Stream
@@ -6,9 +22,7 @@ import scala.collection.immutable.Stream.#::
622
import cats.MonadError
723
import cats.implicits._
824
import org.scalacheck.{Arbitrary, Gen, Prop, Shrink, Test}
9-
import org.scalacheck.rng.Seed
1025
import org.scalacheck.util.{FreqMap, Pretty}
11-
import scala.collection.immutable.Stream.Cons
1226

1327
/**
1428
* An effectful property.
@@ -202,7 +216,7 @@ object PropF {
202216
case None => PropF.undecided
203217
}
204218
} catch {
205-
case e: Gen.RetrievalError => PropF.undecided
219+
case _: Gen.RetrievalError => PropF.undecided
206220
}
207221
}
208222

@@ -552,8 +566,8 @@ object PropF {
552566
if (xs.isEmpty) F.pure(res)
553567
else
554568
getFirstFailure(xs).flatMap {
555-
case Right((x2, r2)) => F.pure(res)
556-
case Left((x2, r2)) => shrinker(x2, replOrig(r, r2), shrinks + 1, orig)
569+
case Right((_, _)) => F.pure(res)
570+
case Left((x2, r2)) => shrinker(x2, replOrig(r, r2), shrinks + 1, orig)
557571
}
558572
}
559573

munit/shared/src/main/scala/munit/ScalaCheckEffectSuite.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2020 Typelevel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package munit
218

319
import scala.concurrent.Future

munit/shared/src/test/scala/munit/Example.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2020 Typelevel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package munit
218

319
import cats.effect.IO

project/plugins.sbt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ val scalaJSVersion =
44
addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion)
55
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
66
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.0")
7+
addSbtPlugin("com.codecommit" % "sbt-spiewak" % "0.14.0")
78
addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.8.1")
8-
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.1")
9-
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.3.2")
109
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.19")
11-
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.3")
1210

0 commit comments

Comments
 (0)