Skip to content

Commit d887d01

Browse files
authored
ci: publish Build Scans and cache to the OSS Community Develocity instance (#36)
Replaces the self-hosted HttpBuildCache with Develocity's remote cache at community.develocity.cloud under project `meshtastic`, matching the Meshtastic-Android onboarding (meshtastic/Meshtastic-Android#6531). Scans publish only from authenticated builds, so fork PRs and developers who have not provisioned a key are unaffected; only authenticated CI runs write to the cache. The GRADLE_CACHE_URL / _USERNAME / _PASSWORD secrets are no longer read, but are deliberately left in place as the rollback path. Signed-off-by: James Rich <james.a.rich@gmail.com>
1 parent b7ae140 commit d887d01

7 files changed

Lines changed: 69 additions & 68 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ concurrency:
1414
permissions:
1515
contents: read
1616

17-
env:
18-
GRADLE_CACHE_URL: ${{ secrets.GRADLE_CACHE_URL }}
19-
GRADLE_CACHE_USERNAME: ${{ secrets.GRADLE_CACHE_USERNAME }}
20-
GRADLE_CACHE_PASSWORD: ${{ secrets.GRADLE_CACHE_PASSWORD }}
21-
2217
jobs:
2318
# Code-quality gate + the targets whose tests actually EXECUTE on a Linux host:
2419
# JVM, JS (Node + headless-Chrome), Wasm (wasmJs/wasmWasi on Node) and the
@@ -39,6 +34,8 @@ jobs:
3934

4035
- name: Setup Gradle
4136
uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
37+
with:
38+
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
4239

4340
- name: Cache Konan (Kotlin/Native toolchain)
4441
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
@@ -76,6 +73,8 @@ jobs:
7673

7774
- name: Setup Gradle
7875
uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
76+
with:
77+
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
7978

8079
- name: Cache Konan (Kotlin/Native toolchain)
8180
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0

.github/workflows/docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ jobs:
4040

4141
- name: Set up Gradle
4242
uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
43+
with:
44+
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
4345

4446
- name: Build documentation
4547
run: ./gradlew dokkaGenerate --no-daemon

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ jobs:
4444

4545
- name: Setup Gradle
4646
uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
47+
with:
48+
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
4749

4850
- name: Build, test & API check (all targets)
4951
run: ./gradlew build --stacktrace

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[![codecov](https://codecov.io/gh/meshtastic/kzstd/graph/badge.svg)](https://codecov.io/gh/meshtastic/kzstd)
66
[![License: GPL-3.0](https://img.shields.io/badge/License-GPLv3-blue.svg)](LICENSE)
77
[![Kotlin Multiplatform](https://img.shields.io/badge/Kotlin-Multiplatform-blue.svg?logo=kotlin)](https://kotlinlang.org)
8+
[![Revved up by Develocity](https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle&labelColor=02303A)](https://community.develocity.cloud/scans?search.rootProjectNames=kzstd)
89

910
A pure-Kotlin, multiplatform [Zstandard](https://facebook.github.io/zstd/) (zstd)
1011
codec with dictionary support. It produces and reads **standard zstd frames** that

gradle/build-cache.settings.gradle

Lines changed: 0 additions & 62 deletions
This file was deleted.

gradle/develocity.settings.gradle

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// SPDX-License-Identifier: GPL-3.0-or-later
2+
/*
3+
* Develocity — Build Scans and remote Build Cache on the OSS Community instance
4+
* (https://community.develocity.cloud), project `meshtastic`.
5+
*
6+
* Replaces the former self-hosted HttpBuildCache: GRADLE_CACHE_URL / _USERNAME /
7+
* _PASSWORD are no longer read anywhere in this repo.
8+
*/
9+
10+
def isCI = System.getenv("CI") != null
11+
12+
develocity {
13+
server = "https://community.develocity.cloud"
14+
projectId = "meshtastic"
15+
buildScan {
16+
uploadInBackground = !isCI
17+
// Unauthenticated builds (fork PRs, developers who never provisioned a key)
18+
// publish nothing rather than failing.
19+
publishing.onlyIf { it.authenticated }
20+
// Fingerprints power cache-miss comparison (CI debugging); skip the payload locally.
21+
capture { fileFingerprints = isCI }
22+
// Public instance: no machine identity. Constants on purpose — scans already
23+
// record OS/CPU and CCUD adds CI metadata. Keep the `if` OUTSIDE the closures:
24+
// capture-free closures are what the configuration cache can serialize.
25+
obfuscation {
26+
ipAddresses { addresses -> addresses.collect { "0.0.0.0" } }
27+
externalProcessName { "external-process" }
28+
if (isCI) {
29+
username { "ci" }
30+
hostname { "ci-runner" }
31+
} else {
32+
username { "local-dev" }
33+
hostname { "local-machine" }
34+
}
35+
}
36+
}
37+
}
38+
39+
// Resolved outside the buildCache block: inside it the closure delegate is
40+
// BuildCacheConfiguration, which has no `develocity` property.
41+
def develocityBuildCache = develocity.buildCache
42+
def accessKey = System.getenv("DEVELOCITY_ACCESS_KEY")?.trim()
43+
44+
buildCache {
45+
// Off on CI: runners are ephemeral and every hit comes from the remote anyway.
46+
local {
47+
enabled = !isCI
48+
}
49+
remote(develocityBuildCache) {
50+
enabled = true
51+
// Only authenticated CI writes, so unmerged and fork code cannot poison the cache.
52+
push = isCI && accessKey != null && !accessKey.isEmpty()
53+
}
54+
}

settings.gradle.kts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ pluginManagement {
66
}
77
}
88

9-
apply(from = "gradle/build-cache.settings.gradle")
9+
plugins {
10+
id("com.gradle.develocity") version "4.5.0"
11+
id("com.gradle.common-custom-user-data-gradle-plugin") version "2.8.0"
12+
}
13+
14+
apply(from = "gradle/develocity.settings.gradle")
1015

1116
rootProject.name = "kzstd"

0 commit comments

Comments
 (0)