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

chore: start cross publishing for new 0.11.x series #41

Merged
merged 2 commits into from
Apr 28, 2023
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
18 changes: 4 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ jobs:
./mill -i __.fix --check

test:
runs-on: ${{ matrix.os }}
runs-on: 'ubuntu-latest'
strategy:
fail-fast: false
matrix:
java: ['8', '17']
os: ['ubuntu-latest', 'windows-latest']

steps:
- uses: actions/checkout@v3
Expand All @@ -45,21 +44,12 @@ jobs:
distribution: 'temurin'
java-version: ${{ matrix.java }}

- name: Compile Ubuntu
- name: Compile
run:
./mill -i __.compile
if: matrix.os == 'ubuntu-latest'

- name: Compile Windows
run: ./millw.bat -i __.compile
if: matrix.os == 'windows-latest'

- name: Test Ubuntu
- name: Test
run:
./mill -i --debug itest
./mill -i --debug itest[_].test
if: matrix.os == 'ubuntu-latest'

- name: Test Windows
run:
./millw.bat -i --debug itest
if: matrix.os == 'windows-latest'
22 changes: 16 additions & 6 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,31 @@ import de.tobiasroeser.mill.integrationtest._
import io.kipp.mill.ci.release.CiReleaseModule
import io.kipp.mill.ci.release.SonatypeHost

val millVersion = "0.10.12"
val millVersions = Seq("0.10.12", "0.11.0-M8")
val millBinaryVersions = millVersions.map(scalaNativeBinaryVersion)
val scala213 = "2.13.10"
val pluginName = "mill-giter8"

def millBinaryVersion(millVersion: String) = scalaNativeBinaryVersion(
millVersion
)

object plugin
def millVersion(binaryVersion: String) =
millVersions.find(v => millBinaryVersion(v) == binaryVersion).get

object plugin extends Cross[Plugin](millBinaryVersions: _*)
class Plugin(millBinaryVersion: String)
extends ScalaModule
with CiReleaseModule
with ScalafixModule
with ScalafmtModule {

override def scalaVersion = scala213

override def millSourcePath = super.millSourcePath / os.up

override def artifactName =
s"${pluginName}_mill${millBinaryVersion(millVersion)}"
s"${pluginName}_mill${millBinaryVersion}"

override def pomSettings = PomSettings(
description = "Giter8 plugin for Mill",
Expand All @@ -46,7 +53,7 @@ object plugin
override def sonatypeHost: Option[SonatypeHost] = Some(SonatypeHost.s01)

override def compileIvyDeps = super.compileIvyDeps() ++ Agg(
ivy"com.lihaoyi::mill-scalalib:${millVersion}"
ivy"com.lihaoyi::mill-scalalib:${millVersion(millBinaryVersion)}"
)

override def ivyDeps = Agg(
Expand All @@ -64,11 +71,14 @@ object plugin
)
}

object itest extends MillIntegrationTestModule {
object itest extends Cross[ItestCross](millVersions: _*)
class ItestCross(millVersion: String) extends MillIntegrationTestModule {

override def millSourcePath = super.millSourcePath / os.up

override def millTestVersion = millVersion

override def pluginsUnderTest = Seq(plugin)
override def pluginsUnderTest = Seq(plugin(millBinaryVersion(millVersion)))

override def perTestResources = T.sources { millSourcePath / "shared" }

Expand Down
8 changes: 6 additions & 2 deletions itest/shared/build.sc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import $exec.plugins
import $file.plugins
import io.kipp.mill.giter8.G8Module
import $ivy.`org.scalameta::munit:0.7.29`
import munit.Assertions._
Expand All @@ -14,5 +14,9 @@ def validatePackageStructure = T {
val expectedFile =
T.workspace / "out" / "g8" / "generate.overridden" / "io" / "kipp" / "mill" / "giter8" / "G8Module" / "generate.dest" / "result" / "minimal" / "src" / "com" / "example" / "someproject" / "Main.scala"

assert(os.exists(expectedFile))
// Location in new mill. So instead of coding fancy logic of duplicating anything we'll just check both
val newExpect =
T.workspace / "out" / "g8" / "generate.super" / "io" / "kipp" / "mill" / "giter8" / "G8Module" / "generate.dest" / "result" / "minimal" / "src" / "com" / "example" / "someproject" / "Main.scala"

assert(os.exists(expectedFile) || os.exists(newExpect))
}