From e57cc2531d8d21a393305043cafe4f3424565646 Mon Sep 17 00:00:00 2001 From: Hamza Remmal Date: Mon, 10 Feb 2025 21:27:08 +0100 Subject: [PATCH] chore: test local cache in the CI --- .github/workflows/build-dotty.yml | 38 +++++++++++++++++++++++++++++++ project/Build.scala | 19 ++++++++-------- project/plugins.sbt | 2 +- 3 files changed, 48 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/build-dotty.yml diff --git a/.github/workflows/build-dotty.yml b/.github/workflows/build-dotty.yml new file mode 100644 index 000000000000..57a6c21ef2ff --- /dev/null +++ b/.github/workflows/build-dotty.yml @@ -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" \ No newline at end of file diff --git a/project/Build.scala b/project/Build.scala index 463abab3f6fd..edaa9f6fc885 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -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 @@ -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] = { diff --git a/project/plugins.sbt b/project/plugins.sbt index b3e4af1f72e7..ae611d4593c8 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -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")