-
-
Notifications
You must be signed in to change notification settings - Fork 100
491 lines (469 loc) · 16.9 KB
/
Copy pathbuild-and-test.yml
File metadata and controls
491 lines (469 loc) · 16.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
name: Build and Test
on:
push:
branches: ["master", "querydsl-*", "8.x", "fluentq-*"]
paths-ignore:
- "**/*.md"
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths-ignore:
- "**/*.md"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
MAVEN_OPTS: -Xmx3200m
# Modules that contain database-tagged tests, grouped by the databases they cover.
SQL_MODULES: ":querydsl-jpa,:querydsl-r2dbc,:querydsl-sql,:querydsl-sql-spatial,:querydsl-sql-codegen"
ORACLE_MODULES: ":querydsl-jpa,:querydsl-sql,:querydsl-sql-codegen"
jobs:
# Compile all core jars once (no tests), then publish the built artifacts as a per-commit
# cache that every downstream test job restores. Tests run in the parallel jobs below.
compile:
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Setup build environment
uses: ./.github/actions/setup-build
- name: Validate code format
run: ./mvnw -ntp -B git-code-format:validate-code-format
- name: Build (no tests)
run: ./mvnw -ntp -B clean install -Pno-databases -DskipTests
- name: Save build artifacts
uses: actions/cache/save@v4
with:
path: ~/.m2/repository/io/github/openfeign/querydsl
key: build-artifacts-${{ github.sha }}
# Database-independent tests, run in parallel with the database test jobs.
no-databases:
if: ${{ !github.event.pull_request.draft }}
needs: compile
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Setup build environment
uses: ./.github/actions/setup-build
- name: Restore build artifacts
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository/io/github/openfeign/querydsl
key: build-artifacts-${{ github.sha }}
- name: Run database-independent tests
run: ./mvnw -ntp -B install -Deasyjacoco.skip=true -Pno-databases
- name: Publish test report
uses: mikepenz/action-junit-report@v5
if: always()
with:
report_paths: "**/target/surefire-reports/TEST-*.xml"
check_name: "Test report (no-databases)"
# Compile + package only (no databases) on Windows, mirroring the previous CircleCI job.
windows:
if: ${{ !github.event.pull_request.draft }}
runs-on: windows-latest
timeout-minutes: 40
env:
MAVEN_OPTS: -Xmx3200m
steps:
- uses: actions/checkout@v4
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "25"
cache: "maven"
- name: Build (no external databases)
shell: bash
run: ./mvnw -ntp -B verify -Pno-databases -Dtoolchain.skip=true
embedded:
if: ${{ !github.event.pull_request.draft }}
needs: compile
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Setup build environment
uses: ./.github/actions/setup-build
- name: Restore build artifacts
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository/io/github/openfeign/querydsl
key: build-artifacts-${{ github.sha }}
- name: Test embedded databases (H2, HSQLDB, Derby, SQLite, Turso)
run: >
./mvnw -ntp -B install -Deasyjacoco.skip=true -Pci -pl ${{ env.SQL_MODULES }}
-Dgroups=com.querydsl.core.testutil.H2,com.querydsl.core.testutil.HSQLDB,com.querydsl.core.testutil.Derby,com.querydsl.core.testutil.SQLite,com.querydsl.core.testutil.Turso
- name: Publish test report
uses: mikepenz/action-junit-report@v5
if: always()
with:
report_paths: "**/target/surefire-reports/TEST-*.xml"
check_name: "Test report (embedded)"
mysql:
if: ${{ !github.event.pull_request.draft }}
needs: compile
runs-on: ubuntu-latest
timeout-minutes: 30
services:
mysql:
image: mysql:5.6.38
env:
MYSQL_ROOT_PASSWORD: querydsl
MYSQL_USER: querydsl
MYSQL_PASSWORD: querydsl
MYSQL_DATABASE: querydsl
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h localhost -uroot -pquerydsl"
--health-interval=10s --health-timeout=5s --health-retries=20
steps:
- uses: actions/checkout@v4
- name: Setup build environment
uses: ./.github/actions/setup-build
- name: Restore build artifacts
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository/io/github/openfeign/querydsl
key: build-artifacts-${{ github.sha }}
- name: Test MySQL
run: ./mvnw -ntp -B install -Deasyjacoco.skip=true -Pci -pl ${{ env.SQL_MODULES }} -Dgroups=com.querydsl.core.testutil.MySQL
- name: Publish test report
uses: mikepenz/action-junit-report@v5
if: always()
with:
report_paths: "**/target/surefire-reports/TEST-*.xml"
check_name: "Test report (MySQL)"
postgresql:
if: ${{ !github.event.pull_request.draft }}
needs: compile
runs-on: ubuntu-latest
timeout-minutes: 30
services:
postgres:
image: postgis/postgis:16-3.4-alpine
env:
POSTGRES_USER: querydsl
POSTGRES_PASSWORD: querydsl
POSTGRES_DB: querydsl
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U querydsl" --health-interval=10s
--health-timeout=5s --health-retries=20
steps:
- uses: actions/checkout@v4
- name: Setup build environment
uses: ./.github/actions/setup-build
- name: Restore build artifacts
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository/io/github/openfeign/querydsl
key: build-artifacts-${{ github.sha }}
- name: Test PostgreSQL
run: ./mvnw -ntp -B install -Deasyjacoco.skip=true -Pci -pl ${{ env.SQL_MODULES }} -Dgroups=com.querydsl.core.testutil.PostgreSQL
- name: Publish test report
uses: mikepenz/action-junit-report@v5
if: always()
with:
report_paths: "**/target/surefire-reports/TEST-*.xml"
check_name: "Test report (PostgreSQL)"
oracle:
if: ${{ !github.event.pull_request.draft }}
needs: compile
runs-on: ubuntu-latest
timeout-minutes: 40
services:
oracle:
image: gvenzl/oracle-free:slim-faststart
env:
ORACLE_PASSWORD: querydsl
APP_USER: querydsl
APP_USER_PASSWORD: querydsl
TZ: UTC
ports:
- 1521:1521
options: >-
--health-cmd="healthcheck.sh" --health-interval=10s
--health-timeout=5s --health-retries=30
steps:
- uses: actions/checkout@v4
- name: Setup build environment
uses: ./.github/actions/setup-build
- name: Restore build artifacts
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository/io/github/openfeign/querydsl
key: build-artifacts-${{ github.sha }}
- name: Test Oracle
run: ./mvnw -ntp -B install -Deasyjacoco.skip=true -Pci -pl ${{ env.ORACLE_MODULES }} -Dgroups=com.querydsl.core.testutil.Oracle
- name: Publish test report
uses: mikepenz/action-junit-report@v5
if: always()
with:
report_paths: "**/target/surefire-reports/TEST-*.xml"
check_name: "Test report (Oracle)"
cubrid:
if: ${{ !github.event.pull_request.draft }}
needs: compile
runs-on: ubuntu-latest
timeout-minutes: 30
services:
cubrid:
image: cubrid/cubrid:11.3
env:
CUBRID_DB: demodb
ports:
- 30000:30000
- 33000:33000
steps:
- uses: actions/checkout@v4
- name: Setup build environment
uses: ./.github/actions/setup-build
- name: Restore build artifacts
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository/io/github/openfeign/querydsl
key: build-artifacts-${{ github.sha }}
- name: Wait for CUBRID demodb to be ready
run: |
for i in $(seq 1 30); do
if docker logs "${{ job.services.cubrid.id }}" 2>&1 | grep -q "cubrid server start: demodb"; then
echo "CUBRID demodb server has started"; sleep 5; break
fi
echo "Waiting for CUBRID demodb ($i/30)..."; sleep 5
done
- name: Test CUBRID
run: ./mvnw -ntp -B install -Deasyjacoco.skip=true -Pci -pl :querydsl-sql -Dgroups=com.querydsl.core.testutil.CUBRID
- name: Publish test report
uses: mikepenz/action-junit-report@v5
if: always()
with:
report_paths: "**/target/surefire-reports/TEST-*.xml"
check_name: "Test report (CUBRID)"
firebird:
if: ${{ !github.event.pull_request.draft }}
needs: compile
runs-on: ubuntu-latest
timeout-minutes: 30
services:
firebird:
image: jacobalberty/firebird:v4
env:
ISC_PASSWORD: masterkey
FIREBIRD_DATABASE: querydsl.fdb
FIREBIRD_USER: querydsl
FIREBIRD_PASSWORD: querydsl
TZ: UTC
ports:
- 3050:3050
steps:
- uses: actions/checkout@v4
- name: Setup build environment
uses: ./.github/actions/setup-build
- name: Restore build artifacts
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository/io/github/openfeign/querydsl
key: build-artifacts-${{ github.sha }}
- name: Wait for Firebird
run: |
for i in $(seq 1 30); do
if (echo > /dev/tcp/localhost/3050) >/dev/null 2>&1; then
echo "Firebird is accepting connections"; break
fi
echo "Waiting for Firebird ($i/30)..."; sleep 5
done
- name: Test Firebird
run: ./mvnw -ntp -B install -Deasyjacoco.skip=true -Pci -pl :querydsl-sql -Dgroups=com.querydsl.core.testutil.Firebird
- name: Publish test report
uses: mikepenz/action-junit-report@v5
if: always()
with:
report_paths: "**/target/surefire-reports/TEST-*.xml"
check_name: "Test report (Firebird)"
mongodb:
if: ${{ !github.event.pull_request.draft }}
needs: compile
runs-on: ubuntu-latest
timeout-minutes: 30
services:
mongo:
image: mongo:8.0.9
ports:
- 27017:27017
options: >-
--health-cmd="mongosh --eval 'db.runCommand({ ping: 1 })'"
--health-interval=10s --health-timeout=5s --health-retries=20
steps:
- uses: actions/checkout@v4
- name: Setup build environment
uses: ./.github/actions/setup-build
- name: Restore build artifacts
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository/io/github/openfeign/querydsl
key: build-artifacts-${{ github.sha }}
- name: Test MongoDB
run: ./mvnw -ntp -B install -Deasyjacoco.skip=true -Pci -pl :querydsl-mongodb -Dgroups=com.querydsl.core.testutil.MongoDB
- name: Publish test report
uses: mikepenz/action-junit-report@v5
if: always()
with:
report_paths: "**/target/surefire-reports/TEST-*.xml"
check_name: "Test report (MongoDB)"
db2:
if: ${{ !github.event.pull_request.draft }}
needs: compile
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
- name: Setup build environment
uses: ./.github/actions/setup-build
- name: Restore build artifacts
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository/io/github/openfeign/querydsl
key: build-artifacts-${{ github.sha }}
- name: Start DB2 container
run: |
docker run -d --privileged --name db2 \
-p 50000:50000 \
-e DB2INST1_PASSWORD=a3sd!fDj \
-e DB2INSTANCE=db2inst1 \
-e DBNAME=sample \
-e LICENSE=accept \
-e ARCHIVE_LOGS=false \
-e AUTOCONFIG=false \
ibmcom/db2:11.5.0.0
echo "Waiting for DB2 to initialize..."
for i in $(seq 1 60); do
if docker logs db2 2>&1 | grep -q "All databases are now active"; then
echo "DB2 appears to be up"; break
fi
echo "Waiting ($i/60)..."; sleep 10
done
- name: Test DB2
run: ./mvnw -ntp -B install -Deasyjacoco.skip=true -Pci -pl :querydsl-sql -Dgroups=com.querydsl.core.testutil.DB2
- name: Stop DB2 container
if: always()
run: docker stop db2 && docker rm db2
- name: Publish test report
uses: mikepenz/action-junit-report@v5
if: always()
with:
report_paths: "**/target/surefire-reports/TEST-*.xml"
check_name: "Test report (DB2)"
examples:
if: ${{ !github.event.pull_request.draft }}
needs: compile
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Setup build environment
uses: ./.github/actions/setup-build
- name: Restore build artifacts
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository/io/github/openfeign/querydsl
key: build-artifacts-${{ github.sha }}
- name: Prepare example prerequisites
run: >
./mvnw -ntp -B install -Deasyjacoco.skip=true -Pquickbuild
-pl :querydsl-sql-spring,:querydsl-jpa-spring,:querydsl-kotlin-codegen,:querydsl-mongodb,:querydsl-r2dbc,:querydsl-sql-json -am
- name: Build and test examples
run: ./mvnw -ntp -B install -Pexamples -rf :querydsl-examples
examples-quarkus:
if: ${{ !github.event.pull_request.draft }}
needs: compile
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Restore build artifacts
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository/io/github/openfeign/querydsl
key: build-artifacts-${{ github.sha }}
- name: Stage Querydsl artifacts for the image build
run: |
mkdir -p /tmp/m2inject/io/github/openfeign
cp -r ~/.m2/repository/io/github/openfeign/querydsl /tmp/m2inject/io/github/openfeign/
- name: Build Quarkus native example image (reusing compiled artifacts)
run: |
DOCKER_BUILDKIT=1 docker build --progress=plain \
-f querydsl-examples/querydsl-example-jpa-quarkus/Dockerfile \
--build-context m2=/tmp/m2inject \
--build-arg REUSE_M2=true .
examples-ksp:
if: ${{ !github.event.pull_request.draft }}
needs: compile
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Setup build environment
uses: ./.github/actions/setup-build
- name: Restore build artifacts
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository/io/github/openfeign/querydsl
key: build-artifacts-${{ github.sha }}
- name: Prepare KSP example prerequisites
run: |
./mvnw -N org.codehaus.mojo:properties-maven-plugin:1.2.1:write-project-properties -Dproperties.outputFile=querydsl-examples/querydsl-example-ksp-codegen/gradle.properties
./mvnw -ntp -B install -Deasyjacoco.skip=true -Pquickbuild -pl :querydsl-ksp-codegen,:querydsl-jpa -am
- name: Build and test KSP example
run: |
export JAVA_HOME="$JAVA_HOME_21_X64"
cd querydsl-examples/querydsl-example-ksp-codegen
./gradlew --no-daemon --console=plain --info --stacktrace test
# Single required status check that aggregates every test job.
build:
if: always() && !github.event.pull_request.draft
runs-on: ubuntu-latest
needs:
- compile
- no-databases
- windows
- embedded
- mysql
- postgresql
- oracle
- cubrid
- firebird
- mongodb
- db2
- examples
- examples-quarkus
- examples-ksp
steps:
- name: Check upstream job results
run: |
echo "Aggregating upstream job results..."
FAILED=""
ALL_SKIPPED=true
NEEDS_JSON='${{ toJSON(needs) }}'
for job in $(echo "$NEEDS_JSON" | jq -r 'keys[]'); do
result=$(echo "$NEEDS_JSON" | jq -r ".[\"$job\"].result")
echo " $job: $result"
if [[ "$result" == "failure" || "$result" == "cancelled" ]]; then
FAILED="$FAILED $job"
fi
if [[ "$result" != "skipped" ]]; then
ALL_SKIPPED=false
fi
done
if [[ "$ALL_SKIPPED" == "true" ]]; then
echo "All upstream jobs were skipped - refusing to report success."
exit 1
fi
if [[ -n "$FAILED" ]]; then
echo "Failed jobs:$FAILED"
exit 1
fi
echo "All upstream jobs passed."