Skip to content

Commit 3d55eda

Browse files
committed
chore: add support for sbt scripted tests in the new build
1 parent dd39e0b commit 3d55eda

File tree

5 files changed

+47
-94
lines changed

5 files changed

+47
-94
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
- name: Cmd Tests
9898
run: |
9999
./project/scripts/buildScalaBinary
100-
./project/scripts/sbt ";scala3-bootstrapped/compile ;sbt-test/scripted scala2-compat/* ;scala3-compiler-bootstrapped/scala3CompilerCoursierTest:test"
100+
./project/scripts/sbt ";scala3-bootstrapped/compile ;scala3-bootstrapped/publishLocal ;scala3-compiler-bootstrapped/scala3CompilerCoursierTest:test"
101101
./project/scripts/cmdTests
102102
./project/scripts/bootstrappedOnlyCmdTests
103103
@@ -339,51 +339,6 @@ jobs:
339339
if: ${{ always() }}
340340
run: cat community-build/dotty-community-build-deps || true
341341

342-
test_sbt:
343-
runs-on: [self-hosted, Linux]
344-
container:
345-
image: lampepfl/dotty:2024-10-18
346-
options: --cpu-shares 4096
347-
volumes:
348-
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
349-
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
350-
- ${{ github.workspace }}/../../cache/general:/root/.cache
351-
if: "github.event_name == 'schedule' && github.repository == 'scala/scala3'
352-
|| github.event_name == 'push'
353-
|| (
354-
github.event_name == 'pull_request'
355-
&& !contains(github.event.pull_request.body, '[skip ci]')
356-
&& !contains(github.event.pull_request.body, '[skip test_sbt]')
357-
)
358-
|| (
359-
github.event_name == 'workflow_dispatch'
360-
&& github.repository == 'scala/scala3'
361-
)"
362-
363-
steps:
364-
- name: Set JDK 17 as default
365-
run: echo "/usr/lib/jvm/java-17-openjdk-amd64/bin" >> $GITHUB_PATH
366-
367-
- name: Reset existing repo
368-
run: |
369-
git config --global --add safe.directory $GITHUB_WORKSPACE
370-
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true
371-
372-
- name: Checkout cleanup script
373-
uses: actions/checkout@v5
374-
375-
- name: Cleanup
376-
run: .github/workflows/cleanup.sh
377-
378-
- name: Git Checkout
379-
uses: actions/checkout@v5
380-
381-
- name: Add SBT proxy repositories
382-
run: cp -vf .github/workflows/repositories /root/.sbt/ ; true
383-
384-
- name: Test sbt
385-
run: ./project/scripts/sbt "sbt-test/scripted"
386-
387342
publish_release:
388343
permissions:
389344
contents: write # for GH CLI to create a release
@@ -395,7 +350,7 @@ jobs:
395350
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
396351
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
397352
- ${{ github.workspace }}/../../cache/general:/root/.cache
398-
needs: [test, community_build_a, community_build_b, community_build_c, test_sbt, build-sdk-package, build-msi-package]
353+
needs: [test, community_build_a, community_build_b, community_build_c, build-sdk-package, build-msi-package]
399354
if: "github.event_name == 'push'
400355
&& startsWith(github.event.ref, 'refs/tags/')"
401356

.github/workflows/scaladoc.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ jobs:
6262
- name: Generate Scala 3 documentation
6363
run: ./project/scripts/sbt scaladoc/generateScalaDocumentation
6464

65-
- name: Generate documentation for example project using dotty-sbt
66-
run: ./project/scripts/sbt "sbt-test/scripted sbt-dotty/scaladoc"
67-
6865
stdlib-sourcelinks-test:
6966
runs-on: ubuntu-latest
7067
# if false - disable flaky test

.github/workflows/stdlib.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,3 +539,20 @@ jobs:
539539
- name: Scala.js JUnit tests
540540
run: ./project/scripts/sbt ";sjsJUnitTests/test ;set sjsJUnitTests/scalaJSLinkerConfig ~= switchToESModules ;sjsJUnitTests/test"
541541
# TODO Scala.js on Windows
542+
543+
scripted-tests:
544+
runs-on: ubuntu-latest
545+
needs: [scala3-compiler-bootstrapped, tasty-core-bootstrapped, scala3-staging, scala3-tasty-inspector, scala-library-sjs, scaladoc]
546+
steps:
547+
- name: Git Checkout
548+
uses: actions/checkout@v5
549+
550+
- name: Set up JDK 17
551+
uses: actions/setup-java@v5
552+
with:
553+
distribution: 'temurin'
554+
java-version: 17
555+
cache: 'sbt'
556+
- uses: sbt/setup-sbt@v1
557+
- name: Run SBT scripted tests
558+
run: ./project/scripts/sbt scala3-bootstrapped-new/scripted

build.sbt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,5 @@ val sjsSandbox = Build.sjsSandbox
5454
val sjsJUnitTests = Build.sjsJUnitTests
5555
val sjsCompilerTests = Build.sjsCompilerTests
5656

57-
val `sbt-test` = Build.`sbt-test`
58-
5957
inThisBuild(Build.thisBuildSettings)
6058
inScope(Global)(Build.globalSettings)

project/Build.scala

