Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-build for Native #501

Merged
merged 4 commits into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 61 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ name: Continuous Integration

on:
pull_request:
branches: ['**']
branches: ['**', '!update/**', '!pr/**']
push:
branches: ['**']
branches: ['**', '!update/**', '!pr/**']
tags: [v*]

env:
Expand All @@ -30,20 +30,29 @@ jobs:
os: [ubuntu-latest]
scala: [2.12.15, 2.13.8, 3.1.2]
java: [temurin@8]
project: [rootJS, rootJVM]
project: [rootJS, rootJVM, rootNative]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Download Java (temurin@8)
id: download-java-temurin-8
if: matrix.java == 'temurin@8'
uses: typelevel/download-java@v1
with:
distribution: temurin
java-version: 8

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v2
with:
distribution: temurin
distribution: jdkfile
java-version: 8
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v2
Expand All @@ -61,12 +70,17 @@ jobs:
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' 'project /' githubWorkflowCheck

- name: Check formatting
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' scalafmtCheckAll root/scalafmtSbtCheck
if: matrix.java == 'temurin@8'
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' scalafmtCheckAll 'project /' scalafmtSbtCheck

- name: scalaJSLink
if: matrix.project == 'rootJS'
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' Test/scalaJSLinkerResult

- name: nativeLink
if: matrix.project == 'rootNative'
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' Test/nativeLink

- name: Test
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' test

Expand All @@ -80,11 +94,11 @@ jobs:

- name: Make target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/dotty')
run: mkdir -p target .js/target core/.js/target core/.jvm/target .jvm/target .native/target project/target
run: mkdir -p target .js/target core/.native/target core/.js/target core/.jvm/target .jvm/target .native/target project/target

- name: Compress target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/dotty')
run: tar cf targets.tar target .js/target core/.js/target core/.jvm/target .jvm/target .native/target project/target
run: tar cf targets.tar target .js/target core/.native/target core/.js/target core/.jvm/target .jvm/target .native/target project/target

- name: Upload target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/dotty')
Expand All @@ -109,12 +123,21 @@ jobs:
with:
fetch-depth: 0

- name: Download Java (temurin@8)
id: download-java-temurin-8
if: matrix.java == 'temurin@8'
uses: typelevel/download-java@v1
with:
distribution: temurin
java-version: 8

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v2
with:
distribution: temurin
distribution: jdkfile
java-version: 8
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v2
Expand Down Expand Up @@ -148,6 +171,16 @@ jobs:
tar xf targets.tar
rm targets.tar

- name: Download target directories (2.12.15, rootNative)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-rootNative

- name: Inflate target directories (2.12.15, rootNative)
run: |
tar xf targets.tar
rm targets.tar

- name: Download target directories (2.13.8, rootJS)
uses: actions/download-artifact@v2
with:
Expand All @@ -168,6 +201,16 @@ jobs:
tar xf targets.tar
rm targets.tar

- name: Download target directories (2.13.8, rootNative)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8-rootNative

- name: Inflate target directories (2.13.8, rootNative)
run: |
tar xf targets.tar
rm targets.tar

- name: Download target directories (3.1.2, rootJS)
uses: actions/download-artifact@v2
with:
Expand All @@ -188,6 +231,16 @@ jobs:
tar xf targets.tar
rm targets.tar

- name: Download target directories (3.1.2, rootNative)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.2-rootNative

- name: Inflate target directories (3.1.2, rootNative)
run: |
tar xf targets.tar
rm targets.tar

- name: Import signing key
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
run: echo $PGP_SECRET | base64 -di | gpg --import
Expand Down
15 changes: 5 additions & 10 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ ThisBuild / scalaVersion := scala3
ThisBuild / tlBaseVersion := "3.0"
ThisBuild / organization := "org.typelevel"

val catsVersion = "2.7.0"
val munitVersion = "0.7.29"
val disciplineMunitVersion = "1.0.9"
val catsVersion = "2.8.0"
val munitVersion = "1.0.0-M5"
val disciplineMunitVersion = "2.0.0-M2"
val kindProjectorVersion = "0.13.2"
val shapeless2Version = "2.3.8"
val shapeless3Version = "3.1.0"
Expand Down Expand Up @@ -58,7 +58,7 @@ console / initialCommands := """import shapeless._, cats._, cats.derived._"""

lazy val root = tlCrossRootProject.aggregate(core)

lazy val core = crossProject(JVMPlatform, JSPlatform)
lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.settings(moduleName := "kittens")
.settings(commonSettings: _*)
Expand Down Expand Up @@ -86,9 +86,4 @@ ThisBuild / developers := List(
)

ThisBuild / tlCiReleaseBranches := Seq("dotty")
ThisBuild / githubWorkflowBuild ~= { steps =>
WorkflowStep.Sbt(
List("scalafmtCheckAll", "root/scalafmtSbtCheck"),
name = Some("Check formatting")
) +: steps
}
ThisBuild / tlCiScalafmtCheck := true
2 changes: 1 addition & 1 deletion core/src/test/scala-3/cats/derived/KittensSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ object KittensSuite:
test(s"No $tc for $target")(assert(errors.contains(message), s"$errors did not contain $message"))

inline def testNoAuto(inline tc: String, target: String): Unit =
testNoInstance(tc, target, "Could not find an instance of " + tc)
testNoInstance(tc, target, "no implicit argument of type")

inline def testNoSemi(inline tc: String, target: String): Unit =
testNoInstance("semiauto." + deCapitalize(tc), target, "Could not derive an instance of " + tc)
10 changes: 5 additions & 5 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.9.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.3")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.4")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0")
addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings" % "3.0.0")
addSbtPlugin("org.typelevel" % "sbt-typelevel-ci-release" % "0.4.5")
addSbtPlugin("org.typelevel" % "sbt-typelevel-ci-release" % "0.4.12")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")