Skip to content

Commit

Permalink
Merge branch 'main' into feature/free-eq
Browse files Browse the repository at this point in the history
  • Loading branch information
djspiewak committed Jul 27, 2021
2 parents 9cb4125 + 9a13f39 commit 9e79eec
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 30 deletions.
35 changes: 25 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
build:
name: Build and Test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
scala: [2.12.14, 2.13.6, 3.0.1]
Expand Down Expand Up @@ -70,27 +69,43 @@ jobs:
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

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

- name: Validate JavaScript
if: matrix.platform == 'js'
run: sbt --client '++${{ matrix.scala }}; validateAllJS'
run: sbt ++${{ matrix.scala }} validateAllJS

- name: Validate Scala Native
- name: Validate Tests Native
if: matrix.platform == 'native'
run: sbt --client '++${{ matrix.scala }}; validateAllNative'
run: sbt ++${{ matrix.scala }} testsNative/test

- name: Validate Native
if: matrix.platform == 'native'
run: sbt ++${{ matrix.scala }} native/test

- name: Validate Kernel Laws Native
if: matrix.platform == 'native'
run: sbt ++${{ matrix.scala }} kernelLawsNative/test

- name: Validate Free Native
if: matrix.platform == 'native'
run: sbt ++${{ matrix.scala }} freeNative/test

- name: Validate Alleycats Tests Native
if: matrix.platform == 'native'
run: sbt ++${{ matrix.scala }} alleycatsTestsNative/test

- name: Validate JVM (scala 2)
if: matrix.platform == 'jvm' && (matrix.scala != '3.0.1')
run: sbt --client '++${{ matrix.scala }}; buildJVM; bench/test'
run: sbt ++${{ matrix.scala }} buildJVM bench/test

- name: Validate JVM (scala 3)
if: matrix.platform == 'jvm' && (matrix.scala == '3.0.1')
run: sbt --client '++${{ matrix.scala }}; buildJVM; bench/test'
run: sbt ++${{ matrix.scala }} buildJVM bench/test

- name: Binary compatibility ${{ matrix.scala }}
if: matrix.platform == 'jvm' && (matrix.scala != '3.0.1')
run: sbt --client '++${{ matrix.scala }}; clean; validateBC'
run: sbt ++${{ matrix.scala }} clean validateBC

scalafix:
name: Scalafix
Expand Down Expand Up @@ -161,7 +176,7 @@ jobs:

- name: Check formatting
if: (matrix.scala != '3.0.1')
run: sbt --client '++${{ matrix.scala }}; fmtCheck'
run: sbt ++${{ matrix.scala }} fmtCheck

microsite:
name: Microsite
Expand Down Expand Up @@ -203,4 +218,4 @@ jobs:
run: gem install jekyll -v 4.0.0

- name: Build the microsite
run: sbt --client '++${{ matrix.scala }}; docs/makeMicrosite'
run: sbt ++${{ matrix.scala }} docs/makeMicrosite
48 changes: 28 additions & 20 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ val disciplineMunitVersion = "1.0.9"

val kindProjectorVersion = "0.13.0"

ThisBuild / githubWorkflowUseSbtThinClient := false

val PrimaryOS = "ubuntu-latest"
ThisBuild / githubWorkflowOSes := Seq(PrimaryOS)

Expand Down Expand Up @@ -62,8 +64,6 @@ ThisBuild / githubWorkflowBuildMatrixExclusions +=
// we don't need this since we aren't publishing
ThisBuild / githubWorkflowArtifactUpload := false

ThisBuild / githubWorkflowBuildMatrixFailFast := Some(false)

val JvmCond = s"matrix.platform == 'jvm'"
val JsCond = s"matrix.platform == 'js'"
val NativeCond = s"matrix.platform == 'native'"
Expand All @@ -72,22 +72,28 @@ val Scala2Cond = s"(matrix.scala != '$Scala3')"
val Scala3Cond = s"(matrix.scala == '$Scala3')"

