Skip to content

Commit

Permalink
Re-enable Scala 2.12 for native build.
Browse files Browse the repository at this point in the history
Split coverage job from matrix build.
  • Loading branch information
arashi01 committed Jan 31, 2021
1 parent 8d172d2 commit df63b59
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 50 deletions.
78 changes: 51 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.12, 2.13.4, 3.0.0-M2, 3.0.0-M3]
scala: [2.12.13, 2.13.4, 3.0.0-M2, 3.0.0-M3]
java:
- adopt@1.8
- adopt@1.11
Expand Down Expand Up @@ -55,8 +55,6 @@ jobs:
scala: 3.0.0-M2
- platform: native
scala: 3.0.0-M3
- platform: native
scala: 2.12.12
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
Expand Down Expand Up @@ -92,28 +90,10 @@ jobs:
if: matrix.platform == 'native'
run: sbt ++${{ matrix.scala }} validateAllNative

- name: Setup Python
if: matrix.platform == 'jvm' && (matrix.scala != '3.0.0-M2' && matrix.scala != '3.0.0-M3')
uses: actions/setup-python@v2
with:
python-version: 3.x

- name: Setup codecov
if: matrix.platform == 'jvm' && (matrix.scala != '3.0.0-M2' && matrix.scala != '3.0.0-M3')
run: pip install codecov

- name: Validate JVM (scala 2)
if: matrix.platform == 'jvm' && (matrix.scala != '3.0.0-M2' && matrix.scala != '3.0.0-M3')
run: sbt ++${{ matrix.scala }} coverage buildJVM bench/test catsJVM/coverageReport

- name: Validate JVM (scala 3)
if: matrix.platform == 'jvm' && (matrix.scala == '3.0.0-M2' || matrix.scala == '3.0.0-M3')
- name: Validate JVM (Scala ${{ matrix.scala }})
if: matrix.platform == 'jvm'
run: sbt ++${{ matrix.scala }} buildJVM bench/test

- name: Upload Codecov Results
if: matrix.platform == 'jvm' && (matrix.scala != '3.0.0-M2' && matrix.scala != '3.0.0-M3')
run: codecov -F ${{ matrix.scala }}

- name: Binary compatibility ${{ matrix.scala }}
if: matrix.platform == 'jvm' && (matrix.scala != '3.0.0-M2' && matrix.scala != '3.0.0-M3')
run: sbt ++${{ matrix.scala }} clean validateBC
Expand All @@ -123,7 +103,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.12, 2.13.4, 3.0.0-M2, 3.0.0-M3]
scala: [2.12.13, 2.13.4, 3.0.0-M2, 3.0.0-M3]
java: [adopt@1.8]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -159,7 +139,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.12, 2.13.4, 3.0.0-M2, 3.0.0-M3]
scala: [2.12.13, 2.13.4, 3.0.0-M2, 3.0.0-M3]
java: [adopt@1.8]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -194,7 +174,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.12]
scala: [2.12.13]
java: [adopt@1.8]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -227,4 +207,48 @@ jobs:
run: gem install jekyll -v 4.0.0

- name: Build the microsite
run: sbt ++${{ matrix.scala }} docs/makeMicrosite
run: sbt ++${{ matrix.scala }} docs/makeMicrosite

coverage:
name: Coverage Report
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.4]
java: [adopt@1.8]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Java and Scala
uses: olafurpg/setup-scala@v10
with:
java-version: ${{ matrix.java }}

- name: Cache sbt
uses: actions/cache@v2
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.x

- name: Setup codecov
run: pip install codecov

- run: sbt ++${{ matrix.scala }} coverage buildJVM bench/test catsJVM/coverageReport

- name: Upload Codecov Results
run: codecov -F 2.13.4
44 changes: 21 additions & 23 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ val GraalVM8 = "graalvm-ce-java8@20.2.0"

ThisBuild / githubWorkflowJavaVersions := Seq(PrimaryJava, LTSJava, LatestJava, GraalVM8)

val Scala212 = "2.12.12"
val Scala212 = "2.12.13"
val Scala213 = "2.13.4"
val DottyOld = "3.0.0-M2"
val DottyNew = "3.0.0-M3"
Expand All @@ -68,7 +68,7 @@ ThisBuild / githubWorkflowBuildMatrixExclusions ++=
) // 3.0.0-M1 doesn't work on JDK 14+
}

ThisBuild / githubWorkflowBuildMatrixExclusions ++= Seq(DottyOld, DottyNew, Scala212).map { dottyVersion =>
ThisBuild / githubWorkflowBuildMatrixExclusions ++= Seq(DottyOld, DottyNew).map { dottyVersion =>
MatrixExclude(Map("platform" -> "native", "scala" -> dottyVersion))
} // Dotty is not yet supported by Scala Native

Expand All @@ -85,26 +85,9 @@ val Scala3Cond = s"(matrix.scala == '$DottyOld' || matrix.scala == '$DottyNew')"
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.Use(UseRef.Public("actions", "setup-python", "v2"),
name = Some("Setup Python"),
params = Map("python-version" -> "3.x"),
cond = Some(JvmCond + " && " + Scala2Cond)
),
WorkflowStep.Run(List("pip install codecov"),
cond = Some(JvmCond + " && " + Scala2Cond),
name = Some("Setup codecov")
),
WorkflowStep.Sbt(List("coverage", "buildJVM", "bench/test", "catsJVM/coverageReport"),
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.Run(List("codecov -F ${{ matrix.scala }}"),
name = Some("Upload Codecov Results"),
cond = Some(JvmCond + " && " + Scala2Cond)
name = Some("Validate JVM (Scala ${{ matrix.scala }})"),
cond = Some(JvmCond)
),
WorkflowStep.Sbt(
List("clean", "validateBC"), // cleaning here to avoid issues with codecov
Expand Down Expand Up @@ -142,6 +125,21 @@ ThisBuild / githubWorkflowAddedJobs ++= Seq(
),
javas = List(PrimaryJava),
scalas = List(Scala212)
),
WorkflowJob(
"coverage",
"Coverage Report",
githubWorkflowJobSetup.value.toList ::: List(
WorkflowStep.Use(UseRef.Public("actions", "setup-python", "v2"),
name = Some("Setup Python"),
params = Map("python-version" -> "3.x")
),
WorkflowStep.Run(List("pip install codecov"), name = Some("Setup codecov")),
WorkflowStep.Sbt(List("coverage", "buildJVM", "bench/test", "catsJVM/coverageReport")),
WorkflowStep.Run(List(s"codecov -F $Scala213"), name = Some("Upload Codecov Results"))
),
javas = List(PrimaryJava),
scalas = List(Scala213)
)
)

Expand Down Expand Up @@ -237,8 +235,8 @@ lazy val commonNativeSettings = Seq(
// https://github.com/tkawachi/sbt-doctest/issues/52
doctestGenTests := Seq.empty,
coverageEnabled := false,
// Currently scala-native does not support Dotty, scoverage does not support Scala 2.12.13
crossScalaVersions := { crossScalaVersions.value.filterNot(Seq(DottyOld, DottyNew, Scala212).contains) }
// Currently scala-native does not support Dotty
crossScalaVersions := { crossScalaVersions.value.filterNot(Seq(DottyOld, DottyNew).contains) }
)

lazy val commonJvmSettings = Seq(
Expand Down

0 comments on commit df63b59

Please sign in to comment.