Skip to content

Commit 67f4fb6

Browse files
committed
chore: test local cache in the CI
1 parent 7ac31d0 commit 67f4fb6

File tree

3 files changed

+49
-11
lines changed

3 files changed

+49
-11
lines changed

.github/workflows/build-dotty.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build Dotty
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build-non-bootstrapped:
8+
runs-on: [self-hosted, Linux]
9+
container:
10+
image: lampepfl/dotty:2024-10-18
11+
options: --cpu-shares 4096
12+
volumes:
13+
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
14+
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
15+
- ${{ github.workspace }}/../../cache/general:/root/.cache
16+
steps:
17+
- name: Set JDK 17 as default
18+
run: echo "/usr/lib/jvm/java-17-openjdk-amd64/bin" >> $GITHUB_PATH
19+
- name: Compile Non-Bootstrapped Dotty
20+
run: ./project/scripts/sbt compile
21+
22+
build-bootstrapped:
23+
needs: build-non-bootstrapped
24+
runs-on: [self-hosted, Linux]
25+
container:
26+
image: lampepfl/dotty:2024-10-18
27+
options: --cpu-shares 4096
28+
volumes:
29+
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
30+
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
31+
- ${{ github.workspace }}/../../cache/general:/root/.cache
32+
steps:
33+
- name: Set JDK 17 as default
34+
run: echo "/usr/lib/jvm/java-17-openjdk-amd64/bin" >> $GITHUB_PATH
35+
- name: Compile Bootstrapped Dotty
36+
run: ./project/scripts/sbt scala3-bootstrapped/compile

project/Build.scala

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -339,24 +339,30 @@ object Build {
339339
buildScan
340340
.withPublishing(Publishing.onlyIf(_.authenticated))
341341
.withBackgroundUpload(!isInsideCI)
342-
.tag(if (isInsideCI) "CI" else "Local")
342+
.withTag(if (isInsideCI) "CI" else "Local")
343343
.withLinks(buildScan.links ++ GithubEnv.develocityLinks)
344344
.withValues(buildScan.values ++ GithubEnv.develocityValues)
345345
.withObfuscation(buildScan.obfuscation.withIpAddresses(_.map(_ => "0.0.0.0")))
346346
)
347347
.withBuildCache(
348348
buildCache
349-
.withLocal(buildCache.local.withEnabled(false))
350-
.withRemote(buildCache.remote.withEnabled(false))
349+
.withLocal(buildCache.local
350+
.withDirectory(file("/nfs-cache/.develocity/build-cache"))
351+
.withEnabled(true)
352+
.withStoreEnabled(true))
353+
.withRemote(buildCache.remote.withEnabled(true).withStoreEnabled(isInsideCI))
351354
)
352-
.withTestRetryConfiguration(
353-
config.testRetryConfiguration
355+
.withTestRetry(
356+
config.testRetry
354357
.withFlakyTestPolicy(FlakyTestPolicy.Fail)
355358
.withMaxRetries(if (isInsideCI) 1 else 0)
356359
.withMaxFailures(10)
357360
.withClassesFilter((className, _) => !noRetryTestClasses.contains(className))
358361
)
359-
}
362+
},
363+
// Deactivate Develocity's test caching because it caches all tests or nothing.
364+
// Also at the moment, it does not take compilation files as inputs.
365+
Test / develocityBuildCacheClient := None,
360366
)
361367

362368
// Settings shared globally (scoped in Global). Used in build.sbt
@@ -1015,10 +1021,6 @@ object Build {
10151021
sjsSources
10161022
} (Set(scalaJSIRSourcesJar)).toSeq
10171023
}.taskValue,
1018-
1019-
// Develocity's Build Cache does not work with our compilation tests
1020-
// at the moment: it does not take compilation files as inputs.
1021-
Test / develocityBuildCacheClient := None,
10221024
)
10231025

10241026
def insertClasspathInArgs(args: List[String], cp: String): List[String] = {

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ addSbtPlugin("ch.epfl.scala" % "sbt-tasty-mima" % "1.0.0")
2222

2323
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.10.0")
2424

25-
addSbtPlugin("com.gradle" % "sbt-develocity" % "1.1.1")
25+
addSbtPlugin("com.gradle" % "sbt-develocity" % "1.1.2")

0 commit comments

Comments
 (0)