Skip to content

Commit d224a0d

Browse files
authored
Merge pull request #3666 from djspiewak/bug/not-working
Things weren't working, now I think they are
2 parents eca863f + 1388554 commit d224a0d

File tree

2 files changed

+76
-46
lines changed

2 files changed

+76
-46
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
strategy:
2323
matrix:
2424
os: [ubuntu-latest]
25-
scala: [2.12.12, 2.13.3, 0.27.0-RC1]
25+
scala: [2.12.12, 2.13.3, 0.27.0-RC1, 3.0.0-M1]
2626
java:
2727
- adopt@1.8
2828
- adopt@1.11
@@ -32,12 +32,24 @@ jobs:
3232
exclude:
3333
- platform: js
3434
scala: 0.27.0-RC1
35+
- platform: js
36+
scala: 3.0.0-M1
3537
- platform: js
3638
java: adopt@1.11
3739
- platform: js
3840
java: adopt@1.15
3941
- platform: js
4042
java: graalvm-ce-java8@20.2.0
43+
- platform: jvm
44+
java: adopt@1.15
45+
scala: 3.0.0-M1
46+
- platform: js
47+
java: adopt@1.15
48+
scala: 3.0.0-M1
49+
- platform: js
50+
scala: 0.27.0-RC1
51+
- platform: js
52+
scala: 3.0.0-M1
4153
runs-on: ${{ matrix.os }}
4254
steps:
4355
- name: Checkout current branch (full)
@@ -97,37 +109,37 @@ jobs:
97109
run: sbt ++${{ matrix.scala }} validateAllJS
98110

99111
- name: Setup Python
100-
if: matrix.platform == 'jvm' && matrix.scala != '0.27.0-RC1'
112+
if: matrix.platform == 'jvm' && (matrix.scala != '0.27.0-RC1' && matrix.scala != '3.0.0-M1')
101113
uses: actions/setup-python@v2
102114
with:
103115
python-version: 3.x
104116

105117
- name: Setup codecov
106-
if: matrix.platform == 'jvm' && matrix.scala != '0.27.0-RC1'
118+
if: matrix.platform == 'jvm' && (matrix.scala != '0.27.0-RC1' && matrix.scala != '3.0.0-M1')
107119
run: pip install codecov
108120

109121
- name: Validate JVM (scala 2)
110-
if: matrix.platform == 'jvm' && matrix.scala != '0.27.0-RC1'
122+
if: matrix.platform == 'jvm' && (matrix.scala != '0.27.0-RC1' && matrix.scala != '3.0.0-M1')
111123
run: sbt ++${{ matrix.scala }} coverage buildJVM bench/test coverageReport
112124

113125
- name: Validate JVM (scala 3)
114-
if: matrix.platform == 'jvm' && matrix.scala == '0.27.0-RC1'
126+
if: matrix.platform == 'jvm' && (matrix.scala == '0.27.0-RC1' || matrix.scala == '3.0.0-M1')
115127
run: sbt ++${{ matrix.scala }} buildJVM bench/test
116128

117129
- name: Upload Codecov Results
118-
if: matrix.platform == 'jvm' && matrix.scala != '0.27.0-RC1'
130+
if: matrix.platform == 'jvm' && (matrix.scala != '0.27.0-RC1' && matrix.scala != '3.0.0-M1')
119131
run: codecov -F ${{ matrix.scala }}
120132

121133
- name: Binary compatibility ${{ matrix.scala }}
122-
if: matrix.platform == 'jvm' && matrix.scala != '0.27.0-RC1'
134+
if: matrix.platform == 'jvm' && (matrix.scala != '0.27.0-RC1' && matrix.scala != '3.0.0-M1')
123135
run: sbt ++${{ matrix.scala }} clean validateBC
124136

125137
scalafix:
126138
name: Scalafix
127139
strategy:
128140
matrix:
129141
os: [ubuntu-latest]
130-
scala: [2.12.12, 2.13.3, 0.27.0-RC1]
142+
scala: [2.12.12, 2.13.3, 0.27.0-RC1, 3.0.0-M1]
131143
java: [adopt@1.8]
132144
runs-on: ${{ matrix.os }}
133145
steps:
@@ -190,7 +202,7 @@ jobs:
190202
strategy:
191203
matrix:
192204
os: [ubuntu-latest]
193-
scala: [2.12.12, 2.13.3, 0.27.0-RC1]
205+
scala: [2.12.12, 2.13.3, 0.27.0-RC1, 3.0.0-M1]
194206
java: [adopt@1.8]
195207
runs-on: ${{ matrix.os }}
196208
steps:
@@ -244,7 +256,7 @@ jobs:
244256
key: ${{ runner.os }}-sbt-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
245257

