forked from pgjdbc/pgjdbc
-
Notifications
You must be signed in to change notification settings - Fork 0
413 lines (377 loc) · 14.3 KB
/
omni.yml
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
name: Omni CI
on:
workflow_dispatch:
inputs:
# Filters to limit generated matrix. Empty or "*" values are ignored.
matrix_jdk_distribution:
description: JDK Distribution (adopt, zulu, ...)
required: false
default: "*"
matrix_jdk_version:
description: JDK Version (8, 11, ...)
required: false
default: "*"
matrix_pg_version:
description: PostgreSQL Server Version (8.4, 9.0, 9.1, ...)
required: false
default: "*"
matrix_query_mode:
description: Query Mode (simple | extended | extendedForPrepared)
required: false
default: "*"
matrix_ssl:
description: SSL (true | false)
required: false
default: "*"
matrix_scram:
description: SCRAM (true | false)
required: false
default: "*"
matrix_default_test_group:
description: Default test group (fast | slow | all)
required: false
default: fast
schedule:
- cron: "0 6 * * *"
permissions:
contents: read
jobs:
matrix_prep:
name: Matrix Preparation
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
env:
MATRIX_JDK_DISTRIBUTION: '${{ github.event.inputs.matrix_jdk_distribution }}'
MATRIX_JDK_VERSION: '${{ github.event.inputs.matrix_jdk_version }}'
MATRIX_PG_VERSION: '${{ github.event.inputs.matrix_pg_version }}'
MATRIX_QUERY_MODE: '${{ github.event.inputs.matrix_query_mode }}'
MATRIX_SCRAM: '${{ github.event.inputs.matrix_scram }}'
MATRIX_SSL: '${{ github.event.inputs.matrix_ssl }}'
MATRIX_DEFAULT_TEST_GROUP: '${{ github.event.inputs.matrix_default_test_group }}'
# Script as an environment variable so we don't have to worry shell substitutions
MATRIX_GENERATION_NODE_JS_SCRIPT: |
const DEFAULT_TEST_GROUP = process.env.MATRIX_DEFAULT_TEST_GROUP || 'fast';
const JDK_OPTIONS = [
{ group: 'Zulu', version: '8', lts: true, distribution: 'zulu' },
{ group: 'Zulu', version: '11', lts: true, distribution: 'zulu' },
{ group: 'Zulu', version: '15', lts: false, distribution: 'zulu' },
];
const OTHER_JDK_OPTIONS = [
// Adopt
{ group: 'Adopt Hotspot', version: '8', lts: true, distribution: 'adopt-hotspot' },
{ group: 'Adopt Hotspot', version: '11', lts: true, distribution: 'adopt-hotspot' },
// Adopt OpenJ9
// TODO: Replace these hard coded versions with something that dynamically picks the most recent
{ group: 'Adopt OpenJ9', version: '8', lts: true, distribution: 'adopt-openj9'},
{ group: 'Adopt OpenJ9', version: '11', lts: true, distribution: 'adopt-openj9'},
// Amazon Corretto
{ group: 'Corretto', version: '8', lts: true, distribution: 'jdkfile', url: 'https://corretto.aws/downloads/latest/amazon-corretto-8-x64-linux-jdk.tar.gz'},
{ group: 'Corretto', version: '11', lts: true, distribution: 'jdkfile', url: 'https://corretto.aws/downloads/latest/amazon-corretto-11-x64-linux-jdk.tar.gz'},
];
const PG_VERSIONS = [
'8.4',
'9.0',
'9.1',
'9.2',
'9.3',
'9.4',
'9.5',
'9.6',
'10',
'11',
'12',
'13',
// TODO: Determine the latest and greatest server version automatically so we don't need to periodically update this
];
const LTS_JDK_OPTIONS = JDK_OPTIONS.filter(jdk => jdk.lts);
const UNSTABLE_JDK_OPTIONS = JDK_OPTIONS.filter(jdk => !jdk.lts);
const LATEST_JDK = LTS_JDK_OPTIONS.slice(-1)[0];
const LATEST_PG_VERSION = PG_VERSIONS.slice(-1)[0];
const list = [];
const matchesMatrixFilter = (name, value) => {
const env_value = process.env['MATRIX_' + name];
if (!env_value || env_value === '*') {
return true;
}
// TODO: Consider expanding this to do globbing
return env_value === ('' + value);
};
const addItem = (opts) => {
const name = opts.name ?? '';
const os = 'ubuntu-latest';
const pg_version = opts.pg_version ?? LATEST_PG_VERSION;
const jdk = opts.jdk ?? LATEST_JDK;
const experimental = opts.experimental ?? false;
const test_group = opts.test_group ?? DEFAULT_TEST_GROUP;
const create_replicas = opts.create_replicas ?? false;
const isAtLeast = (minVersion) => Number(pg_version) >= Number(minVersion);
const scramSupported = isAtLeast('10');
const sslSupported = isAtLeast('9.3');
const query_mode = opts.query_mode;
const ssl = opts.ssl ?? sslSupported;
const scram = opts.scram ?? scramSupported;
if (!matchesMatrixFilter('JDK_DISTRIBUTION', jdk.distribution) ||
!matchesMatrixFilter('JDK_VERSION', jdk.version) ||
!matchesMatrixFilter('PG_VERSION', pg_version) ||
!matchesMatrixFilter('QUERY_MODE', query_mode ?? '') ||
!matchesMatrixFilter('SCRAM', scram) ||
!matchesMatrixFilter('SSL', ssl)) {
return;
}
const junit_include_tags = (() => {
switch (test_group) {
case 'replication':
// Only replication tests
return 'org.postgresql.test.Replication';
case 'fast':
// Fast group does not run slow or replication tests
return '!org.postgresql.test.SlowTests & !org.postgresql.test.Replication';
case 'slow':
// Everything but replication tests (which includes all the really slow ones)
return '!org.postgresql.test.Replication';
case 'all':
// Everything
return ''
}
throw new Error('Invalid test group: ' + test_group);
})();
list.push({
name: [
experimental ? 'Experimental' : '',
name,
`${jdk.group} ${jdk.version} x PG ${pg_version}`
].filter(x => x).join(' - '),
os,
jdk_group: jdk.group,
jdk_version: jdk.version,
jdk_distribution: jdk.distribution,
jdk_url: jdk.url,
pg_version,
ssl,
scram,
server_tz: opts.server_tz ?? 'Etc/UTC',
experimental,
junit_include_tags,
query_mode,
});
};
// Latest JDK x each stable PG version
for (const pg_version of PG_VERSIONS) {
addItem({
pg_version,
});
}
// Latest PG version x each remaining JDK
for (const jdk of JDK_OPTIONS) {
if (jdk == LATEST_JDK) {
continue; // Skip duplicate
}
addItem({
jdk,
pg_version: LATEST_PG_VERSION,
experimental: !jdk.lts,
});
}
// No SSL / No SCRAM (only on latest PG / JDK)
addItem({
name: `No SSL / No SCRAM`,
ssl: false,
scram: false,
});
// Custom server timezones (only on latest PG / JDK)
addItem({
name: `Server TZ - America/New_York`,
server_tz: 'America/New_York'
});
addItem({
name: `Server TZ - Pacific/Chatham`,
server_tz: 'Pacific/Chatham'
});
// Custom query modes (only on latest PG / JDK)
addItem({
name: `Query Mode - simple`,
query_mode: 'simple',
});
addItem({
name: `Query Mode - extendedForPrepared`,
query_mode: 'extendedForPrepared',
});
addItem({
name: `Query Mode - extendedCacheEverything`,
query_mode: 'extendedCacheEverything',
});
// Slow tests (only on latest PG / JDK)
addItem({
name: `Slow Tests`,
test_group: 'slow',
create_replicas: true,
});
// Replication tests (only on latest PG / JDK)
addItem({
name: `Replication Tests`,
test_group: 'replication',
});
// TODO: Add latest PG built from source marked as experimental
for(const jdk of OTHER_JDK_OPTIONS) {
addItem({
jdk,
pg_version: LATEST_PG_VERSION,
experimental: !jdk.lts,
});
}
if (list.length === 0) {
throw new Error('Matrix list is empty. Check you matrix filters to ensure they match a valid combination.');
}
const toKey = (item) => JSON.stringify(Object.entries(item).filter(([field]) => field != 'name').sort())
const include = list.filter((item, i) => {
const key = toKey(item);
// Deduplicate by picking only the first entry matching this key
return i === list.findIndex((other) => key === toKey(other));
});
// Sort so that all the experimental jobs appear at the end of the list
include.sort((a, b) => (a.experimental ? 1 : 0) - (b.experimental ? 1 : 0))
console.log('::set-output name=matrix::' + JSON.stringify({ include }));
steps:
- id: set-matrix
run: |
node -e "${MATRIX_GENERATION_NODE_JS_SCRIPT}"
test:
name: '${{ matrix.name }}'
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
needs: matrix_prep
strategy:
fail-fast: false
matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}}
env:
ACTIONS_STEP_DEBUG: true
ACTIONS_RUNNER_DEBUG: true
SSL: ${{ matrix.ssl }}
SCRAM: ${{ matrix.scram }}
TZ: ${{ matrix.server_tz }}
CREATE_REPLICAS: ${{ matrix.create_replicas }}
steps:
- name: 'Show Matrix'
env:
MATRIX_JSON: ${{ toJSON(matrix) }}
run: echo "${MATRIX_JSON}"
- uses: actions/checkout@v2
with:
fetch-depth: 50
- name: Start PostgreSQL
working-directory: docker/postgres-server
run: docker-compose up -d && docker-compose logs
env:
PGV: ${{ matrix.pg_version }}
# Install built-in JDK
- name: 'Set up JDK ${{ matrix.jdk_version }} / ${{ matrix.jdk_distribution }}'
uses: actions/setup-java@v2
if: ${{ matrix.jdk_distribution != 'jdkfile' }}
with:
distribution: ${{ matrix.jdk_distribution }}
java-version: ${{ matrix.jdk_version }}
architecture: x64
# Install custom JDK from URL
- name: 'Download JDK ${{ matrix.jdk_distribution }} / ${{ matrix.jdk_version }} from ${{ matrix.jdk_url }}'
if: ${{ matrix.jdk_distribution == 'jdkfile' }}
run: |
jdk_url="${{ matrix.jdk_url }}"
wget -nv -O "${{ runner.temp }}/java_package.tar.gz" "${jdk_url}"
- name: 'Set up JDK ${{ matrix.jdk_version }} / ${{ matrix.jdk_url }}'
uses: actions/setup-java@v2
if: ${{ matrix.jdk_distribution == 'jdkfile' }}
with:
distribution: ${{ matrix.jdk_distribution }}
java-version: ${{ matrix.jdk_version }}
jdkFile: '${{ runner.temp }}/java_package.tar.gz'
architecture: x64
- name: Java version
run: |
java -version
- name: PostgreSQL version
env:
PGUSER: postgres
PGDATABASE: postgres
PGHOST: localhost
run: |
if ! docker/bin/wait_for_pg_isready; then
# Server is not online so dump some logs for debugging
docker ps
cd docker/postgres-server
docker-compose logs
fi
psql -c 'SELECT version()'
- name: Prepare local properties
run: |
cat <<EOF >ssltest.local.properties
enable_ssl_tests=${{ matrix.ssl }}
EOF
cat <<EOF >build.local.properties
preferQueryMode=${{ matrix.query_mode}}
EOF
- name: Test
uses: burrunan/gradle-cache-action@v1
env:
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }}
S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.S3_BUILD_CACHE_SECRET_KEY }}
with:
# Separate cache for each JDK distribution and version
job-id: jdk${{ matrix.jdk_version}}_${{ matrix.jdk_group }}
arguments: --no-parallel --no-daemon --scan jandex test jacocoReport
properties: |
includeTestTags=${{ matrix.junit_include_tags }}
- name: 'Upload code coverage'
uses: codecov/codecov-action@a1ed4b322b4b38cb846afb5a0ebfa17086917d27
with:
file: ./build/reports/jacoco/jacocoReport/jacocoReport.xml
test-pg-head:
name: Zulu 11 x PG HEAD
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 50
- name: Compile and start PostgreSQL
working-directory: docker/postgres-head
run: docker-compose up -d && docker-compose logs
- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 11
architecture: x64
- name: Java version
run: |
java -version
- name: PostgreSQL version
env:
PGUSER: postgres
PGDATABASE: postgres
PGHOST: localhost
run: |
if ! docker/bin/wait_for_pg_isready; then
# Server is not online so dump some logs for debugging
docker ps
cd docker/postgres-head
docker-compose logs
fi
psql -c 'SELECT version()'
- name: Prepare local properties
run: |
cat <<EOF >ssltest.local.properties
enable_ssl_tests=false
EOF
cat <<EOF >build.local.properties
EOF
- name: Test
uses: burrunan/gradle-cache-action@v1
with:
arguments: --no-parallel --no-daemon --scan jandex test jacocoReport
properties: |
includeTestTags=!org.postgresql.test.SlowTests & !org.postgresql.test.Replication
- name: 'Upload code coverage'
uses: codecov/codecov-action@a1ed4b322b4b38cb846afb5a0ebfa17086917d27
with:
file: ./build/reports/jacoco/jacocoReport/jacocoReport.xml