Lines changed: 28 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,6 +1471,7 @@ object Build {
14711471
// ==============================================================================================
14721472

14731473
lazy val `scala3-bootstrapped-new` = project
1474+
.enablePlugins(ScriptedPlugin)
14741475
.aggregate(`scala3-interfaces`, `scala3-library-bootstrapped-new` , `scala-library-bootstrapped`,
14751476
`tasty-core-bootstrapped-new`, `scala3-compiler-bootstrapped-new`, `scala3-sbt-bridge-bootstrapped`,
14761477
`scala3-staging-new`, `scala3-tasty-inspector-new`, `scala-library-sjs`, `scala3-library-sjs`, `scaladoc-new`)
@@ -1557,7 +1558,33 @@ object Build {
15571558
(if (args1.nonEmpty) " -Ddotty.tests.filter=" + args1.mkString(" ") else "")
15581559
(`scala3-compiler-bootstrapped-new` / Test / testOnly).toTask(cmd)
15591560
}
1560-
}.evaluated
1561+
}.evaluated,
1562+
// ================================ SBT SCRIPT TEST SETTINGS ================================
1563+
sbtTestDirectory := (ThisBuild / baseDirectory).value / "sbt-test",
1564+
// The batch mode accidentally became the default with no way to disable
1565+
// it in sbt 1.4 (https://github.com/sbt/sbt/issues/5913#issuecomment-716003195).
1566+
// We enable it explicitly here to make it clear that we're using it.
1567+
scriptedBatchExecution := true,
1568+
scriptedLaunchOpts ++= Seq(
1569+
s"-Dplugin.scalaVersion=${dottyVersion}",
1570+
s"-Dplugin.scala2Version=${stdlibVersion(Bootstrapped)}",
1571+
s"-Dplugin.scalaJSVersion=${scalaJSVersion}",
1572+
),
1573+
scriptedBufferLog := true,
1574+
scripted := scripted.dependsOn(
1575+
(`scala3-sbt-bridge-bootstrapped` / publishLocalBin),
1576+
(`scala3-interfaces` / publishLocalBin),
1577+
(`scala3-compiler-bootstrapped-new` / publishLocalBin),
1578+
(`scala3-library-bootstrapped-new` / publishLocalBin),
1579+
(`scala-library-bootstrapped` / publishLocalBin),
1580+
(`scala-library-sjs` / publishLocalBin),
1581+
(`scala3-library-sjs` / publishLocalBin),
1582+
(`tasty-core-bootstrapped-new` / publishLocalBin),
1583+
(`scala3-staging-new` / publishLocalBin),
1584+
(`scala3-tasty-inspector-new` / publishLocalBin),
1585+
(`scaladoc-new` / publishLocalBin),
1586+
publishLocalBin,
1587+
).evaluated,
15611588
)
15621589

15631590
/* Configuration of the org.scala-lang:scala3-sbt-bridge:*.**.**-bootstrapped project */
@@ -3507,47 +3534,6 @@ object Build {
35073534
BuildInfoPlugin.buildInfoScopedSettings(Test),
35083535
)
35093536

3510-
// various scripted sbt tests
3511-
lazy val `sbt-test` = project.in(file("sbt-test")).
3512-
enablePlugins(ScriptedPlugin).
3513-
settings(commonSettings).
3514-
settings(
3515-
sbtTestDirectory := baseDirectory.value,
3516-
target := baseDirectory.value / ".." / "out" / name.value,
3517-
3518-
// The batch mode accidentally became the default with no way to disable
3519-
// it in sbt 1.4 (https://github.com/sbt/sbt/issues/5913#issuecomment-716003195).
3520-
// We enable it explicitly here to make it clear that we're using it.
3521-
scriptedBatchExecution := true,
3522-
3523-
scriptedLaunchOpts ++= Seq(
3524-
"-Dplugin.version=" + version.value,
3525-
"-Dplugin.scalaVersion=" + dottyVersion,
3526-
"-Dplugin.scala2Version=" + stdlibVersion(Bootstrapped),
3527-
"-Dplugin.scalaJSVersion=" + scalaJSVersion,
3528-
"-Dsbt.boot.directory=" + ((ThisBuild / baseDirectory).value / ".sbt-scripted").getAbsolutePath // Workaround sbt/sbt#3469
3529-
),
3530-
// Pass along ivy home and repositories settings to sbt instances run from the tests
3531-
scriptedLaunchOpts ++= {
3532-
val repositoryPath = (io.Path.userHome / ".sbt" / "repositories").absolutePath
3533-
s"-Dsbt.repository.config=$repositoryPath" ::
3534-
ivyPaths.value.ivyHome.map("-Dsbt.ivy.home=" + _.getAbsolutePath).toList
3535-
},
3536-
scriptedBufferLog := true,
3537-
scripted := scripted.dependsOn(
3538-
(`scala3-sbt-bridge` / publishLocalBin),
3539-
(`scala3-interfaces` / publishLocalBin),
3540-
(`scala3-compiler-bootstrapped` / publishLocalBin),
3541-
(`scala3-library-bootstrapped` / publishLocalBin),
3542-
(`scala3-library-bootstrappedJS` / publishLocalBin),
3543-
(`tasty-core-bootstrapped` / publishLocalBin),
3544-
(`scala3-staging` / publishLocalBin),
3545-
(`scala3-tasty-inspector` / publishLocalBin),
3546-
(`scaladoc` / publishLocalBin),
3547-
(`scala3-bootstrapped` / publishLocalBin) // Needed because sbt currently hardcodes the dotty artifact
3548-
).evaluated
3549-
)
3550-
35513537
val prepareCommunityBuild = taskKey[Unit]("Publish local the compiler and the sbt plugin. Also store the versions of the published local artefacts in two files, community-build/{scala3-bootstrapped.version,sbt-injected-plugins}.")
35523538

35533539
lazy val `community-build` = project.in(file("community-build")).

0 commit comments

Comments
 (0)