Skip to content

Commit 0e2c96b

Browse files
Don't require a publishLocal to run ITs
1 parent 1b24bf2 commit 0e2c96b

File tree

4 files changed

+34
-12
lines changed

4 files changed

+34
-12
lines changed

.github/workflows/ci.yml

-4
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,9 @@ jobs:
8484
with:
8585
jvm: "zulu:17"
8686
- run: |
87-
./mill -i __.publishLocal &&\
8887
./mill -i integration.test.jvm
8988
if: runner.os != 'Windows'
9089
- run: |
91-
@call ./mill.bat -i __.publishLocal
9290
@call ./mill.bat -i integration.test.jvm
9391
shell: cmd
9492
if: runner.os == 'Windows'
@@ -127,11 +125,9 @@ jobs:
127125
if-no-files-found: error
128126
retention-days: 1
129127
- run: |
130-
./mill -i __.publishLocal &&\
131128
./mill -i "integration.test.native"
132129
if: github.event_name == 'push' && runner.os != 'Windows'
133130
- run: |
134-
./mill.bat -i __.publishLocal
135131
./mill.bat -i integration.test.native
136132
if: github.event_name == 'push' && runner.os == 'Windows'
137133
shell: bash

build.sc

+20-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ object Dependencies {
1919

2020
def scalaVersions = Seq(scala212, scala213)
2121

22+
def serverScalaVersion = scala212
23+
2224
def asmVersion = "9.6"
2325
def coursierVersion = "2.1.0-M6-53-gb4f448130"
2426
def graalvmVersion = "22.2.0"
@@ -532,8 +534,8 @@ object `bloop-rifle` extends BloopCliModule {
532534
|
533535
|/** Build-time constants. Generated by mill. */
534536
|object Constants {
535-
| def bloopVersion = "${frontend(Dependencies.scala212).publishVersion()}"
536-
| def bloopScalaVersion = "${Dependencies.scala212}"
537+
| def bloopVersion = "${frontend(Dependencies.serverScalaVersion).publishVersion()}"
538+
| def bloopScalaVersion = "${Dependencies.serverScalaVersion}"
537539
| def bspVersion = "${Dependencies.bsp4j.dep.version}"
538540
|}
539541
|""".stripMargin
@@ -607,6 +609,19 @@ object integration extends BloopCliModule {
607609
Dependencies.pprint
608610
)
609611

612+
private def repoRoot = os.pwd / "out" / "repo"
613+
def localRepo = T {
614+
val modules = Seq(
615+
frontend(Dependencies.serverScalaVersion),
616+
backend(Dependencies.serverScalaVersion),
617+
shared(Dependencies.serverScalaVersion)
618+
)
619+
os.remove.all(repoRoot)
620+
os.makeDir.all(repoRoot)
621+
val tasks = modules.map(_.publishLocalNoFluff(repoRoot.toString))
622+
define.Target.sequence(tasks)
623+
}
624+
610625
def forkEnv = super.forkEnv() ++ Seq(
611626
"BLOOP_CLI_TESTS_TMP_DIR" -> tmpDir()
612627
)
@@ -615,8 +630,10 @@ object integration extends BloopCliModule {
615630
def test(args: String*) = {
616631
val argsTask = T.task {
617632
val launcher = launcherTask().path
633+
localRepo()
618634
val extraArgs = Seq(
619-
s"-Dtest.bloop-cli.path=$launcher"
635+
s"-Dtest.bloop-cli.path=$launcher",
636+
s"-Dtest.bloop-cli.repo=$repoRoot"
620637
)
621638
args ++ extraArgs
622639
}

integration/test/src/bloop/cli/integration/BloopCliTests.scala

+4-5
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,21 @@ class BloopCliTests extends munit.FunSuite {
99
val dirArgs = Seq[os.Shellable]("--daemon-dir", root / "daemon")
1010

1111
os.proc(Launcher.launcher, "exit", dirArgs)
12-
.call(cwd = root)
12+
.call(cwd = root, stdin = os.Inherit, stdout = os.Inherit)
1313
val statusCheck0 = os.proc(Launcher.launcher, "status", dirArgs)
1414
.call(cwd = root)
1515
.out.trim()
1616
expect(statusCheck0 == "stopped")
1717

18-
val res = os.proc(Launcher.launcher, dirArgs, "about")
19-
.call(cwd = root)
20-
expect(res.out.text().startsWith("bloop v"))
18+
os.proc(Launcher.launcher, dirArgs, "about")
19+
.call(cwd = root, stdin = os.Inherit, stdout = os.Inherit, env = Launcher.extraEnv)
2120
val statusCheck1 = os.proc(Launcher.launcher, "status", dirArgs)
2221
.call(cwd = root)
2322
.out.trim()
2423
expect(statusCheck1 == "running")
2524

2625
os.proc(Launcher.launcher, "exit", dirArgs)
27-
.call(cwd = root)
26+
.call(cwd = root, stdin = os.Inherit, stdout = os.Inherit)
2827
val statusCheck2 = os.proc(Launcher.launcher, "status", dirArgs)
2928
.call(cwd = root)
3029
.out.trim()

integration/test/src/bloop/cli/integration/Launcher.scala

+10
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,14 @@ object Launcher {
77
sys.error("test.bloop-cli.path not set")
88
)
99

10+
lazy val repoRoot = os.Path(sys.props.getOrElse(
11+
"test.bloop-cli.repo",
12+
sys.error("test.bloop-cli.repo not set")
13+
))
14+
15+
lazy val extraEnv =
16+
Map(
17+
"COURSIER_REPOSITORIES" -> s"ivy:${repoRoot.toNIO.toUri.toASCIIString}/[defaultPattern]|ivy2Local|central"
18+
)
19+
1020
}

0 commit comments

Comments
 (0)