ThisBuild / githubWorkflowBuild := Seq(
WorkflowStep.Sbt(List("validateAllJS"), name = Some("Validate JavaScript"), cond = Some(JsCond)),
WorkflowStep.Sbt(List("validateAllNative"), name = Some("Validate Scala Native"), cond = Some(NativeCond)),
WorkflowStep.Sbt(List("buildJVM", "bench/test"),
name = Some("Validate JVM (scala 2)"),
cond = Some(JvmCond + " && " + Scala2Cond)
),
WorkflowStep.Sbt(List("buildJVM", "bench/test"),
name = Some("Validate JVM (scala 3)"),
cond = Some(JvmCond + " && " + Scala3Cond)
),
WorkflowStep.Sbt(
List("clean", "validateBC"), // cleaning here to avoid issues with codecov
name = Some("Binary compatibility ${{ matrix.scala }}"),
cond = Some(JvmCond + " && " + Scala2Cond)
WorkflowStep.Sbt(List("validateAllJS"), name = Some("Validate JavaScript"), cond = Some(JsCond))
) ++
// this has to be split up to avoid memory issues in GitHub Actions
validateAllNativeAlias.split(" ").filterNot(_ == "all").map { cmd =>
val name = cmd.flatMap(c => if (c.isUpper) s" $c" else c.toString).capitalize.replaceAll("/test", "")
WorkflowStep.Sbt(List(cmd), name = Some(s"Validate $name"), cond = Some(NativeCond))
} ++
Seq(
WorkflowStep.Sbt(List("buildJVM", "bench/test"),
name = Some("Validate JVM (scala 2)"),
cond = Some(JvmCond + " && " + Scala2Cond)
),
WorkflowStep.Sbt(List("buildJVM", "bench/test"),
name = Some("Validate JVM (scala 3)"),
cond = Some(JvmCond + " && " + Scala3Cond)
),
WorkflowStep.Sbt(
List("clean", "validateBC"), // cleaning here to avoid issues with codecov
name = Some("Binary compatibility ${{ matrix.scala }}"),
cond = Some(JvmCond + " && " + Scala2Cond)
)
)
)

ThisBuild / githubWorkflowAddedJobs ++= Seq(
WorkflowJob(
Expand Down Expand Up @@ -933,9 +939,11 @@ addCommandAlias("validateNative", ";testsNative/test;native/test")
addCommandAlias("validateKernelNative", "kernelLawsNative/test")
addCommandAlias("validateFreeNative", "freeNative/test")
addCommandAlias("validateAlleycatsNative", "alleycatsTestsNative/test")
addCommandAlias("validateAllNative",
"all testsNative/test native/test kernelLawsNative/test freeNative/test alleycatsTestsNative/test"
)

val validateAllNativeAlias =
"all testsNative/test native/test kernelLawsNative/test freeNative/test alleycatsTestsNative/test"
addCommandAlias("validateAllNative", validateAllNativeAlias)

addCommandAlias(
"validate",
";clean;validateJS;validateKernelJS;validateFreeJS;validateNative;validateKernelNative;validateFreeNative;validateJVM"
Expand Down
3 changes: 3 additions & 0 deletions core/src/main/scala/cats/FlatMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ import scala.annotation.implicitNotFound
override def map2[A, B, Z](fa: F[A], fb: F[B])(f: (A, B) => Z): F[Z] =
flatMap(fa)(a => map(fb)(b => f(a, b)))

override def map2Eval[A, B, Z](fa: F[A], fb: Eval[F[B]])(f: (A, B) => Z): Eval[F[Z]] =
Eval.now(flatMap(fa)(a => map(fb.value)(b => f(a, b))))

override def productR[A, B](fa: F[A])(fb: F[B]): F[B] =
flatMap(fa)(_ => fb)

Expand Down

0 comments on commit 9e79eec

Please sign in to comment.