Skip to content
Open
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
98 changes: 41 additions & 57 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,47 +27,39 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [3.2.1, 2.13.10, 2.12.17]
java: [temurin@11]
scala: [3.3.7, 2.13.18, 2.12.21]
java: [zulu@8]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Setup Java (temurin@11)
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v2
- name: Setup Java (zulu@8)
if: matrix.java == 'zulu@8'
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 11
distribution: zulu
java-version: 8
cache: sbt

- 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 sbt
uses: sbt/setup-sbt@v1

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

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

- run: sbt ++${{ matrix.scala }} versionPolicyCheck test
- run: sbt '++ ${{ matrix.scala }}' versionPolicyCheck test

- name: Compress target directories
run: tar cf targets.tar modules/apply/.js/target target modules/apply/.jvm/target modules/full/.js/target modules/full/.jvm/target modules/basic/.js/target modules/basic-light/.jvm/target modules/basic/.jvm/target modules/full-light/.js/target modules/basic-light/.js/target modules/full-light/.jvm/target project/target
run: tar cf targets.tar modules/apply/.js/target target modules/apply/.jvm/target modules/full/.js/target modules/full/.jvm/target modules/shared/.js/target modules/shared/.jvm/target modules/basic/.js/target modules/basic-light/.jvm/target modules/basic/.jvm/target modules/full-light/.js/target modules/basic-light/.js/target modules/full-light/.jvm/target project/target

- name: Upload target directories
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v5
with:
name: target-${{ matrix.os }}-${{ matrix.scala }}-${{ matrix.java }}
path: targets.tar
Expand All @@ -79,62 +71,54 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.10]
java: [temurin@11]
scala: [3.3.7]
java: [zulu@8]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Setup Java (temurin@11)
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v2
- name: Setup Java (zulu@8)
if: matrix.java == 'zulu@8'
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 11
distribution: zulu
java-version: 8
cache: sbt

- 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: Download target directories (3.2.1)
uses: actions/download-artifact@v2
- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Download target directories (3.3.7)
uses: actions/download-artifact@v6
with:
name: target-${{ matrix.os }}-3.2.1-${{ matrix.java }}
name: target-${{ matrix.os }}-3.3.7-${{ matrix.java }}

- name: Inflate target directories (3.2.1)
- name: Inflate target directories (3.3.7)
run: |
tar xf targets.tar
rm targets.tar

- name: Download target directories (2.13.10)
uses: actions/download-artifact@v2
- name: Download target directories (2.13.18)
uses: actions/download-artifact@v6
with:
name: target-${{ matrix.os }}-2.13.10-${{ matrix.java }}
name: target-${{ matrix.os }}-2.13.18-${{ matrix.java }}

- name: Inflate target directories (2.13.10)
- name: Inflate target directories (2.13.18)
run: |
tar xf targets.tar
rm targets.tar

- name: Download target directories (2.12.17)
uses: actions/download-artifact@v2
- name: Download target directories (2.12.21)
uses: actions/download-artifact@v6
with:
name: target-${{ matrix.os }}-2.12.17-${{ matrix.java }}
name: target-${{ matrix.os }}-2.12.21-${{ matrix.java }}

- name: Inflate target directories (2.12.17)
- name: Inflate target directories (2.12.21)
run: |
tar xf targets.tar
rm targets.tar

- run: sbt ++${{ matrix.scala }} ci-release
- run: sbt ci-release
6 changes: 5 additions & 1 deletion .github/workflows/clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ name: Clean

on: push

permissions:
actions: write

jobs:
delete-artifacts:
name: Delete Artifacts
Expand All @@ -17,6 +20,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Delete artifacts
shell: bash {0}
run: |
# Customize those three lines with your repository and credentials:
REPO=${GITHUB_API_URL}/repos/${{ github.repository }}
Expand All @@ -25,7 +29,7 @@ jobs:
ghapi() { curl --silent --location --user _:$GITHUB_TOKEN "$@"; }

# A temporary file which receives HTTP response headers.
TMPFILE=/tmp/tmp.$$
TMPFILE=$(mktemp)