246258
- name: Check formatting
247-
if: matrix.scala != '0.27.0-RC1'
259+
if: (matrix.scala != '0.27.0-RC1' && matrix.scala != '3.0.0-M1')
248260
run: sbt ++${{ matrix.scala }} fmtCheck
249261

250262
microsite:

build.sbt

Lines changed: 54 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
11
import microsites._
22
import ReleaseTransformations._
33
import sbt.io.Using
4+
import com.jsuereth.sbtpgp.PgpKeys
45

56
import scala.xml.transform.{RewriteRule, RuleTransformer}
67
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
78

9+
lazy val publishSignedIfRelevant = taskKey[Unit]("Runs publishSigned but only if scalaVersion in crossScalaVersions")
10+
Global / publishSignedIfRelevant := PgpKeys.publishSigned.value
11+
12+
lazy val publishLocalSignedIfRelevant =
13+
taskKey[Unit]("Runs publishLocalSigned but only if scalaVersion in crossScalaVersions")
14+
Global / publishLocalSignedIfRelevant := PgpKeys.publishLocalSigned.value
15+
816
lazy val scoverageSettings = Seq(
917
coverageMinimum := 60,
1018
coverageFailOnMinimum := false,
1119
coverageHighlighting := true
1220
)
1321

1422
organization in ThisBuild := "org.typelevel"
15-
scalafixDependencies in ThisBuild += "org.typelevel" %% "simulacrum-scalafix" % "0.5.0"
23+
scalafixDependencies in ThisBuild += "org.typelevel" %% "simulacrum-scalafix" % "0.5.1"
1624

1725
val scalaCheckVersion = "1.15.0"
1826

1927
val disciplineVersion = "1.1.0"
2028

2129
val disciplineScalatestVersion = "2.0.1"
22-
val disciplineMunitVersion = "1.0.0"
30+
val disciplineMunitVersion = "1.0.1"
2331

2432
val kindProjectorVersion = "0.11.0"
2533

