Skip to content

Commit 1bc1df9

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

File tree

4 files changed

+66
-11
lines changed

4 files changed

+66
-11
lines changed

.github/workflows/build-dotty.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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: Checkout cleanup script
21+
uses: actions/checkout@v4
22+
- name: Cleanup
23+
run: .github/workflows/cleanup.sh
24+
- name: Git Checkout
25+
uses: actions/checkout@v4
26+
- name: Add SBT proxy repositories
27+
run: cp -vf .github/workflows/repositories /root/.sbt/ ; true
28+
- name: Compile Non-Bootstrapped Dotty
29+
run: ./project/scripts/sbt "; clean; compile"
30+
31+
build-bootstrapped:
32+
needs: build-non-bootstrapped
33+
runs-on: [self-hosted, Linux]
34+
container:
35+
image: lampepfl/dotty:2024-10-18
36+
options: --cpu-shares 4096
37+
volumes:
38+
- /nfs-cache/.develocity/build-cache:/root/.sbt/1.0/.develocity/build-cache
39+
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
40+
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
41+
- ${{ github.workspace }}/../../cache/general:/root/.cache
42+
steps:
43+
- name: Set JDK 17 as default
44+
run: echo "/usr/lib/jvm/java-17-openjdk-amd64/bin" >> $GITHUB_PATH
45+
- name: Checkout cleanup script
46+
uses: actions/checkout@v4
47+
- name: Cleanup
48+
run: .github/workflows/cleanup.sh
49+
- name: Git Checkout
50+
uses: actions/checkout@v4
51+
- name: Add SBT proxy repositories
52+
run: cp -vf .github/workflows/repositories /root/.sbt/ ; true
53+
- name: Compile Bootstrapped Dotty
54+
run: ./project/scripts/sbt "; clean; scala3-bootstrapped/compile"

project/Build.scala

+9-10
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

+1-1
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

+2
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)