# An associative array, key: artifact name, value: number of artifacts of that name.
declare -A ARTCOUNT
Expand Down
79 changes: 55 additions & 24 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sbt.librarymanagement.CrossVersion
import com.typesafe.tools.mima.core._
import com.typesafe.tools.mima.core.*
import org.typelevel.scalacoptions.{ ScalacOption, ScalacOptions }

inThisBuild(
List(
Expand All @@ -9,7 +10,7 @@ inThisBuild(
developers := List(Developer("yurique", "Iurii Malchenko", "i@yurique.com", url("https://github.com/yurique"))),
scmInfo := Some(ScmInfo(url("https://github.com/tulz-app/tuplez"), "scm:git@github.com/tulz-app/tuplez.git")),
(Test / publishArtifact) := false,
scalaVersion := ScalaVersions.v213,
scalaVersion := ScalaVersions.v3,
crossScalaVersions := Seq(
ScalaVersions.v3,
ScalaVersions.v213,
Expand All @@ -34,104 +35,131 @@ inThisBuild(
)
)

// scala3-only implementation without codegen
lazy val `tuplez-shared` =
crossProject(JVMPlatform, JSPlatform)
.crossType(CrossType.Pure)
.in(file("modules/shared"))
.settings(commonSettings)
.jsSettings(commonJsSettings)
.settings(
name := "tuplez-shared",
description := "Scala tuple composition, shared module with Scala 3 implementation."
)

lazy val `tuplez-full` =
crossProject(JVMPlatform, JSPlatform)
.crossType(CrossType.Pure)
.in(file("modules/full"))
.jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin))
.settings(ScalaOptions.fixOptions)
.settings(commonSettings)
.jsSettings(commonJsSettings)
.settings(
name := "tuplez-full",
Compile / sourceGenerators += Def.task {
Seq.concat(
new TupleCompositionGenerator((Compile / sharedScalaSource).value, to = 22, generateConcats = true, generatePrepends = true).generate()
)
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) =>
new TupleCompositionGenerator((Compile / sharedScala2Source).value, to = 22, splitPriorityAt = 6, generateConcats = true, generatePrepends = true).generate()
case Some((3, _)) =>
Seq.empty
case _ => Seq.empty
}
}.taskValue,
Test / sourceGenerators += Def.task {
Seq.concat(
new TupleCompositionTestGenerator((Test / sourceManaged).value, to = 22, testConcats = true, testPrepends = true).generate()
new TupleCompositionTestGenerator((Test / sourceManaged).value, to = 22, testConcats = true, testPrepends = true, scala3 = CrossVersion.partialVersion(scalaVersion.value).exists(_._1 == 3)).generate()
)
}.taskValue,
description := "Scala tuple composition."
)
.dependsOn(`tuplez-shared`)

lazy val `tuplez-full-light` =
crossProject(JVMPlatform, JSPlatform)
.crossType(CrossType.Pure)
.in(file("modules/full-light"))
.jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin))
.settings(ScalaOptions.fixOptions)
.settings(commonSettings)
.jsSettings(commonJsSettings)
.settings(
name := "tuplez-full-light",
Compile / sourceGenerators += Def.task {
Seq.concat(
new TupleCompositionGenerator((Compile / sharedScalaSource).value, to = 10, generateConcats = true, generatePrepends = true).generate()
)
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) =>
new TupleCompositionGenerator((Compile / sharedScala2Source).value, to = 10, splitPriorityAt = 6, generateConcats = true, generatePrepends = true).generate()
case Some((3, _)) =>
Seq.empty
case _ => Seq.empty
}
}.taskValue,
Test / sourceGenerators += Def.task {
Seq.concat(
new TupleCompositionTestGenerator((Test / sourceManaged).value, to = 10, testConcats = true, testPrepends = true).generate()
new TupleCompositionTestGenerator((Test / sourceManaged).value, to = 10, testConcats = true, testPrepends = true, scala3 = CrossVersion.partialVersion(scalaVersion.value).exists(_._1 == 3)).generate()
)
}.taskValue,
description := "Scala tuple composition."
)
.dependsOn(`tuplez-shared`)