@@ -35,32 +43,46 @@ ThisBuild / githubWorkflowJavaVersions := Seq(PrimaryJava, LTSJava, LatestJava,
3543

3644
val Scala212 = "2.12.12"
3745
val Scala213 = "2.13.3"
38-
val Dotty = "0.27.0-RC1"
46+
val DottyOld = "0.27.0-RC1"
47+
val DottyNew = "3.0.0-M1"
3948

40-
ThisBuild / crossScalaVersions := Seq(Scala212, Scala213, Dotty)
49+
ThisBuild / crossScalaVersions := Seq(Scala212, Scala213, DottyOld, DottyNew)
4150
ThisBuild / scalaVersion := Scala213
4251

4352
ThisBuild / githubWorkflowPublishTargetBranches := Seq() // disable publication for now
4453

4554
ThisBuild / githubWorkflowBuildMatrixAdditions +=
4655
"platform" -> List("jvm", "js")
4756

48-
ThisBuild / githubWorkflowBuildMatrixExclusions +=
49-
MatrixExclude(Map("platform" -> "js", "scala" -> Dotty))
57+
ThisBuild / githubWorkflowBuildMatrixExclusions ++=
58+
crossScalaVersions.value.filterNot(_.startsWith("2.")).map(v => MatrixExclude(Map("platform" -> "js", "scala" -> v)))
5059

5160
ThisBuild / githubWorkflowBuildMatrixExclusions ++=
5261
githubWorkflowJavaVersions.value.filterNot(Set(PrimaryJava)).map { java =>
5362
MatrixExclude(Map("platform" -> "js", "java" -> java))
5463
}
5564

65+
ThisBuild / githubWorkflowBuildMatrixExclusions ++=
66+
Seq("jvm", "js").map { platform =>
67+
MatrixExclude(
68+
Map("platform" -> platform, "java" -> LatestJava, "scala" -> DottyNew)
69+
) // 3.0.0-M1 doesn't work on JDK 14+
70+
}
71+
72+
// exclude DottyJS for now
73+
ThisBuild / githubWorkflowBuildMatrixExclusions ++=
74+
crossScalaVersions.value.filterNot(_.startsWith("2.")).map { scala =>
75+
MatrixExclude(Map("platform" -> "js", "scala" -> scala))
76+
}
77+
5678
// we don't need this since we aren't publishing
5779
ThisBuild / githubWorkflowArtifactUpload := false
5880

5981
val JvmCond = s"matrix.platform == 'jvm'"
6082
val JsCond = s"matrix.platform == 'js'"
6183

62-
val Scala2Cond = s"matrix.scala != '$Dotty'"
63-
val Scala3Cond = s"matrix.scala == '$Dotty'"
84+
val Scala2Cond = s"(matrix.scala != '$DottyOld' && matrix.scala != '$DottyNew')"
85+
val Scala3Cond = s"(matrix.scala == '$DottyOld' || matrix.scala == '$DottyNew')"
6486

6587
ThisBuild / githubWorkflowBuild := Seq(
6688
WorkflowStep.Sbt(List("validateAllJS"), name = Some("Validate JavaScript"), cond = Some(JsCond)),
@@ -131,9 +153,9 @@ def scalaVersionSpecificFolders(srcName: String, srcBaseDir: java.io.File, scala
131153
List(CrossType.Pure, CrossType.Full)
132154
.flatMap(_.sharedSrcDir(srcBaseDir, srcName).toList.map(f => file(f.getPath + suffix)))
133155
CrossVersion.partialVersion(scalaVersion) match {
134-
case Some((2, y)) => extraDirs("-2.x") ++ (if (y >= 13) extraDirs("-2.13+") else Nil)
135-
case Some((0, _)) => extraDirs("-2.13+") ++ extraDirs("-3.x")
136-
case _ => Nil
156+
case Some((2, y)) => extraDirs("-2.x") ++ (if (y >= 13) extraDirs("-2.13+") else Nil)
157+
case Some((0 | 3, _)) => extraDirs("-2.13+") ++ extraDirs("-3.x")
158+
case _ => Nil
137159
}
138160
}
139161

@@ -142,8 +164,6 @@ ThisBuild / mimaFailOnNoPrevious := false
142164
def doctestGenTestsDottyCompat(isDotty: Boolean, genTests: Seq[File]): Seq[File] =
143165
if (isDotty) Nil else genTests
144166

145-
lazy val dottySettings = Seq(crossScalaVersions += Dotty)
146-
147167
lazy val commonSettings = Seq(
148168
scalacOptions ++= commonScalacOptions(scalaVersion.value, isDotty.value),
149169
Compile / unmanagedSourceDirectories ++= scalaVersionSpecificFolders("main", baseDirectory.value, scalaVersion.value),
@@ -158,7 +178,24 @@ lazy val commonSettings = Seq(
158178
Seq()
159179
else
160180
old
161-
}
181+
},
182+
// copying this trick from sbt-spiewak for now
183+
publishSignedIfRelevant := Def.taskDyn {
184+
val ver = scalaVersion.value
185+
val cross = crossScalaVersions.value
186+
if (cross.contains(ver))
187+
Def.task(PgpKeys.publishSigned.value)
188+
else
189+
Def.task(streams.value.log.warn(s"skipping `publishSigned` in ${name.value}: $ver is not in $cross"))
190+
}.value,
191+
publishLocalSignedIfRelevant := Def.taskDyn {
192+
val ver = scalaVersion.value
193+
val cross = crossScalaVersions.value
194+
if (cross.contains(ver))
195+
Def.task(PgpKeys.publishLocalSigned.value)
196+
else
197+
Def.task(streams.value.log.warn(s"skipping `publishLocalSigned` in ${name.value}: $ver is not in $cross"))
198+
}.value
162199
) ++ warnUnusedImport
163200

164201
def macroDependencies(scalaVersion: String) =
@@ -180,28 +217,15 @@ lazy val simulacrumSettings = Seq(
180217
scalacOptions ++= (
181218
if (isDotty.value) Nil else Seq(s"-P:semanticdb:targetroot:${baseDirectory.value}/target/.semanticdb", "-Yrangepos")
182219
),
183-
libraryDependencies +=
184-
("org.typelevel" %% "simulacrum-scalafix-annotations" % "0.5.1" % Provided).withDottyCompat(scalaVersion.value),
185-
pomPostProcess := { (node: xml.Node) =>
186-
new RuleTransformer(new RewriteRule {
187-
override def transform(node: xml.Node): Seq[xml.Node] =
188-
node match {
189-
case e: xml.Elem
190-
if e.label == "dependency" &&
191-
e.child.exists(child => child.label == "groupId" && child.text == "org.typelevel") &&
192-
e.child.exists(child => child.label == "artifactId" && child.text.startsWith("simulacrum")) =>
193-
Nil
194-
case _ => Seq(node)
195-
}
196-
}).transform(node).head
197-
}
220+
libraryDependencies += "org.typelevel" %% "simulacrum-scalafix-annotations" % "0.5.1"
198221
)
199222

200223
lazy val tagName = Def.setting {
201224
s"v${if (releaseUseGlobalVersion.value) (version in ThisBuild).value else version.value}"
202225
}
203226

204227
lazy val commonJsSettings = Seq(
228+
crossScalaVersions := crossScalaVersions.value.filter(_.startsWith("2.")),
205229
scalacOptions += {
206230
val tv = tagName.value
207231
val tagOrHash =
@@ -595,7 +619,6 @@ lazy val kernel = crossProject(JSPlatform, JVMPlatform)
595619
.settings(
596620
libraryDependencies += "org.scalacheck" %%% "scalacheck" % scalaCheckVersion % Test
597621
)
598-
.jvmSettings(dottySettings)
599622

600623
lazy val kernelLaws = crossProject(JSPlatform, JVMPlatform)
601624
.in(file("kernel-laws"))
@@ -610,7 +633,6 @@ lazy val kernelLaws = crossProject(JSPlatform, JVMPlatform)
610633
.jvmSettings(commonJvmSettings ++ mimaSettings("cats-kernel-laws", includeCats1 = false))
611634
.jsSettings(coverageEnabled := false)
612635
.dependsOn(kernel)
613-
.jvmSettings(dottySettings)
614636

615637
lazy val core = crossProject(JSPlatform, JVMPlatform)
616638
.crossType(CrossType.Pure)
@@ -632,7 +654,6 @@ lazy val core = crossProject(JSPlatform, JVMPlatform)
632654
)
633655
.jsSettings(commonJsSettings)
634656
.jvmSettings(commonJvmSettings ++ mimaSettings("cats-core"))
635-
.jvmSettings(dottySettings)
636657

637658
lazy val laws = crossProject(JSPlatform, JVMPlatform)
638659
.crossType(CrossType.Pure)
@@ -644,7 +665,6 @@ lazy val laws = crossProject(JSPlatform, JVMPlatform)
644665
.jsSettings(commonJsSettings)
645666
.jvmSettings(commonJvmSettings ++ mimaSettings("cats-laws", includeCats1 = false))
646667
.jsSettings(coverageEnabled := false)
647-
.jvmSettings(dottySettings)
648668

649669
lazy val free = crossProject(JSPlatform, JVMPlatform)
650670
.crossType(CrossType.Pure)
@@ -689,7 +709,6 @@ lazy val alleycatsCore = crossProject(JSPlatform, JVMPlatform)
689709
.settings(includeGeneratedSrc)
690710
.jsSettings(commonJsSettings)
691711
.jvmSettings(commonJvmSettings ++ mimaSettings("alleycats-core", includeCats1 = false))
692-
.jvmSettings(dottySettings)
693712

694713
lazy val alleycatsLaws = crossProject(JSPlatform, JVMPlatform)
695714
.crossType(CrossType.Pure)
@@ -704,7 +723,6 @@ lazy val alleycatsLaws = crossProject(JSPlatform, JVMPlatform)
704723
.jsSettings(commonJsSettings)
705724
.jvmSettings(commonJvmSettings ++ mimaSettings("alleycats-laws", includeCats1 = false))
706725
.jsSettings(coverageEnabled := false)
707-
.jvmSettings(dottySettings)
708726

709727
lazy val alleycatsTests = crossProject(JSPlatform, JVMPlatform)
710728
.in(file("alleycats-tests"))
@@ -956,7 +974,7 @@ lazy val sharedReleaseProcess = Seq(
956974
setReleaseVersion,
957975
commitReleaseVersion,
958976
tagRelease,
959-
releaseStepCommandAndRemaining("+publishSigned"),
977+
releaseStepCommandAndRemaining("+publishSignedIfRelevant"),
960978
setNextVersion,
961979
commitNextVersion,
962980
releaseStepCommand("sonatypeReleaseAll"),

0 commit comments

Comments
 (0)