-
Notifications
You must be signed in to change notification settings - Fork 1.1k
429 lines (389 loc) · 18.8 KB
/
Copy pathwindows-build-and-test.yaml
File metadata and controls
429 lines (389 loc) · 18.8 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
# Test building the extension on Windows
name: Regression Windows
"on":
schedule:
# run daily 0:00 on main branch
- cron: '0 0 * * *'
push:
branches:
- main
- ?.*.x
- prerelease_test
- trigger/windows_tests
- trigger/regression
pull_request:
workflow_dispatch:
jobs:
config:
runs-on: ubuntu-latest
outputs:
build_type: ${{ steps.build_type.outputs.build_type }}
pg15_latest: ${{ steps.config.outputs.pg15_latest_win }}
pg16_latest: ${{ steps.config.outputs.pg16_latest_win }}
pg17_latest: ${{ steps.config.outputs.pg17_latest_win }}
pg18_latest: ${{ steps.config.outputs.pg18_latest_win }}
steps:
- name: Checkout source code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Read configuration
id: config
run: python .github/gh_config_reader.py
- name: Set build_type
id: build_type
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "build_type=['Debug']" >>$GITHUB_OUTPUT
else
echo "build_type=['Debug','Release']" >>$GITHUB_OUTPUT
fi
check_paths:
runs-on: ubuntu-latest
outputs:
run_ci: >-
${{ github.event_name == 'push'
|| (steps.filter.outputs.src == 'true' && !contains(github.event.pull_request.labels.*.name, 'skip-ci'))
}}
run_installcheck: ${{ github.event_name == 'push' || steps.filter.outputs.windows-workflow == 'true' }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: filter
with:
filters: .github/filters.yaml
build:
# Change the JOB_NAME variable below when changing the name.
name: PG${{ matrix.versions.pg }} ${{ matrix.build_type }} windows
runs-on: windows-2025
needs: [config, check_paths]
if: needs.check_paths.outputs.run_ci == 'true'
strategy:
fail-fast: false
matrix:
versions:
- { pg: 15, pg_version: "${{ needs.config.outputs.pg15_latest }}" }
- { pg: 16, pg_version: "${{ needs.config.outputs.pg16_latest }}" }
- { pg: 17, pg_version: "${{ needs.config.outputs.pg17_latest }}" }
- { pg: 18, pg_version: "${{ needs.config.outputs.pg18_latest }}" }
build_type: ${{ fromJson(needs.config.outputs.build_type) }}
pg_config: ["-cfsync=off -cstatement_timeout=60s -clisten_addresses=0.0.0.0"]
event_name: ["${{ github.event_name }}"]
run_installcheck: ["${{ needs.check_paths.outputs.run_installcheck }}"]
exclude:
- versions: { pg: 15, pg_version: "${{ needs.config.outputs.pg15_latest }}" }
run_installcheck: false
- versions: { pg: 16, pg_version: "${{ needs.config.outputs.pg16_latest }}" }
run_installcheck: false
env:
# PostgreSQL configuration
PGPORT: 55432
PGDATA: pgdata
TABLESPACE1: D:\tablespace1\
TABLESPACE2: D:\tablespace2\
IGNORES: >-
bgw_launcher
chunk_adaptive
compress_bloom_sparse_compat
compress_bloom_sparse_debug
compress_compbloom_hash_pushdown
compress_composite_bloom_debug
compress_observ-*
compress_qualpushdown_saop
compress_sort_transform
compression_algos
compression_uuid
direct_compress_copy
merge_append_partially_compressed
metadata
telemetry
vector_agg_expr
vector_agg_byte
vector_agg_filter
vector_agg_groupagg
vector_agg_grouping
vector_agg_planning-*
vector_agg_text
vector_agg_uuid
vectorized_aggregation
${{ matrix.versions.pg < 16 && 'columnar_scan_cost' || '' }}
SKIPS: >-
create_hypertable
create_table_with
bgw_db_scheduler
bgw_db_scheduler_fixed
steps:
- name: Remove Existing PostgreSQL
shell: powershell
run: |
# Search for any installed application package containing 'PostgreSQL' in the name.
$PostgresPackages = Get-Package -Name "*PostgreSQL*" -Provider Programs -ErrorAction SilentlyContinue
if ($PostgresPackages) {
Write-Host "Found $($PostgresPackages.Count) PostgreSQL package(s) to uninstall."
# Use Uninstall-Package with -Force for a silent, non-interactive removal.
$PostgresPackages | Uninstall-Package -Force
# Manually remove common installation paths and data folders
# to ensure no conflicts with the new installation.
Remove-Item "C:\Program Files\PostgreSQL" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "C:\PostgreSQL" -Recurse -Force -ErrorAction SilentlyContinue
} else {
Write-Host "No registered PostgreSQL installation found. Skipping uninstall step."
}
- name: Setup WSL
if: needs.check_paths.outputs.run_installcheck == 'true'
uses: Vampire/setup-wsl@d1da7f2c0322a5ee4f24975344f67fc0f5baf364 # v7.0.0
with:
distribution: Debian-13
- name: Configure apt retries and timeout in WSL
if: needs.check_paths.outputs.run_installcheck == 'true'
shell: wsl-bash {0}
run: |
echo 'Acquire::Retries "10";' >> /etc/apt/apt.conf.d/99retries
echo 'Acquire::http::Timeout "240";' >> /etc/apt/apt.conf.d/99retries
echo 'Acquire::https::Timeout "240";' >> /etc/apt/apt.conf.d/99retries
- name: Install additional packages in WSL
if: needs.check_paths.outputs.run_installcheck == 'true'
shell: wsl-bash {0}
run: |
apt-get update
apt-get install --yes --no-install-recommends ca-certificates cmake gawk \
gcc git gnupg jq make postgresql-common tree
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y
apt-get update
apt-get install --yes postgresql-client-${{ matrix.versions.pg }}
- name: Configure git
# Since we want to reuse the checkout in the WSL environment
# we have to prevent git from changing the line ending in the
# shell scripts as that would break them.
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout TimescaleDB source
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# We are going to rebuild Postgres weekly, so that it doesn't suddenly break
# ages after the original problem.
- name: Get date for build caching
id: get-date
shell: powershell
run: |
echo "date=$(Get-Date -UFormat '%V')" >> $env:GITHUB_OUTPUT
# Use a cache for the PostgreSQL installation to speed things up
# and avoid unnecessary package downloads. Since we only save
# the directory containing the binaries, the runs with a cache
# hit won't have PostgreSQL installed with a running service
# since the installer never runs. We therefore install with
# --extract-only and launch our own test instance, which is
# probably better anyway since it gives us more control.
- name: Cache PostgreSQL installation
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
id: cache-postgresql
with:
path: C:\Progra~1\PostgreSQL\${{ matrix.versions.pg }}
key: "${{ runner.os }}-build-pg${{ matrix.versions.pg_version }}\
-${{ steps.get-date.outputs.date }}-${{ hashFiles('.github/**') }}"
- name: Install PostgreSQL ${{ matrix.versions.pg }} (using ${{ matrix.versions.pg_version }})
if: github.event_name != 'schedule' && steps.cache-postgresql.outputs.cache-hit != 'true'
run: |
$version = ${{ matrix.versions.pg_version }}
$version = $version.Replace('"', '') + "-1"
winget install --id PostgreSQL.PostgreSQL.${{ matrix.versions.pg }} `
--force --accept-source-agreements --accept-package-agreements --disable-interactivity `
--custom "--disable-components pgAdmin,stackbuilder" `
--version $version
# This is for nightly builds. Here we pick the latest version of the package.
- name: Install PostgreSQL ${{ matrix.versions.pg }}
if: github.event_name == 'schedule' && steps.cache-postgresql.outputs.cache-hit != 'true'
run: |
winget install --id PostgreSQL.PostgreSQL.${{ matrix.versions.pg }} `
--force --accept-source-agreements --accept-package-agreements --disable-interactivity `
--custom "--disable-components pgAdmin,stackbuilder"
- name: Configure TimescaleDB
run: cmake -B build_win -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} `
-DPG_CONFIG=C:\Progra~1/PostgreSQL/${{ matrix.versions.pg }}/bin/pg_config `
-DASSERTIONS=ON `
-DTEST_PG_LOG_DIRECTORY="log"
- name: Build TimescaleDB
run: cmake --build build_win --config ${{ matrix.build_type }}
- name: Install TimescaleDB
run: cmake --install build_win --config ${{ matrix.build_type }}
- name: Enable crash dumps for postgres.exe (WER LocalDumps)
if: needs.check_paths.outputs.run_installcheck == 'true'
shell: powershell
run: |
$DumpDir = Join-Path $env:GITHUB_WORKSPACE "crashdumps"
New-Item -ItemType Directory -Force -Path $DumpDir | Out-Null
$Key = "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\postgres.exe"
New-Item -Path $Key -Force | Out-Null
New-ItemProperty -Path $Key -Name DumpFolder -Value $DumpDir -PropertyType ExpandString -Force | Out-Null
New-ItemProperty -Path $Key -Name DumpCount -Value 10 -PropertyType DWord -Force | Out-Null
New-ItemProperty -Path $Key -Name DumpType -Value 2 -PropertyType DWord -Force | Out-Null
Write-Host "Configured WER LocalDumps for postgres.exe => $DumpDir"
- name: Setup postgres cluster
if: needs.check_paths.outputs.run_installcheck == 'true'
run: |
C:\Progra~1/PostgreSQL/${{ matrix.versions.pg }}/bin/initdb -U postgres -A trust --locale=en_US --encoding=UTF8
mkdir -p ${{ env.TABLESPACE1 }}\_default
mkdir -p ${{ env.TABLESPACE2 }}\_default
icacls ${{ env.TABLESPACE1 }} /grant runneradmin:F /T
icacls ${{ env.TABLESPACE2 }} /grant runneradmin:F /T
copy build_win/test/postgresql.conf ${{ env.PGDATA }}
icacls . /grant runneradmin:F /T
Add-Content ${{ env.PGDATA }}\pg_hba.conf "host all all 0.0.0.0/0 trust"
C:\Progra~1/PostgreSQL/${{ matrix.versions.pg }}/bin/pg_ctl start -o "${{ matrix.pg_config }}" --log=postmaster.log
C:\Progra~1/PostgreSQL/${{ matrix.versions.pg }}/bin/pg_isready -U postgres -d postgres --timeout=60
C:\Progra~1/PostgreSQL/${{ matrix.versions.pg }}/bin/psql -U postgres -d postgres -c 'CREATE USER root SUPERUSER LOGIN;'
echo "PG version:"
C:\Progra~1/PostgreSQL/${{ matrix.versions.pg }}/bin/psql -U postgres -d postgres -c 'SELECT version();'
echo "Log configuration:"
C:\Progra~1/PostgreSQL/${{ matrix.versions.pg }}/bin/psql -U postgres -d postgres -c 'SHOW logging_collector;'
C:\Progra~1/PostgreSQL/${{ matrix.versions.pg }}/bin/psql -U postgres -d postgres -c 'SHOW log_filename;'
C:\Progra~1/PostgreSQL/${{ matrix.versions.pg }}/bin/psql -U postgres -d postgres -c 'SHOW log_directory;'
C:\Progra~1/PostgreSQL/${{ matrix.versions.pg }}/bin/psql -U postgres -d postgres -c 'SELECT pg_current_logfile();'
echo "Data directory:"
C:\Progra~1/PostgreSQL/${{ matrix.versions.pg }}/bin/psql -U postgres -d postgres -c 'SHOW data_directory;'
New-NetFirewallRule -DisplayName "Allow PG from WSL" -Direction Inbound -LocalPort 55432 -Protocol TCP -Action Allow
- name: Install postgres for test runner
if: needs.check_paths.outputs.run_installcheck == 'true'
shell: wsl-bash {0}
run: |
yes | /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh || true
echo 'Acquire::Retries "10";' >> /etc/apt/apt.conf.d/99retries
echo 'Acquire::http::Timeout "240";' >> /etc/apt/apt.conf.d/99retries
echo 'Acquire::https::Timeout "240";' >> /etc/apt/apt.conf.d/99retries
apt-get install -y --force-yes postgresql-server-dev-${{ matrix.versions.pg }}
- name: Run tests
if: needs.check_paths.outputs.run_installcheck == 'true'
shell: wsl-bash {0}
env:
WSLENV: "IGNORES:SKIPS"
run: |
export TEST_TABLESPACE1_PREFIX='${{ env.TABLESPACE1 }}'
export TEST_TABLESPACE2_PREFIX='${{ env.TABLESPACE2 }}'
WIN_HOST=$(ip route show default | awk '{print $3}')
cmake -B build_wsl -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DTEST_PGPORT_LOCAL=${{ env.PGPORT }} -DTEST_PGHOST=$WIN_HOST
make -C build_wsl isolationchecklocal | tee -a installcheck.log
make -C build_wsl regresschecklocal IGNORES="${IGNORES}" SKIPS="${SKIPS}" | tee -a installcheck.log
- name: Setup postgres cluster for TSL tests
if: needs.check_paths.outputs.run_installcheck == 'true'
run: |
C:\Progra~1/PostgreSQL/${{ matrix.versions.pg }}/bin/pg_ctl stop
timeout 10
Remove-Item -Recurse ${{ env.PGDATA }}
C:\Progra~1/PostgreSQL/${{ matrix.versions.pg }}/bin/initdb -U postgres -A trust --locale=en_US --encoding=UTF8
copy build_win/tsl/test/postgresql.conf ${{ env.PGDATA }}
Add-Content ${{ env.PGDATA }}\pg_hba.conf "host all all 0.0.0.0/0 trust"
C:\Progra~1/PostgreSQL/${{ matrix.versions.pg }}/bin/pg_ctl start -o "${{ matrix.pg_config }}" --log="postmaster.log"
C:\Progra~1/PostgreSQL/${{ matrix.versions.pg }}/bin/pg_isready -U postgres -d postgres --timeout=30
C:\Progra~1/PostgreSQL/${{ matrix.versions.pg }}/bin/psql -U postgres -d postgres -c 'CREATE USER root SUPERUSER LOGIN;'
- name: Run TSL tests
if: needs.check_paths.outputs.run_installcheck == 'true'
shell: wsl-bash {0}
env:
WSLENV: "IGNORES:SKIPS"
run: |
export TEST_TABLESPACE1_PREFIX='${{ env.TABLESPACE1 }}'
export TEST_TABLESPACE2_PREFIX='${{ env.TABLESPACE2 }}'
make -C build_wsl isolationchecklocal-t | tee -a installcheck.log
make -C build_wsl -k regresschecklocal-t IGNORES="${IGNORES}" SKIPS="${SKIPS}" | tee -a installcheck.log
- name: Show regression diffs
id: collectlogs
if: always() && needs.check_paths.outputs.run_installcheck == 'true'
env:
WSLENV: GITHUB_OUTPUT/p
shell: wsl-bash {0}
run: |
find . -name regression.diffs -exec cat {} + > regression.log
if [[ -s regression.log ]]; then echo "regression_diff=true" >>$GITHUB_OUTPUT; fi
grep -e 'FAILED' -e 'failed (ignored)' -e 'not ok' installcheck.log || true
cat regression.log
- name: Extract stack traces from crash dumps
if: always()
shell: powershell
run: |
$DumpDir = Join-Path $env:GITHUB_WORKSPACE "crashdumps"
if (!(Test-Path $DumpDir)) { Write-Host "No crashdumps directory found."; exit 0 }
$Dumps = Get-ChildItem -Path $DumpDir -Filter "*.dmp" -Recurse -ErrorAction SilentlyContinue
if (!$Dumps) { Write-Host "No .dmp files found in $DumpDir."; exit 0 }
$SymbolCache = Join-Path $DumpDir "symbols"
New-Item -ItemType Directory -Force -Path $SymbolCache | Out-Null
$Out = Join-Path $DumpDir "stacktraces.txt"
foreach ($Dump in $Dumps) {
Add-Content -Path $Out -Value ("==== " + $Dump.FullName + " ====")
& cdb.exe -z $Dump.FullName -c ".symfix $SymbolCache; .reload; !analyze -v; kv; q" | Out-File -FilePath $Out -Append -Encoding utf8
}
- name: Upload crash dumps and stack traces
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Crash dumps PG${{ matrix.versions.pg }} ${{ matrix.build_type }} windows
path: |
crashdumps\**
if-no-files-found: ignore
- name: Save regression diffs
if: always() && steps.collectlogs.outputs.regression_diff == 'true'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Regression ${{ matrix.versions.pg }} diff ${{ matrix.build_type }} Build
path: |
regression.log
installcheck.log
- name: Save PostgreSQL log
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: PostgreSQL ${{ matrix.versions.pg }} log ${{ matrix.build_type }} Build
path: ${{ env.PGDATA }}\log\postmaster.log
- name: Upload CMake Logs
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: CMake Logs ${{ matrix.versions.pg }} ${{ matrix.build_type }}
path: |
build_win/CMakeCache.txt
build_win/CMakeFiles/CMakeConfigureLog.yaml
build_win/CMakeFiles/CMakeError.log
build_win/CMakeFiles/CMakeOutput.log
build_win/compile_commands.json
build_wsl/CMakeCache.txt
build_wsl/CMakeFiles/CMakeConfigureLog.yaml
build_wsl/CMakeFiles/CMakeError.log
build_wsl/CMakeFiles/CMakeOutput.log
build_wsl/compile_commands.json
- name: Upload test results to the database
if: always() && needs.check_paths.outputs.run_installcheck == 'true'
shell: wsl-bash {0}
env:
# Update when adding new variables.
WSLENV: "JOB_NAME:CI_STATS_DB:GITHUB_EVENT_NAME:GITHUB_REF_NAME\
:GITHUB_REPOSITORY:GITHUB_RUN_ATTEMPT:GITHUB_RUN_ID:GITHUB_RUN_NUMBER:JOB_STATUS"
# GitHub Actions allow you neither to use the env context for the job name,
# nor to access the job name from the step context, so we have to
# duplicate it to work around this nonsense.
JOB_NAME: PG${{ matrix.versions.pg }} ${{ matrix.build_type }}
CI_STATS_DB: ${{ secrets.CI_STATS_DB }}
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_REF_NAME: ${{ github.ref_name }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_RUN_ATTEMPT: ${{ github.run_attempt }}
GITHUB_RUN_ID: ${{ github.run_id }}
GITHUB_RUN_NUMBER: ${{ github.run_number }}
JOB_STATUS: ${{ job.status }}
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]] ;
then
GITHUB_PR_NUMBER="${{ github.event.number }}"
else
GITHUB_PR_NUMBER=0
fi
export GITHUB_PR_NUMBER
scripts/upload_ci_stats.sh
report_status:
name: Regression Windows summary
needs: [check_paths, build]
if: always()
runs-on: ubuntu-latest
steps:
- run: |
# If the detector failed, or the matrix failed, exit with error
if [[ "${{ needs.build.result }}" == "failure" ]]; then
exit 1
fi
echo "All checks passed or were safely skipped."