Skip to content

Commit

Permalink
Fix CI cross building
Browse files Browse the repository at this point in the history
  • Loading branch information
RustedBones committed Aug 22, 2023
1 parent b9a7abd commit dd42dc7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 48 deletions.
22 changes: 7 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [3, 2.13, 2.12]
scala: [2.13, 2.12]
java: [corretto@17, corretto@11]
project: [rootJVM]
exclude:
- scala: 3
java: corretto@11
- scala: 2.12
java: corretto@11
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -82,9 +80,13 @@ jobs:
run: 'bash <(curl -s https://codecov.io/bash)'

- name: Build project
if: '!(matrix.scala == ''2.13.11'' && matrix.java == ''corretto@11'')'
if: '!(matrix.scala == ''2.13.11'' && matrix.java == ''corretto@11'' || matrix.scala == ''3.3.0'')'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test

- name: Build project
if: matrix.scala == '3.3.0'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' shared/test test/test

- name: Make target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: mkdir -p refined/target shared/target tensorflow/target parquet/target tools/target protobuf/target jmh/target bigquery/target avro/target scalacheck/target datastore/target neo4j/target cats/target bigtable/target guava/target project/target
Expand Down Expand Up @@ -141,16 +143,6 @@ jobs:
if: matrix.java == 'corretto@11' && steps.setup-java-corretto-11.outputs.cache-hit == 'false'
run: sbt +update

- name: Download target directories (3, rootJVM)
uses: actions/download-artifact@v3
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootJVM

- name: Inflate target directories (3, rootJVM)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.13, rootJVM)
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -238,7 +230,7 @@ jobs:
- name: Submit Dependencies
uses: scalacenter/sbt-dependency-submission@v2
with:
modules-ignore: test_3 test_2.13 test_2.12 magnolify_3 magnolify_2.13 magnolify_2.12 magnolify_3 magnolify_2.13 magnolify_2.12 magnolify_3 magnolify_2.13 magnolify_2.12
modules-ignore: test_3 test_2.13 test_2.12 magnolify_2.13 magnolify_2.12 magnolify_2.13 magnolify_2.12 magnolify_2.13 magnolify_2.12
configs-ignore: test scala-tool scala-doc-tool test-internal

validate-steward:
Expand Down
56 changes: 23 additions & 33 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,13 @@ val coverageCond = Seq(
s"matrix.scala == '$scalaDefault'",
s"matrix.java == '${javaDefault.render}'"
).mkString(" && ")

