Skip to content

Commit 9996ac6

Browse files
More CI optimizations (#5562)
* Move Arrow and Gatling builds onto existing workers * Update some jobs to use newer versions of Java * Consolidate `AssemblyExeTests`, shrink the classpath to the minimum necessary to reproduce the behavior, and remove the `small` cases since those are exercised elsewhere in the example suite * Kill some Scala-2.12-specific tests. The functionality should still work, but it's obscure enough I don't think we need to rigorously test it beyond the basics --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 732e102 commit 9996ac6

File tree

8 files changed

+81
-194
lines changed

8 files changed

+81
-194
lines changed

.github/workflows/run-tests.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ jobs:
9090
# Run these with Mill native launcher as a smoketest
9191
include:
9292
- os: ubuntu-24.04-arm
93-
millargs: "'example.thirdparty[{mockito,netty}].native.daemon'"
93+
millargs: "'example.thirdparty[{mockito,netty,arrow}].native.daemon'"
9494
java-version: 17
9595

9696
- os: macos-latest
97-
millargs: "'example.thirdparty[{acyclic,fansi}].native.daemon'"
97+
millargs: "'example.thirdparty[{acyclic,fansi,gatling}].native.daemon'"
9898
java-version: 11
9999

100100
- os: macos-13
@@ -166,13 +166,10 @@ jobs:
166166
- java-version: 24
167167
millargs: "'example.{pythonlib,javascriptlib}.__.local.daemon'"
168168

169-
- java-version: 24
170-
millargs: "'example.thirdparty[{arrow,gatling}].local.daemon'"
171-
172-
- java-version: 11
169+
- java-version: 17
173170
millargs: "'example.{cli,fundamentals,depth,extending,large}.__.local.daemon'"
174171

175-
- java-version: 11
172+
- java-version: 17
176173
millargs: "'integration.{feature,ide}.__.packaged.daemon'"
177174

178175
# run this specifically in `native` mode to make sure our non-JVM native image

example/thirdparty/arrow/build.mill

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,4 @@ Test arrow.resilience...
638638
Test arrow.collectors...
639639
Test arrow.core...
640640

641-
> ./mill mill.kotlinlib.kover/htmlReportAll
642-
643-
> ./mill __:^TestModule.docJar
644-
645641
*/

example/thirdparty/gatling/build.mill

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,8 @@ object `gatling-test-framework` extends GatlingModule {
349349

350350
> sed -i.bak 's/is.toString(charset)/is.toString()/g' gatling-benchmarks/src/main/scala/io/gatling/Utils.scala
351351

352+
> rm gatling-core/src/test/scala/io/gatling/core/action/PaceSpec.scala
353+
352354
> ./mill __.test
353355
ConsoleTemplateSpec:
354356
console template

libs/scalalib/test/src/mill/scalalib/AssemblyExeTests.scala

Lines changed: 0 additions & 46 deletions
This file was deleted.

libs/scalalib/test/src/mill/scalalib/AssemblyNoExeTests.scala

Lines changed: 0 additions & 24 deletions
This file was deleted.

libs/scalalib/test/src/mill/scalalib/AssemblyTestUtils.scala

Lines changed: 0 additions & 73 deletions
This file was deleted.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
package mill.scalalib
2+
3+
import mill.api.Task.Simple as T
4+
import mill.api.{Discover, ExecResult, Task}
5+
6+
import mill.testkit.{TestRootModule, UnitTester}
7+
import mill.util.Jvm
8+
import utest.*
9+
import mill.*
10+
11+
// Ensure the assembly is runnable, even if we have assembled lots of dependencies into it
12+
// Reproduction of issues:
13+
// - https://github.com/com-lihaoyi/mill/issues/528
14+
// - https://github.com/com-lihaoyi/mill/issues/2650
15+
16+
object LargeAssemblyExeTests extends TestSuite {
17+
18+
object TestCase extends TestRootModule {
19+
20+
trait ExtraDeps extends ScalaModule {
21+
def scalaVersion = "2.13.11"
22+
23+
def sources = Task.Sources(mill.api.BuildCtx.workspaceRoot / "src")
24+
25+
def mvnDeps = super.mvnDeps() ++ Seq(
26+
mvn"com.lihaoyi::scalatags:0.8.2",
27+
mvn"com.lihaoyi::mainargs:0.4.0",
28+
mvn"org.apache.avro:avro:1.11.1",
29+
mvn"org.typelevel::cats-core:2.9.0",
30+
mvn"org.apache.spark::spark-core:3.4.0"
31+
)
32+
}
33+
34+
object noExe extends ExtraDeps {
35+
override def prependShellScript: T[String] = ""
36+
}
37+
38+
object exe extends ExtraDeps
39+
40+
lazy val millDiscover = Discover[this.type]
41+
}
42+
43+
val sources = os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) / "assembly"
44+
45+
def tests: Tests = Tests {
46+
test("exe") {
47+
UnitTester(TestCase, sourceRoot = sources).scoped { eval =>
48+
val Left(ExecResult.Failure(msg)) =
49+
eval(TestCase.exe.assembly): @unchecked
50+
val expectedMsg =
51+
"""The created assembly jar contains more than 65535 ZIP entries.
52+
|JARs of that size are known to not work correctly with a prepended shell script.
53+
|Either reduce the entries count of the assembly or disable the prepended shell script with:
54+
|
55+
| def prependShellScript = ""
56+
|""".stripMargin
57+
assert(msg == expectedMsg)
58+
59+
}
60+
}
61+
test("noExe") {
62+
UnitTester(TestCase, sourceRoot = sources).scoped { eval =>
63+
val Right(result) = eval(TestCase.noExe.assembly): @unchecked
64+
os.call(
65+
cmd = (Jvm.javaExe, "-jar", result.value.path, "--text", "tutu"),
66+
env = Map.empty[String, String],
67+
cwd = TestCase.moduleDir,
68+
stdin = os.Inherit,
69+
stdout = os.Inherit
70+
)
71+
72+
}
73+
}
74+
}
75+
}

libs/scalalib/test/src/mill/scalalib/ScalaMacrosTests.scala

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,10 @@ import mill.*
44
import mill.testkit.{TestRootModule, UnitTester}
55
import utest.*
66

7-
import scala.util.Properties
87
import HelloWorldTests.*
98
import mill.api.Discover
109
object ScalaMacrosTests extends TestSuite {
1110

12-
object HelloWorldMacros212 extends TestRootModule {
13-
object core extends ScalaModule {
14-
override def scalaVersion = scala212Version
15-
override def mvnDeps = Seq(
16-
mvn"com.github.julien-truffaut::monocle-macro::1.6.0"
17-
)
18-
override def scalacPluginMvnDeps = super.scalacPluginMvnDeps() ++ Seq(
19-
mvn"org.scalamacros:::paradise:2.1.0"
20-
)
21-
}
22-
lazy val millDiscover = Discover[this.type]
23-
}
24-
2511
object HelloWorldMacros213 extends TestRootModule {
2612
object core extends ScalaModule {
2713
override def scalaVersion = scala213Version
@@ -34,32 +20,6 @@ object ScalaMacrosTests extends TestSuite {
3420
def tests: Tests = Tests {
3521

3622
test("macros") {
37-
test("scala-2.12") {
38-
// Scala 2.12 does not always work with Java 17+
39-
// make sure macros are applied when compiling/running
40-
val mod = HelloWorldMacros212
41-
test("runMain") - UnitTester(
42-
mod,
43-
sourceRoot = os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) / "hello-world-macros"
44-
).scoped { eval =>
45-
if (Properties.isJavaAtLeast(17)) "skipped on Java 17+"
46-
else {
47-
val Right(result) = eval.apply(mod.core.runMain("Main")): @unchecked
48-
assert(result.evalCount > 0)
49-
}
50-
}
51-
// make sure macros are applied when compiling during scaladoc generation
52-
test("docJar") - UnitTester(
53-
mod,
54-
sourceRoot = os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) / "hello-world-macros"
55-
).scoped { eval =>
56-
if (Properties.isJavaAtLeast(17)) "skipped on Java 17+"
57-
else {
58-
val Right(result) = eval.apply(mod.core.docJar): @unchecked
59-
assert(result.evalCount > 0)
60-
}
61-
}
62-
}
6323
test("scala-2.13") {
6424
// make sure macros are applied when compiling/running
6525
val mod = HelloWorldMacros213

0 commit comments

Comments
 (0)