lazy val `tuplez-basic` =
crossProject(JVMPlatform, JSPlatform)
.crossType(CrossType.Pure)
.in(file("modules/basic"))
.jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin))
.settings(ScalaOptions.fixOptions)
.settings(commonSettings)
.jsSettings(commonJsSettings)
.settings(
name := "tuplez-basic",
Compile / sourceGenerators += Def.task {
Seq.concat(
new TupleCompositionGenerator((Compile / sharedScalaSource).value, to = 22, generateConcats = false, generatePrepends = false).generate()
)
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) =>
new TupleCompositionGenerator((Compile / sharedScala2Source).value, to = 22, splitPriorityAt = 6, generateConcats = false, generatePrepends = false).generate()
case Some((3, _)) =>
Seq.empty
case _ => Seq.empty
}
}.taskValue,
Test / sourceGenerators += Def.task {
Seq.concat(
new TupleCompositionTestGenerator((Test / sourceManaged).value, to = 22, testConcats = false, testPrepends = false).generate()
new TupleCompositionTestGenerator((Test / sourceManaged).value, to = 22, testConcats = false, testPrepends = false, scala3 = CrossVersion.partialVersion(scalaVersion.value).exists(_._1 == 3)).generate()
)
}.taskValue,
description := "Scala tuple composition."
)
.dependsOn(`tuplez-shared`)

lazy val `tuplez-basic-light` =
crossProject(JVMPlatform, JSPlatform)
.crossType(CrossType.Pure)
.in(file("modules/basic-light"))
.jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin))
.settings(ScalaOptions.fixOptions)
.settings(commonSettings)
.jsSettings(commonJsSettings)
.settings(
name := "tuplez-basic-light",
Compile / sourceGenerators += Def.task {
Seq.concat(
new TupleCompositionGenerator((Compile / sharedScalaSource).value, to = 10, generateConcats = false, generatePrepends = false).generate()
)
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) =>
new TupleCompositionGenerator((Compile / sharedScala2Source).value, to = 10, splitPriorityAt = 6, generateConcats = false, generatePrepends = false).generate()
case Some((3, _)) =>
Seq.empty
case _ => Seq.empty
}
}.taskValue,
Test / sourceGenerators += Def.task {
Seq.concat(
new TupleCompositionTestGenerator((Test / sourceManaged).value, to = 10, testConcats = false, testPrepends = false).generate()
new TupleCompositionTestGenerator((Test / sourceManaged).value, to = 10, testConcats = false, testPrepends = false, scala3 = CrossVersion.partialVersion(scalaVersion.value).exists(_._1 == 3)).generate()
)
}.taskValue,
description := "Scala tuple composition."
)
.dependsOn(`tuplez-shared`)

lazy val `tuplez-apply` =
crossProject(JVMPlatform, JSPlatform)
.crossType(CrossType.Pure)
.in(file("modules/apply"))
.jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin))
.settings(ScalaOptions.fixOptions)
.settings(commonSettings)
.jsSettings(commonJsSettings)
.settings(
Expand All @@ -156,7 +184,8 @@ lazy val commonSettings = Seq(
("com.github.sbt" % "junit-interface" % "0.13.3" % Test).exclude("junit", "junit-dep")
),
scalacOptions := scalacOptions.value.filterNot(_ == "-Wdead-code"),
// scalacOptions := scalacOptions.value.filterNot(_ == "-Xfatal-warnings")
Test / scalacOptions += "-Wconf:msg=a type was inferred to be `Any`:s",
tpolecatScalacOptions += ScalacOptions.explain
)

lazy val commonJsSettings = Seq(
Expand Down Expand Up @@ -188,6 +217,8 @@ lazy val root = project
)
.settings(noPublish)
.aggregate(
`tuplez-shared`.js,
`tuplez-shared`.jvm,
`tuplez-full`.js,
`tuplez-full-light`.js,
`tuplez-basic`.js,
Expand Down
Loading