8
8
branches :
9
9
- ' main'
10
10
11
- permissions : {} # none
11
+ permissions : { } # none
12
12
13
13
# See https://github.com/hibernate/hibernate-orm/pull/4615 for a description of the behavior we're getting.
14
14
concurrency :
@@ -41,10 +41,10 @@ jobs:
41
41
- rdbms : db2
42
42
- rdbms : mssql
43
43
- rdbms : sybase
44
- # Running with CockroachDB requires at least 2-4 vCPUs, which we don't have on GH Actions runners
45
- # - rdbms: cockroachdb
46
- # Running with HANA requires at least 8GB memory just for the database, which we don't have on GH Actions runners
47
- # - rdbms: hana
44
+ # Running with CockroachDB requires at least 2-4 vCPUs, which we don't have on GH Actions runners
45
+ # - rdbms: cockroachdb
46
+ # Running with HANA requires at least 8GB memory just for the database, which we don't have on GH Actions runners
47
+ # - rdbms: hana
48
48
steps :
49
49
- uses : actions/checkout@v4
50
50
with :
@@ -141,7 +141,7 @@ jobs:
141
141
contents : read
142
142
name : GraalVM 21 - ${{matrix.rdbms}}
143
143
# runs-on: ubuntu-latest
144
- runs-on : [self-hosted, Linux, X64, OCI]
144
+ runs-on : [ self-hosted, Linux, X64, OCI ]
145
145
strategy :
146
146
fail-fast : false
147
147
matrix :
@@ -233,5 +233,94 @@ jobs:
233
233
name : test-reports-java11-${{ matrix.rdbms }}
234
234
path : |
235
235
./**/target/reports/tests/
236
+ - name : Omit produced artifacts from build cache
237
+ run : ./ci/before-cache.sh
238
+
239
+ # Static code analysis check
240
+ format_checks :
241
+ permissions :
242
+ contents : read
243
+ name : Static code analysis
244
+ runs-on : ubuntu-latest
245
+ steps :
246
+ - uses : actions/checkout@v4
247
+ with :
248
+ persist-credentials : false
249
+ - name : Reclaim disk space and sanitize user home
250
+ run : .github/ci-prerequisites-atlas.sh
251
+ - name : Set up Java 17
252
+ uses : actions/setup-java@v4
253
+ with :
254
+ distribution : ' temurin'
255
+ java-version : ' 17'
256
+
257
+ - name : Generate cache key
258
+ id : cache-key
259
+ run : |
260
+ CURRENT_BRANCH="${{ github.repository != 'hibernate/hibernate-orm' && 'fork' || github.base_ref || github.ref_name }}"
261
+ CURRENT_MONTH=$(/bin/date -u "+%Y-%m")
262
+ CURRENT_DAY=$(/bin/date -u "+%d")
263
+ ROOT_CACHE_KEY="buildtool-cache-atlas"
264
+ echo "buildtool-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}" >> $GITHUB_OUTPUT
265
+ echo "buildtool-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT
266
+ echo "buildtool-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}" >> $GITHUB_OUTPUT
267
+ - name : Cache Maven/Gradle Dependency/Dist Caches
268
+ id : cache-maven
269
+ uses : actions/cache@v4
270
+ # if it's not a pull request, we restore and save the cache
271
+ if : github.event_name != 'pull_request'
272
+ with :
273
+ path : |
274
+ ~/.m2/repository/
275
+ ~/.m2/wrapper/
276
+ ~/.gradle/caches/modules-2
277
+ ~/.gradle/wrapper/
278
+ # A new cache will be stored daily. After that first store of the day, cache save actions will fail because the cache is immutable but it's not a problem.
279
+ # The whole cache is dropped monthly to prevent unlimited growth.
280
+ # The cache is per branch but in case we don't find a branch for a given branch, we will get a cache from another branch.
281
+ key : ${{ steps.cache-key.outputs.buildtool-cache-key }}
282
+ restore-keys : |
283
+ ${{ steps.cache-key.outputs.buildtool-monthly-branch-cache-key }}-
284
+ ${{ steps.cache-key.outputs.buildtool-monthly-cache-key }}-
285
+ - name : Restore Maven/Gradle Dependency/Dist Caches
286
+ uses : actions/cache/restore@v4
287
+ # if it a pull request, we restore the cache but we don't save it
288
+ if : github.event_name == 'pull_request'
289
+ with :
290
+ path : |
291
+ ~/.m2/repository/
292
+ ~/.m2/wrapper/
293
+ ~/.gradle/caches/modules-2
294
+ ~/.gradle/wrapper/
295
+ key : ${{ steps.cache-key.outputs.buildtool-cache-key }}
296
+ restore-keys : |
297
+ ${{ steps.cache-key.outputs.buildtool-monthly-branch-cache-key }}-
298
+ ${{ steps.cache-key.outputs.buildtool-monthly-cache-key }}-
299
+
300
+ - name : Run build script
301
+ run : ./gradlew formatChecks
302
+ env :
303
+ # For jobs running on 'push', publish build scan and cache immediately.
304
+ # This won't work for pull requests, since they don't have access to secrets.
305
+ POPULATE_REMOTE_GRADLE_CACHE : ${{ github.event_name == 'push' && github.repository == 'hibernate/hibernate-orm' && 'true' || 'false' }}
306
+ DEVELOCITY_ACCESS_KEY : " ${{ secrets.DEVELOCITY_ACCESS_KEY }}"
307
+
308
+ # For jobs running on 'pull_request', upload build scan data.
309
+ # The actual publishing must be done in a separate job (see ci-report.yml).
310
+ # We don't write to the remote cache as that would be unsafe.
311
+ - name : Upload GitHub Actions artifact for the Develocity build scan
312
+ uses : actions/upload-artifact@v4
313
+ if : " ${{ github.event_name == 'pull_request' && !cancelled() }}"
314
+ with :
315
+ name : build-scan-data-sca
316
+ path : ~/.gradle/build-scan-data
317
+
318
+ - name : Upload test reports (if Gradle failed)
319
+ uses : actions/upload-artifact@v4
320
+ if : failure()
321
+ with :
322
+ name : test-reports-java11-sca
323
+ path : |
324
+ ./**/target/reports/tests/
236
325
- name : Omit produced artifacts from build cache
237
326
run : ./ci/before-cache.sh
0 commit comments