Skip to content

Commit 3aa19d6

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

File tree

4 files changed

+50
-11
lines changed

4 files changed

+50
-11
lines changed

.github/workflows/build-dotty.yml

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

project/Build.scala

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -339,24 +339,27 @@ 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.withEnabled(true).withStoreEnabled(true))
350+
.withRemote(buildCache.remote.withEnabled(true).withStoreEnabled(isInsideCI))
351351
)
352-
.withTestRetryConfiguration(
353-
config.testRetryConfiguration
352+
.withTestRetry(
353+
config.testRetry
354354
.withFlakyTestPolicy(FlakyTestPolicy.Fail)
355355
.withMaxRetries(if (isInsideCI) 1 else 0)
356356
.withMaxFailures(10)
357357
.withClassesFilter((className, _) => !noRetryTestClasses.contains(className))
358358
)
359-
}
359+
},
360+
// Deactivate Develocity's test caching because it caches all tests or nothing.
361+
// Also at the moment, it does not take compilation files as inputs.
362+
Test / develocityBuildCacheClient := None,
360363
)
361364

362365
// Settings shared globally (scoped in Global). Used in build.sbt
@@ -1015,10 +1018,6 @@ object Build {
10151018
sjsSources
10161019
} (Set(scalaJSIRSourcesJar)).toSeq
10171020
}.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,
10221021
)
10231022

10241023
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")

project/scripts/sbt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ CMD="${1:?Missing sbt command}"
1010
sbt -J-XX:ReservedCodeCacheSize=512m \
1111
-DSBT_PGP_USE_GPG=false \
1212
-no-colors \
13+
-Ddevelocity.internal.cache.verbose=true \
14+
-Ddevelocity.internal.cache.defaultLogLevel=info \
1315
"$CMD"

0 commit comments

Comments
 (0)