Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/auto-update-semconv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ jobs:
java-version: 21

- uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
with:
cache-read-only: true

- name: Generate code
run: ./gradlew clean generateSemanticConventions --console=plain
Expand Down
23 changes: 22 additions & 1 deletion .github/workflows/build-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,28 @@ jobs:
java-version: 21

- uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
with:
cache-read-only: >-
${{
inputs.cache-read-only ||
Comment thread
trask marked this conversation as resolved.
secrets.DEVELOCITY_ACCESS_KEY == '' ||
github.ref_name != github.event.repository.default_branch ||
(matrix.os == 'ubuntu-latest' && matrix.test-java-version != 21) ||
(matrix.os == 'macos-latest' && matrix.test-java-version != 25) ||
(matrix.os == 'windows-latest' && matrix.test-java-version != 25)
}}
gradle-home-cache-excludes: >-
${{
secrets.DEVELOCITY_ACCESS_KEY != '' &&
github.ref_name == github.event.repository.default_branch &&
(
(matrix.os == 'ubuntu-latest' && matrix.test-java-version == 21) ||
(matrix.os == 'macos-latest' && matrix.test-java-version == 25) ||
(matrix.os == 'windows-latest' && matrix.test-java-version == 25)
) &&
'caches/build-cache-1' ||
''
}}

- name: build
shell: bash
Expand Down Expand Up @@ -127,4 +149,3 @@ jobs:
echo $(git diff --cached)
exit 1
fi

2 changes: 2 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ jobs:
# but does not build or publish release artifacts.
if: matrix.language == 'java'
uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
with:
cache-read-only: true

- name: Initialize CodeQL
uses: github/codeql-action/init@5595ccaf912efad79be6eef63a5619ff05969be3 # v4.37.6
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ permissions:
jobs:
build:
uses: ./.github/workflows/build-common.yml
with:
cache-read-only: true
secrets:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}

Expand Down Expand Up @@ -38,6 +40,8 @@ jobs:
java-version: 21

- uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
with:
cache-read-only: true

- name: Build and publish artifacts
run: ./gradlew assemble publishToSonatype closeAndReleaseSonatypeStagingRepository
Expand Down Expand Up @@ -188,6 +192,8 @@ jobs:

- name: Setup Gradle
uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
with:
cache-read-only: true

- name: Update apidiff baseline
env:
Expand Down
11 changes: 10 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ dependencyResolutionManagement {
val develocityServer = "https://develocity.opentelemetry.io"
val isCI = System.getenv("CI") != null
val develocityAccessKey = System.getenv("DEVELOCITY_ACCESS_KEY") ?: ""
val isRemoteBuildCachePushEnabled = isCI && develocityAccessKey.isNotEmpty()
val shouldDisableLocalBuildCache =
isRemoteBuildCachePushEnabled && System.getenv("GITHUB_REF_NAME") == "main"

// if develocity access key is not given and we are in CI, then we publish to scans.gradle.com
val useScansGradleCom = isCI && develocityAccessKey.isEmpty()
Expand Down Expand Up @@ -50,8 +53,14 @@ develocity {

if (!useScansGradleCom) {
buildCache {
// A task loaded from the local build cache is never pushed to the remote build cache. Disable
// the local cache for authenticated main builds so executed tasks populate Develocity.
local {
isEnabled = !shouldDisableLocalBuildCache
}

remote(develocity.buildCache) {
isPush = isCI && develocityAccessKey.isNotEmpty()
isPush = isRemoteBuildCachePushEnabled
}
}
}
Expand Down
Loading