Skip to content

Commit

Permalink
chore: test local cache in the CI
Browse files Browse the repository at this point in the history
  • Loading branch information
hamzaremmal committed Feb 10, 2025
1 parent 7ac31d0 commit e57cc25
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 11 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/build-dotty.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build Dotty

on:
pull_request:

jobs:
build-non-bootstrapped:
runs-on: [self-hosted, Linux]
container:
image: lampepfl/dotty:2024-10-18
options: --cpu-shares 4096
volumes:
- ~/.sbt/1.0/.develocity/build-cache:/nfs-cache/.develocity/build-cache
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
- ${{ github.workspace }}/../../cache/general:/root/.cache
steps:
- name: Set JDK 17 as default
run: echo "/usr/lib/jvm/java-17-openjdk-amd64/bin" >> $GITHUB_PATH
- name: Compile Non-Bootstrapped Dotty
run: ./project/scripts/sbt "; clean; compile"

build-bootstrapped:
needs: build-non-bootstrapped
runs-on: [self-hosted, Linux]
container:
image: lampepfl/dotty:2024-10-18
options: --cpu-shares 4096
volumes:
- ~/.sbt/1.0/.develocity/build-cache:/nfs-cache/.develocity/build-cache
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
- ${{ github.workspace }}/../../cache/general:/root/.cache
steps:
- name: Set JDK 17 as default
run: echo "/usr/lib/jvm/java-17-openjdk-amd64/bin" >> $GITHUB_PATH
- name: Compile Bootstrapped Dotty
run: ./project/scripts/sbt "; clean; scala3-bootstrapped/compile"
19 changes: 9 additions & 10 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -339,24 +339,27 @@ object Build {
buildScan
.withPublishing(Publishing.onlyIf(_.authenticated))
.withBackgroundUpload(!isInsideCI)
.tag(if (isInsideCI) "CI" else "Local")
.withTag(if (isInsideCI) "CI" else "Local")
.withLinks(buildScan.links ++ GithubEnv.develocityLinks)
.withValues(buildScan.values ++ GithubEnv.develocityValues)
.withObfuscation(buildScan.obfuscation.withIpAddresses(_.map(_ => "0.0.0.0")))
)
.withBuildCache(
buildCache
.withLocal(buildCache.local.withEnabled(false))
.withRemote(buildCache.remote.withEnabled(false))
.withLocal(buildCache.local.withEnabled(true).withStoreEnabled(true))
.withRemote(buildCache.remote.withEnabled(true).withStoreEnabled(isInsideCI))
)
.withTestRetryConfiguration(
config.testRetryConfiguration
.withTestRetry(
config.testRetry
.withFlakyTestPolicy(FlakyTestPolicy.Fail)
.withMaxRetries(if (isInsideCI) 1 else 0)
.withMaxFailures(10)
.withClassesFilter((className, _) => !noRetryTestClasses.contains(className))
)
}
},
// Deactivate Develocity's test caching because it caches all tests or nothing.
// Also at the moment, it does not take compilation files as inputs.
Test / develocityBuildCacheClient := None,
)

// Settings shared globally (scoped in Global). Used in build.sbt
Expand Down Expand Up @@ -1015,10 +1018,6 @@ object Build {
sjsSources
} (Set(scalaJSIRSourcesJar)).toSeq
}.taskValue,

// Develocity's Build Cache does not work with our compilation tests
// at the moment: it does not take compilation files as inputs.
Test / develocityBuildCacheClient := None,
)

def insertClasspathInArgs(args: List[String], cp: String): List[String] = {
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ addSbtPlugin("ch.epfl.scala" % "sbt-tasty-mima" % "1.0.0")

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

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

0 comments on commit e57cc25

Please sign in to comment.