val scala3Cond = s"matrix.scala == '$scala3'"
val scala3Projects = List(
"shared",
"test"
)
ThisBuild / scalaVersion := scalaDefault
ThisBuild / crossScalaVersions := Seq(scala3, scala213, scala212)
ThisBuild / crossScalaVersions := Seq(scala213, scala212)
ThisBuild / githubWorkflowTargetBranches := Seq("main")
ThisBuild / githubWorkflowJavaVersions := Seq(java17, java11)
ThisBuild / githubWorkflowBuild := Seq(
Expand All @@ -128,7 +132,16 @@ ThisBuild / githubWorkflowBuild := Seq(
name = Some("Upload coverage report"),
cond = Some(coverageCond)
),
WorkflowStep.Sbt(List("test"), name = Some("Build project"), cond = Some(s"!($coverageCond)"))
WorkflowStep.Sbt(
List("test"),
name = Some("Build project"),
cond = Some(s"!($coverageCond || $scala3Cond)")
),
WorkflowStep.Sbt(
scala3Projects.map(p => s"$p/test"),
name = Some("Build project"),
cond = Some(scala3Cond)
)
)
ThisBuild / githubWorkflowAddedJobs ++= Seq(
WorkflowJob(
Expand Down Expand Up @@ -178,6 +191,9 @@ lazy val keepExistingHeader =
val commonSettings = Seq(
tlFatalWarnings := false,
tlJdkRelease := Some(8),
// So far most projects do no support scala 3
crossScalaVersions := Seq(scala213, scala212),
scalaVersion := scalaDefault,
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) =>
Expand Down Expand Up @@ -233,7 +249,6 @@ val commonSettings = Seq(
lazy val root = tlCrossRootProject
.enablePlugins(NoPublishPlugin)
.settings(
commonSettings,
name := "magnolify",
description := "A collection of Magnolia add-on modules"
)
Expand All @@ -259,6 +274,7 @@ lazy val shared = project
.in(file("shared"))
.settings(
commonSettings,
crossScalaVersions := Seq(scala3, scala213, scala212),
moduleName := "magnolify-shared",
description := "Shared code for Magnolify"
)
Expand All @@ -268,8 +284,9 @@ lazy val test = project
.in(file("test"))
.enablePlugins(NoPublishPlugin)
.dependsOn(shared)
.settings(commonSettings)
.settings(
commonSettings,
crossScalaVersions := Seq(scala3, scala213, scala212),
libraryDependencies ++= Seq(
"org.scalameta" %% "munit-scalacheck" % munitVersion % Test,
"org.typelevel" %% "cats-core" % catsVersion % Test
Expand All @@ -286,8 +303,6 @@ lazy val scalacheck = project
commonSettings,
moduleName := "magnolify-scalacheck",
description := "Magnolia add-on for ScalaCheck",
crossScalaVersions := Seq(scala213, scala212),
scalaVersion := scalaDefault,
libraryDependencies += "org.scalacheck" %% "scalacheck" % scalacheckVersion % Provided
)

Expand All @@ -302,8 +317,6 @@ lazy val cats = project
commonSettings,
moduleName := "magnolify-cats",
description := "Magnolia add-on for Cats",
crossScalaVersions := Seq(scala213, scala212),
scalaVersion := scalaDefault,
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % catsVersion % Provided,
"com.twitter" %% "algebird-core" % algebirdVersion % Test,
Expand All @@ -322,8 +335,6 @@ lazy val guava = project
commonSettings,
moduleName := "magnolify-guava",
description := "Magnolia add-on for Guava",
crossScalaVersions := Seq(scala213, scala212),
scalaVersion := scalaDefault,
libraryDependencies ++= Seq(
"com.google.guava" % "guava" % guavaVersion % Provided
)
Expand All @@ -345,8 +356,6 @@ lazy val refined = project
commonSettings,
moduleName := "magnolify-refined",
description := "Magnolia add-on for Refined",
crossScalaVersions := Seq(scala213, scala212),
scalaVersion := scalaDefault,
libraryDependencies ++= Seq(
"com.google.guava" % "guava" % guavaVersion % Provided,
"eu.timepit" %% "refined" % refinedVersion % Provided,
Expand All @@ -371,8 +380,6 @@ lazy val avro = project
commonSettings,
moduleName := "magnolify-avro",
description := "Magnolia add-on for Apache Avro",
crossScalaVersions := Seq(scala213, scala212),
scalaVersion := scalaDefault,
libraryDependencies ++= Seq(
"org.apache.avro" % "avro" % avroVersion % Provided,
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonVersion % Test
Expand All @@ -391,8 +398,6 @@ lazy val bigquery = project
commonSettings,
moduleName := "magnolify-bigquery",
description := "Magnolia add-on for Google Cloud BigQuery",
crossScalaVersions := Seq(scala213, scala212),
scalaVersion := scalaDefault,
libraryDependencies ++= Seq(
"com.google.apis" % "google-api-services-bigquery" % bigqueryVersion % Provided,
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonVersion % Test
Expand All @@ -411,8 +416,6 @@ lazy val bigtable: Project = project
commonSettings,
moduleName := "magnolify-bigtable",
description := "Magnolia add-on for Google Cloud Bigtable",
crossScalaVersions := Seq(scala213, scala212),
scalaVersion := scalaDefault,
libraryDependencies ++= Seq(
"com.google.api.grpc" % "proto-google-cloud-bigtable-v2" % bigtableVersion % Provided
)
Expand All @@ -430,8 +433,6 @@ lazy val datastore = project
commonSettings,
moduleName := "magnolify-datastore",
description := "Magnolia add-on for Google Cloud Datastore",
crossScalaVersions := Seq(scala213, scala212),
scalaVersion := scalaDefault,
libraryDependencies ++= Seq(
"com.google.cloud.datastore" % "datastore-v1-proto-client" % datastoreVersion % Provided
)
Expand All @@ -450,8 +451,6 @@ lazy val parquet = project
commonSettings,
moduleName := "magnolify-parquet",
description := "Magnolia add-on for Apache Parquet",
crossScalaVersions := Seq(scala213, scala212),
scalaVersion := scalaDefault,
libraryDependencies ++= Seq(
"org.apache.hadoop" % "hadoop-client" % hadoopVersion % Provided,
"org.apache.parquet" % "parquet-avro" % parquetVersion % Provided,
Expand All @@ -475,9 +474,7 @@ lazy val protobuf = project
commonSettings,
protobufSettings,
moduleName := "magnolify-protobuf",
description := "Magnolia add-on for Google Protocol Buffer",
crossScalaVersions := Seq(scala213, scala212),
scalaVersion := scalaDefault,
description := "Magnolia add-on for Google Protocol Buffer"
)

lazy val tensorflow = project
Expand All @@ -493,8 +490,6 @@ lazy val tensorflow = project
protobufSettings,
moduleName := "magnolify-tensorflow",
description := "Magnolia add-on for TensorFlow",
crossScalaVersions := Seq(scala213, scala212),
scalaVersion := scalaDefault,
libraryDependencies ++= Seq(
"com.google.protobuf" % "protobuf-java" % protobufVersion % ProtobufConfig,
"org.tensorflow" % "tensorflow-core-api" % tensorflowVersion % Provided
Expand Down Expand Up @@ -531,8 +526,6 @@ lazy val neo4j = project
commonSettings,
moduleName := "magnolify-neo4j",
description := "Magnolia add-on for Neo4j",
crossScalaVersions := Seq(scala213, scala212),
scalaVersion := scalaDefault,
libraryDependencies ++= Seq(
"org.neo4j.driver" % "neo4j-java-driver" % neo4jDriverVersion % Provided
)
Expand All @@ -551,8 +544,6 @@ lazy val tools = project
commonSettings,
moduleName := "magnolify-tools",
description := "Magnolia add-on for code generation",
crossScalaVersions := Seq(scala213, scala212),
scalaVersion := scalaDefault,
libraryDependencies ++= Seq(
"com.google.apis" % "google-api-services-bigquery" % bigqueryVersion,
"org.apache.avro" % "avro" % avroVersion % Provided,
Expand All @@ -579,7 +570,6 @@ lazy val jmh: Project = project
.settings(
commonSettings,
crossScalaVersions := Seq(scalaDefault),
scalaVersion := scalaDefault,
Jmh / classDirectory := (Test / classDirectory).value,
Jmh / dependencyClasspath := (Test / dependencyClasspath).value,
// rewire tasks, so that 'jmh:run' automatically invokes 'jmh:compile'
Expand Down

0 comments on commit dd42dc7

Please sign in to comment.