File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,12 +37,15 @@ jobs:
3737 - name : Set up gradle
3838 uses : gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
3939 with :
40- cache-read-only : ${{ github.event_name == 'pull_request' }}
40+ cache-read-only : ${{ github.event_name != 'push' || github.ref_name != github.event.repository.default_branch }}
41+ gradle-home-cache-excludes : >-
42+ ${{ matrix.os == 'ubuntu-latest' && secrets.DEVELOCITY_ACCESS_KEY != '' && github.ref_name == github.event.repository.default_branch && 'caches/build-cache-1' || '' }}
4143
4244 - name : Build
4345 run : ./gradlew clean check shadowJar
4446 env :
45- DEVELOCITY_ACCESS_KEY : ${{ secrets.DEVELOCITY_ACCESS_KEY }}
47+ DEVELOCITY_ACCESS_KEY : >-
48+ ${{ matrix.os == 'ubuntu-latest' && github.ref_name == github.event.repository.default_branch && secrets.DEVELOCITY_ACCESS_KEY || '' }}
4649
4750 - run : java -cp sdk-usage/build/libs/opentelemetry-examples-sdk-usage-0.1.0-SNAPSHOT-all.jar io.opentelemetry.sdk.example.ConfigureSpanProcessorExample
4851
@@ -62,15 +65,13 @@ jobs:
6265 - name : Set up gradle
6366 uses : gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
6467 with :
65- cache-read-only : ${{ github.event_name == 'pull_request' }}
68+ cache-read-only : true
6669
6770 - name : Run declarative-configuration
6871 working-directory : declarative-configuration
6972 run : |
7073 export OTEL_EXPERIMENTAL_CONFIG_FILE=$(pwd)/otel-sdk-config.yaml
7174 ../gradlew run
72- env :
73- DEVELOCITY_ACCESS_KEY : ${{ secrets.DEVELOCITY_ACCESS_KEY }}
7475
7576 lint :
7677 uses : ./.github/workflows/reusable-lint-check.yml
Original file line number Diff line number Diff line change 4242 - name : Set up gradle
4343 if : matrix.language == 'java'
4444 uses : gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
45+ with :
46+ cache-read-only : true
4547
4648 - name : Initialize CodeQL
4749 uses : github/codeql-action/init@5595ccaf912efad79be6eef63a5619ff05969be3 # v4.37.6
5759 # --no-daemon is required for codeql to observe the compilation
5860 # (see https://docs.github.com/en/code-security/codeql-cli/getting-started-with-the-codeql-cli/preparing-your-code-for-codeql-analysis#specifying-build-commands)
5961 run : ./gradlew assemble --no-build-cache --no-daemon
60- env :
61- DEVELOCITY_ACCESS_KEY : ${{ secrets.DEVELOCITY_ACCESS_KEY }}
6262
6363 - name : Perform CodeQL analysis
6464 uses : github/codeql-action/analyze@5595ccaf912efad79be6eef63a5619ff05969be3 # v4.37.6
Original file line number Diff line number Diff line change 3535 - name : Set up gradle
3636 uses : gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
3737 with :
38- cache-read-only : ${{ github.event_name == 'pull_request' }}
38+ cache-read-only : true
3939
4040 - uses : jdx/mise-action@7e36c90d9ab29c415a2384db3006f3ec8a8cc654 # v4.2.4
4141
Original file line number Diff line number Diff line change 3131 - name : Set up gradle
3232 uses : gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
3333 with :
34- cache-read-only : ${{ github.event_name == 'pull_request' }}
34+ cache-read-only : true
3535
3636 - name : Run Prometheus test
3737 run : .github/scripts/prometheus-test.sh
Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ plugins {
1717val develocityServer = " https://develocity.opentelemetry.io"
1818val isCI = System .getenv(" CI" ) != null
1919val develocityAccessKey = System .getenv(" DEVELOCITY_ACCESS_KEY" ) ? : " "
20+ val isRemoteBuildCachePushEnabled = isCI && develocityAccessKey.isNotEmpty()
21+ val shouldDisableLocalBuildCache =
22+ isRemoteBuildCachePushEnabled && System .getenv(" GITHUB_REF_NAME" ) == " main"
2023
2124develocity {
2225 if (develocityAccessKey.isNotEmpty()) {
@@ -45,9 +48,15 @@ develocity {
4548}
4649
4750buildCache {
48- remote(HttpBuildCache ::class ) {
49- url = uri(" $develocityServer /cache/" )
50- isPush = isCI && develocityAccessKey.isNotEmpty()
51+ // Tasks restored from the local cache are never pushed to the remote cache. Disable the local
52+ // cache on the authenticated main build so the remote cache converges on complete.
53+ local {
54+ isEnabled = ! shouldDisableLocalBuildCache
55+ }
56+
57+ remote(develocity.buildCache) {
58+ server = develocityServer
59+ isPush = isRemoteBuildCachePushEnabled
5160 }
5261}
5362
You can’t perform that action at this time.
0 commit comments