-
Notifications
You must be signed in to change notification settings - Fork 47
768 lines (716 loc) · 32.9 KB
/
Copy pathmain.yml
File metadata and controls
768 lines (716 loc) · 32.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
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
name: MSBuild
run-name: psql ODBC CI - ${{ github.event.head_commit.message }}
on:
push:
branches: [ "main" ]
tags:
- 'REL-*'
- '!REL-*-mimalloc'
pull_request:
branches: [ "main" ]
workflow_dispatch:
env:
BUILD_CONFIGURATION: Release
# PostgreSQL build from source.
POSTGRESQL_SOURCE_TAG: 'REL_18_STABLE'
OPENSSL_VERSION: '3_5_8'
WORKFLOW_VERSION_POSTGRESQL_ARM64: '1' # increment to invalidate the arm64 cache
PKGCONFIGLITE_VERSION: '0.28-1'
WINFLEXBISON_VERSION: '2.5.24'
WORKFLOW_VERSION_POSTGRESQL: '1' # increment to invalidate cache
# PostgreSQL x64 test server (EDB installer).
POSTGRESQL_PACKAGE_FILEID: '1259019'
# Test utilities.
DIFFUTILS_VERSION: '2.8.7-1'
permissions:
contents: read
jobs:
# =====================================================================
# Build PostgreSQL x64 (full) and x86 (libpq only) from source
#
# Both are built with OpenSSL for SSL support (required for release
# installers). Results are cached so subsequent runs skip this job.
# =====================================================================
build-postgres:
runs-on: windows-latest
steps:
- name: Cache PostgreSQL build output
uses: actions/cache@v4
id: cachePostgres
with:
path: |
d:\postgresql
d:\postgresql86
key: postgresql-${{env.POSTGRESQL_SOURCE_TAG}}_openssl-${{env.OPENSSL_VERSION}}_pkgconfiglite-${{env.PKGCONFIGLITE_VERSION}}_winflexbison-${{env.WINFLEXBISON_VERSION}}_workflow-${{env.WORKFLOW_VERSION_POSTGRESQL}}
# -----------------------------------------------------------------
# Source code
# -----------------------------------------------------------------
- name: Cache PostgreSQL source
if: steps.cachePostgres.outputs.cache-hit != 'true'
uses: actions/cache@v4
id: cachePgSource
with:
path: postgres
key: pg-source-${{env.POSTGRESQL_SOURCE_TAG}}
- name: Get PostgreSQL source
if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cachePgSource.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: "postgres/postgres.git"
ref: ${{env.POSTGRESQL_SOURCE_TAG}}
path: postgres
# -----------------------------------------------------------------
# Build tools
# -----------------------------------------------------------------
- name: Install meson and ninja
if: steps.cachePostgres.outputs.cache-hit != 'true'
run: python -m pip install meson ninja
- name: Cache winflexbison
if: steps.cachePostgres.outputs.cache-hit != 'true'
uses: actions/cache@v4
id: cacheWinFlexBison
with:
path: C:\OTHERBIN\winflexbison
key: winflexbison-dworkspace-${{env.WINFLEXBISON_VERSION}}
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
- name: Download winflexbison
if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cacheWinFlexBison.outputs.cache-hit != 'true'
uses: suisei-cn/actions-download-file@v1.6.0
id: downloadWinFlexBison
with:
retry-times: 5
url: https://sourceforge.net/projects/winflexbison/files/win_flex_bison-${{env.WINFLEXBISON_VERSION}}.zip
filename: win_flex_bison.zip
- name: Extract winflexbison
if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cacheWinFlexBison.outputs.cache-hit != 'true'
shell: cmd
run: |
mkdir "C:\OTHERBIN\winflexbison"
7z x win_flex_bison.zip -o"C:\OTHERBIN\winflexbison"
- name: Add winflexbison to PATH
if: steps.cachePostgres.outputs.cache-hit != 'true'
shell: cmd
run: printf "C:\OTHERBIN\\winflexbison" >> %GITHUB_PATH%
- name: Cache pkgconfiglite
if: steps.cachePostgres.outputs.cache-hit != 'true'
uses: actions/cache@v4
id: cachePkgConfigLite
with:
path: C:\OTHERBIN\pkgconfiglite
key: pkg-config-lite-dworkspace-${{env.PKGCONFIGLITE_VERSION}}-win32
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
- name: Download pkgconfiglite
if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cachePkgConfigLite.outputs.cache-hit != 'true'
uses: suisei-cn/actions-download-file@v1.6.0
id: downloadPkgConfigLite
with:
retry-times: 5
url: http://downloads.sourceforge.net/project/pkgconfiglite/${{env.PKGCONFIGLITE_VERSION}}/pkg-config-lite-${{env.PKGCONFIGLITE_VERSION}}_bin-win32.zip
filename: pkg-config-lite_bin-win32.zip
- name: Extract pkgconfiglite
if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cachePkgConfigLite.outputs.cache-hit != 'true'
shell: cmd
run: |
mkdir "C:\OTHERBIN\pkgconfiglite"
7z x pkg-config-lite_bin-win32.zip -o"C:\OTHERBIN\pkgconfiglite"
- name: Add pkgconfiglite to PATH
if: steps.cachePostgres.outputs.cache-hit != 'true'
shell: cmd
run: printf "C:\\OTHERBIN\\pkgconfiglite\\pkg-config-lite-%PKGCONFIGLITE_VERSION%\\bin" >> %GITHUB_PATH%
# -----------------------------------------------------------------
# OpenSSL (required for release installers)
# -----------------------------------------------------------------
- name: Cache Win32 OpenSSL
if: steps.cachePostgres.outputs.cache-hit != 'true'
uses: actions/cache@v4
id: cacheWin32OpenSSL
with:
path: C:\OTHERBIN\openssl32
key: Win32OpenSSL-${{env.OPENSSL_VERSION}}
- name: Download Win32 OpenSSL
if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cacheWin32OpenSSL.outputs.cache-hit != 'true'
uses: suisei-cn/actions-download-file@v1.6.0
id: downloadWin32OpenSSL
with:
retry-times: 5
url: https://slproweb.com/download/Win32OpenSSL-${{env.OPENSSL_VERSION}}.exe
filename: Win32OpenSSL.exe
- name: Install Win32 OpenSSL
if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cacheWin32OpenSSL.outputs.cache-hit != 'true'
shell: cmd
run: Win32OpenSSL.exe /sp /silent /dir=c:\OTHERBIN\openssl32
- name: Cache Win64 OpenSSL
if: steps.cachePostgres.outputs.cache-hit != 'true'
uses: actions/cache@v4
id: cacheWin64OpenSSL
with:
path: C:\OTHERBIN\openssl64
key: Win64OpenSSL-${{env.OPENSSL_VERSION}}
- name: Download Win64 OpenSSL
if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cacheWin64OpenSSL.outputs.cache-hit != 'true'
uses: suisei-cn/actions-download-file@v1.6.0
id: downloadWin64OpenSSL
with:
retry-times: 5
url: https://slproweb.com/download/Win64OpenSSL-${{env.OPENSSL_VERSION}}.exe
filename: Win64OpenSSL.exe
- name: Install Win64 OpenSSL
if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cacheWin64OpenSSL.outputs.cache-hit != 'true'
shell: cmd
run: Win64OpenSSL.exe /sp /silent /dir=c:\OTHERBIN\openssl64
# -----------------------------------------------------------------
# Build PostgreSQL x64 (full server with SSL)
# -----------------------------------------------------------------
- name: Setup MSVC x64
if: steps.cachePostgres.outputs.cache-hit != 'true'
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x64
- name: Build PostgreSQL x64
if: steps.cachePostgres.outputs.cache-hit != 'true'
working-directory: postgres
run: |
meson setup build -Dssl=openssl -Dextra_lib_dirs=c:\OTHERBIN\openssl64\lib\VC\x64\MT -Dextra_include_dirs=c:\OTHERBIN\openssl64\include --prefix=d:\postgresql
cd build
ninja
ninja install
cp c:\OTHERBIN\openssl64\*.dll d:\postgresql\bin
# -----------------------------------------------------------------
# Build PostgreSQL x86 (libpq client library only, with SSL)
#
# Only the libpq client library is needed to compile the x86 ODBC
# driver. The test server is always x64. Building only libpq is
# much faster than building the full PostgreSQL server.
# -----------------------------------------------------------------
- name: Setup MSVC x86
if: steps.cachePostgres.outputs.cache-hit != 'true'
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x86
- name: Build PostgreSQL x86 client library
if: steps.cachePostgres.outputs.cache-hit != 'true'
working-directory: postgres
shell: pwsh
run: |
# Headers are architecture-independent; reuse from the x64 build.
New-Item -ItemType Directory -Path d:\postgresql86 -Force
Copy-Item -Recurse d:\postgresql\include d:\postgresql86\include
# Configure with SSL support (required for release installers).
meson setup buildx86 -Dssl=openssl -Dextra_lib_dirs=c:\OTHERBIN\openssl32\lib\VC\x86\MT -Dextra_include_dirs=c:\OTHERBIN\openssl32\include --prefix=d:\postgresql86
# Build only the libpq client library (and its dependencies).
# This is much faster than building the full PostgreSQL server.
meson compile -C buildx86 src/interfaces/libpq/libpq:shared_library
# Install only the files needed for compiling and linking the x86 ODBC driver.
New-Item -ItemType Directory -Path d:\postgresql86\lib, d:\postgresql86\bin -Force
Get-ChildItem buildx86 -Recurse -Filter "libpq.lib" | Copy-Item -Destination d:\postgresql86\lib\
Get-ChildItem buildx86 -Recurse -Filter "libpq.dll" | Copy-Item -Destination d:\postgresql86\bin\
# Copy OpenSSL DLLs (needed by the installer).
Copy-Item c:\OTHERBIN\openssl32\*.dll d:\postgresql86\bin\
# =====================================================================
# Build and test psqlodbc (standard and mimalloc, in parallel)
# =====================================================================
build-and-test:
needs: build-postgres
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
variant: [standard, mimalloc]
steps:
# -----------------------------------------------------------------
# Restore PostgreSQL build from cache
# -----------------------------------------------------------------
- name: Restore PostgreSQL build from cache
uses: actions/cache/restore@v4
with:
path: |
d:\postgresql
d:\postgresql86
key: postgresql-${{env.POSTGRESQL_SOURCE_TAG}}_openssl-${{env.OPENSSL_VERSION}}_pkgconfiglite-${{env.PKGCONFIGLITE_VERSION}}_winflexbison-${{env.WINFLEXBISON_VERSION}}_workflow-${{env.WORKFLOW_VERSION_POSTGRESQL}}
fail-on-cache-miss: true
# -----------------------------------------------------------------
# Test dependencies
# -----------------------------------------------------------------
- name: Cache GNU diffutils
uses: actions/cache@v4
id: cacheDiffutils
with:
path: C:\OTHERBIN\diffutils
key: diffutils-dworkspace-${{env.DIFFUTILS_VERSION}}
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
- name: Download GNU diffutils
if: steps.cacheDiffutils.outputs.cache-hit != 'true'
uses: suisei-cn/actions-download-file@v1.6.0
id: downloadDiffutils
with:
retry-times: 5
url: https://zenlayer.dl.sourceforge.net/project/gnuwin32/diffutils/${{env.DIFFUTILS_VERSION}}/diffutils-${{env.DIFFUTILS_VERSION}}-bin.zip
filename: diffutils-bin.zip
- name: Extract GNU diffutils
if: steps.cacheDiffutils.outputs.cache-hit != 'true'
shell: cmd
run: |
mkdir "C:\OTHERBIN\diffutils"
7z x diffutils-bin.zip -o"C:\OTHERBIN\diffutils"
- name: Add diffutils to PATH
shell: cmd
run: printf "C:\\OTHERBIN\\diffutils\\bin" >> %GITHUB_PATH%
# -----------------------------------------------------------------
# PostgreSQL x64 test server
# -----------------------------------------------------------------
- name: Cache PostgreSQL installer
uses: actions/cache@v4
id: cacheInstaller
with:
path: C:\OTHERBIN\postgresql_install.exe
key: pg-installer-dworkspace-${{env.POSTGRESQL_PACKAGE_FILEID}}
- name: Download PostgreSQL installer
if: steps.cacheInstaller.outputs.cache-hit != 'true'
uses: suisei-cn/actions-download-file@v1.6.0
id: downloadInstaller
with:
retry-times: 5
url: https://sbp.enterprisedb.com/getfile.jsp?fileid=${{env.POSTGRESQL_PACKAGE_FILEID}}
target: c:\OTHERBIN
filename: postgresql_install.exe
- name: Install and start PostgreSQL server
shell: cmd
run: |
echo on
C:\OTHERBIN\postgresql_install.exe --mode unattended --unattendedmodeui none --superpassword password --enable-components server
sc config "postgresql-x64-17" start= auto
sc start "postgresql-x64-17"
ping -n 6 127.0.0.1 >nul
# -----------------------------------------------------------------
# Build and test psqlodbc
# -----------------------------------------------------------------
- name: Checkout psqlodbc
uses: actions/checkout@v4
with:
path: psqlodbc
submodules: true
- name: Setup MSVC for psqlodbc
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x86
- name: Install WiX
shell: cmd
run: |
dotnet tool install --global wix --version "6.*"
wix extension add --global WixToolset.UI.wixext/6.0.0
- name: Build psqlodbc ${{matrix.variant}}
shell: powershell
working-directory: psqlodbc
run: |
copy .github\workflows\configuration.xml winbuild
if ('${{matrix.variant}}' -eq 'mimalloc') {
winbuild\BuildAll.ps1 -UseMimalloc
} else {
winbuild\BuildAll.ps1
}
installer\buildInstallers.ps1
env:
PSQLODBC_OBJBASE: ${{ github.workspace }}\psqlodbc\winbuild\${{matrix.variant}}
- name: Test psqlodbc ${{matrix.variant}}
shell: powershell
working-directory: psqlodbc
run: |
if ('${{matrix.variant}}' -eq 'mimalloc') {
winbuild\regress.ps1 -DsnInfo "SERVER=localhost|DATABASE=contrib_regression|PORT=5432|UID=postgres|PWD=password" -ExpectMimalloc
} else {
winbuild\regress.ps1 -DsnInfo "SERVER=localhost|DATABASE=contrib_regression|PORT=5432|UID=postgres|PWD=password"
}
${{matrix.variant}}\test_x86\RegisterRegdsn.exe uninstall_driver postgres_devw
${{matrix.variant}}\test_x64\RegisterRegdsn.exe uninstall_driver postgres_devw
env:
PSQLODBC_OBJBASE: ${{ github.workspace }}\psqlodbc\winbuild\${{matrix.variant}}
# -----------------------------------------------------------------
# Upload artifacts
# -----------------------------------------------------------------
- name: Upload ${{matrix.variant}} x64 merge module
uses: actions/upload-artifact@v4
with:
name: psqlODBC ${{matrix.variant}} x64 Merge Module
path: psqlodbc/winbuild/${{matrix.variant}}/installer/x64/*.msm
retention-days: 5
if-no-files-found: error
- name: Upload ${{matrix.variant}} x64 installer package
uses: actions/upload-artifact@v4
with:
name: psqlODBC ${{matrix.variant}} x64 Installer
path: psqlodbc/winbuild/${{matrix.variant}}/installer/x64/*.msi
retention-days: 5
if-no-files-found: error
- name: Upload ${{matrix.variant}} x86 merge module
uses: actions/upload-artifact@v4
with:
name: psqlODBC ${{matrix.variant}} x86 Merge Module
path: psqlodbc/winbuild/${{matrix.variant}}/installer/x86/*.msm
retention-days: 5
if-no-files-found: error
- name: Upload ${{matrix.variant}} x86 installer package
uses: actions/upload-artifact@v4
with:
name: psqlODBC ${{matrix.variant}} x86 Installer
path: psqlodbc/winbuild/${{matrix.variant}}/installer/x86/*.msi
retention-days: 5
if-no-files-found: error
- name: Upload ${{matrix.variant}} x64 setup
uses: actions/upload-artifact@v4
with:
name: psqlODBC ${{matrix.variant}} x64 Setup
path: psqlodbc/winbuild/${{matrix.variant}}/installer/psqlodbc-setup/bin/Release/psqlodbc-setup.exe
retention-days: 5
if-no-files-found: error
# =====================================================================
# Build PostgreSQL arm64 (libpq only, from source) for Windows on Arm
#
# The windows-11-arm image has no prebuilt arm64 PostgreSQL, so libpq is
# built from source natively (OpenSSL comes from the slproweb prebuilt
# arm64 installer, same as the x86/x64 jobs). Only libpq is built:
# the full server does not build for aarch64 (PostgreSQL's msvc_gendef.pl
# rejects the arch when generating postgres.def), and the driver only needs
# libpq. The regression test server is a separate x64 EDB install (run under
# emulation) in the build-and-test job. windows-11-arm has no D: drive, so
# outputs live under C:. Results are cached so subsequent runs skip this job.
# =====================================================================
build-postgres-arm:
runs-on: windows-11-arm
steps:
- name: Cache libpq arm64 build output
uses: actions/cache@v4
id: cachePostgres
with:
path: C:\postgresql_arm64
key: postgresql-arm64-${{env.POSTGRESQL_SOURCE_TAG}}_openssl-${{env.OPENSSL_VERSION}}_pkgconfiglite-${{env.PKGCONFIGLITE_VERSION}}_winflexbison-${{env.WINFLEXBISON_VERSION}}_workflow-${{env.WORKFLOW_VERSION_POSTGRESQL_ARM64}}
# -----------------------------------------------------------------
# Source code
# -----------------------------------------------------------------
- name: Cache PostgreSQL source
if: steps.cachePostgres.outputs.cache-hit != 'true'
uses: actions/cache@v4
id: cachePgSource
with:
path: postgres
# Distinct from the x64 job's pg-source key: that cache contains an
# x64-configured meson build/ dir with absolute D: paths, which breaks
# a C:-based arm64 reconfigure.
key: pg-source-arm64-${{env.POSTGRESQL_SOURCE_TAG}}
- name: Get PostgreSQL source
if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cachePgSource.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: "postgres/postgres.git"
ref: ${{env.POSTGRESQL_SOURCE_TAG}}
path: postgres
# -----------------------------------------------------------------
# Build tools
# -----------------------------------------------------------------
- name: Install meson and ninja
if: steps.cachePostgres.outputs.cache-hit != 'true'
run: python -m pip install meson ninja
- name: Cache winflexbison
if: steps.cachePostgres.outputs.cache-hit != 'true'
uses: actions/cache@v4
id: cacheWinFlexBison
with:
path: C:\OTHERBIN\winflexbison
key: winflexbison-cworkspace-${{env.WINFLEXBISON_VERSION}}
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
- name: Download winflexbison
if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cacheWinFlexBison.outputs.cache-hit != 'true'
uses: suisei-cn/actions-download-file@v1.6.0
id: downloadWinFlexBison
with:
retry-times: 5
url: https://sourceforge.net/projects/winflexbison/files/win_flex_bison-${{env.WINFLEXBISON_VERSION}}.zip
filename: win_flex_bison.zip
- name: Extract winflexbison
if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cacheWinFlexBison.outputs.cache-hit != 'true'
shell: cmd
run: |
mkdir "C:\OTHERBIN\winflexbison"
7z x win_flex_bison.zip -o"C:\OTHERBIN\winflexbison"
- name: Add winflexbison to PATH
if: steps.cachePostgres.outputs.cache-hit != 'true'
shell: cmd
run: printf "C:\OTHERBIN\\winflexbison" >> %GITHUB_PATH%
- name: Cache pkgconfiglite
if: steps.cachePostgres.outputs.cache-hit != 'true'
uses: actions/cache@v4
id: cachePkgConfigLite
with:
path: C:\OTHERBIN\pkgconfiglite
key: pkg-config-lite-cworkspace-${{env.PKGCONFIGLITE_VERSION}}-win32
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
- name: Download pkgconfiglite
if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cachePkgConfigLite.outputs.cache-hit != 'true'
uses: suisei-cn/actions-download-file@v1.6.0
id: downloadPkgConfigLite
with:
retry-times: 5
url: http://downloads.sourceforge.net/project/pkgconfiglite/${{env.PKGCONFIGLITE_VERSION}}/pkg-config-lite-${{env.PKGCONFIGLITE_VERSION}}_bin-win32.zip
filename: pkg-config-lite_bin-win32.zip
- name: Extract pkgconfiglite
if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cachePkgConfigLite.outputs.cache-hit != 'true'
shell: cmd
run: |
mkdir "C:\OTHERBIN\pkgconfiglite"
7z x pkg-config-lite_bin-win32.zip -o"C:\OTHERBIN\pkgconfiglite"
- name: Add pkgconfiglite to PATH
if: steps.cachePostgres.outputs.cache-hit != 'true'
shell: cmd
run: printf "C:\\OTHERBIN\\pkgconfiglite\\pkg-config-lite-%PKGCONFIGLITE_VERSION%\\bin" >> %GITHUB_PATH%
# -----------------------------------------------------------------
# OpenSSL arm64 (prebuilt slproweb installer; required for release
# installers). Mirrors the x86/x64 jobs: download the silent Inno
# Setup installer and install it. Cached so a libpq-cache miss does
# not force a re-download.
# -----------------------------------------------------------------
- name: Cache Win64ARM OpenSSL
if: steps.cachePostgres.outputs.cache-hit != 'true'
uses: actions/cache@v4
id: cacheWin64ARMOpenSSL
with:
path: C:\OTHERBIN\openssl_arm64
key: Win64ARMOpenSSL-${{env.OPENSSL_VERSION}}
- name: Download Win64ARM OpenSSL
if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cacheWin64ARMOpenSSL.outputs.cache-hit != 'true'
uses: suisei-cn/actions-download-file@v1.6.0
id: downloadWin64ARMOpenSSL
with:
retry-times: 5
url: https://slproweb.com/download/Win64ARMOpenSSL-${{env.OPENSSL_VERSION}}.exe
filename: Win64ARMOpenSSL.exe
- name: Install Win64ARM OpenSSL
if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cacheWin64ARMOpenSSL.outputs.cache-hit != 'true'
shell: cmd
run: Win64ARMOpenSSL.exe /sp /silent /dir=c:\OTHERBIN\openssl_arm64
# -----------------------------------------------------------------
# Build libpq arm64 only (with SSL).
#
# Building only the libpq client library avoids the full-server build,
# which fails for aarch64 (postgres.def generation). This mirrors the
# x86 libpq-only build in the x64 job. A minimal libpq SDK (lib + dll +
# the client headers psqlodbc needs) is assembled under C:\postgresql_arm64.
# -----------------------------------------------------------------
- name: Setup MSVC arm64
if: steps.cachePostgres.outputs.cache-hit != 'true'
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: arm64
- name: Build libpq arm64
if: steps.cachePostgres.outputs.cache-hit != 'true'
working-directory: postgres
shell: pwsh
run: |
# Always configure a clean arm64 build dir (never reuse a stale or
# cross-arch meson configuration).
if (Test-Path build) { Remove-Item -Recurse -Force build }
meson setup build -Dssl=openssl -Dextra_lib_dirs=c:\OTHERBIN\openssl_arm64\lib\VC\arm64\MT -Dextra_include_dirs=c:\OTHERBIN\openssl_arm64\include --prefix=C:\postgresql_arm64
# Build only the libpq client library (and its dependencies).
meson compile -C build src/interfaces/libpq/libpq:shared_library
# Assemble a minimal libpq SDK layout at C:\postgresql_arm64.
New-Item -ItemType Directory -Force -Path C:\postgresql_arm64\lib, C:\postgresql_arm64\bin, C:\postgresql_arm64\include | Out-Null
Get-ChildItem build -Recurse -Filter "libpq.lib" | Copy-Item -Destination C:\postgresql_arm64\lib\
Get-ChildItem build -Recurse -Filter "libpq.dll" | Copy-Item -Destination C:\postgresql_arm64\bin\
# Headers: reproduce a PostgreSQL install-style include layout so the
# driver builds. psqlodbc includes <libpq-fe.h>, "pqexpbuffer.h" and
# "postgres_fe.h"; the last pulls in the full server header tree
# (c.h, pg_config*.h, ...). Client headers go in include\, server
# headers in include\server\ (on psqlodbc's PG_INC/server include path).
$inc = "C:\postgresql_arm64\include"
New-Item -ItemType Directory -Force -Path "$inc\server" | Out-Null
Copy-Item src\interfaces\libpq\libpq-fe.h, src\interfaces\libpq\libpq-events.h, src\interfaces\libpq\pqexpbuffer.h $inc
Copy-Item src\include\postgres_ext.h $inc
# Full server header tree: static source headers plus the meson-generated
# pg_config.h / pg_config_os.h (emitted together in build\src\include).
# (PostgreSQL 18 has no pg_config_ext.h.)
Copy-Item -Recurse -Force src\include\* "$inc\server"
$gen = (Get-ChildItem build -Recurse -Filter pg_config.h | Select-Object -First 1).Directory.FullName
Copy-Item -Recurse -Force "$gen\*" "$inc\server"
# OpenSSL runtime DLLs alongside libpq (needed at load time and by the installer).
# The slproweb installer places the DLLs at the install root (like x86/x64).
Copy-Item c:\OTHERBIN\openssl_arm64\*.dll C:\postgresql_arm64\bin\
# =====================================================================
# Build and test psqlodbc arm64 (standard and mimalloc, in parallel)
#
# Runs natively on windows-11-arm. The regression tests run against a
# from-source arm64 PostgreSQL server started below.
# =====================================================================
build-and-test-arm:
needs: build-postgres-arm
runs-on: windows-11-arm
strategy:
fail-fast: false
matrix:
# mimalloc is omitted on arm64: the vendored mimalloc submodule's VS
# project (libs/mimalloc/ide/vs2022/mimalloc.vcxproj) declares no ARM64
# configuration, so mimalloc-static.lib can't be built for arm64. Left
# as a follow-up (submodule bump or CMake build); mimalloc remains
# enabled for x86/x64.
variant: [standard]
steps:
- name: Restore libpq arm64 build from cache
uses: actions/cache/restore@v4
with:
path: C:\postgresql_arm64
key: postgresql-arm64-${{env.POSTGRESQL_SOURCE_TAG}}_openssl-${{env.OPENSSL_VERSION}}_pkgconfiglite-${{env.PKGCONFIGLITE_VERSION}}_winflexbison-${{env.WINFLEXBISON_VERSION}}_workflow-${{env.WORKFLOW_VERSION_POSTGRESQL_ARM64}}
fail-on-cache-miss: true
# -----------------------------------------------------------------
# Test dependencies
# -----------------------------------------------------------------
- name: Cache GNU diffutils
uses: actions/cache@v4
id: cacheDiffutilsArm
with:
path: C:\OTHERBIN\diffutils
key: diffutils-cworkspace-${{env.DIFFUTILS_VERSION}}
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
- name: Download GNU diffutils
if: steps.cacheDiffutilsArm.outputs.cache-hit != 'true'
uses: suisei-cn/actions-download-file@v1.6.0
with:
retry-times: 5
url: https://zenlayer.dl.sourceforge.net/project/gnuwin32/diffutils/${{env.DIFFUTILS_VERSION}}/diffutils-${{env.DIFFUTILS_VERSION}}-bin.zip
filename: diffutils-bin.zip
- name: Extract GNU diffutils
if: steps.cacheDiffutilsArm.outputs.cache-hit != 'true'
shell: cmd
run: |
mkdir "C:\OTHERBIN\diffutils"
7z x diffutils-bin.zip -o"C:\OTHERBIN\diffutils"
- name: Add diffutils to PATH
shell: cmd
run: printf "C:\\OTHERBIN\\diffutils\\bin" >> %GITHUB_PATH%
# -----------------------------------------------------------------
# PostgreSQL test server: the x64 EDB installer, run under Windows-on-Arm
# x64 emulation. The driver connects over localhost TCP, so the server's
# architecture is irrelevant. The regression harness (reset-db) creates
# the contrib_regression database itself, so no createdb here.
# -----------------------------------------------------------------
- name: Cache PostgreSQL installer
uses: actions/cache@v4
id: cacheInstallerArm
with:
path: C:\OTHERBIN\postgresql_install.exe
key: pg-installer-cworkspace-${{env.POSTGRESQL_PACKAGE_FILEID}}
- name: Download PostgreSQL installer
if: steps.cacheInstallerArm.outputs.cache-hit != 'true'
uses: suisei-cn/actions-download-file@v1.6.0
with:
retry-times: 5
url: https://sbp.enterprisedb.com/getfile.jsp?fileid=${{env.POSTGRESQL_PACKAGE_FILEID}}
target: c:\OTHERBIN
filename: postgresql_install.exe
- name: Install and start PostgreSQL server
shell: cmd
run: |
echo on
C:\OTHERBIN\postgresql_install.exe --mode unattended --unattendedmodeui none --superpassword password --enable-components server
sc config "postgresql-x64-17" start= auto
sc start "postgresql-x64-17"
ping -n 6 127.0.0.1 >nul
# Put the arm64 libpq (and its OpenSSL DLLs) ahead of the emulated x64
# server's bin so the arm64 driver loads the matching arm64 libpq at runtime.
- name: Add arm64 libpq to PATH
shell: cmd
run: echo C:\postgresql_arm64\bin>> %GITHUB_PATH%
# -----------------------------------------------------------------
# Build and test psqlodbc
# -----------------------------------------------------------------
- name: Checkout psqlodbc
uses: actions/checkout@v4
with:
path: psqlodbc
submodules: true
- name: Setup MSVC arm64 for psqlodbc
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: arm64
- name: Install WiX
shell: cmd
run: |
dotnet tool install --global wix --version "6.*"
wix extension add --global WixToolset.UI.wixext/6.0.0
- name: Build psqlodbc ${{matrix.variant}}
shell: powershell
working-directory: psqlodbc
run: |
copy .github\workflows\configuration.xml winbuild
if ('${{matrix.variant}}' -eq 'mimalloc') {
winbuild\BuildAll.ps1 -Platform ARM64 -UseMimalloc
} else {
winbuild\BuildAll.ps1 -Platform ARM64
}
installer\buildInstallers.ps1 -cpu arm64
env:
PSQLODBC_OBJBASE: ${{ github.workspace }}\psqlodbc\winbuild\${{matrix.variant}}
- name: Test psqlodbc ${{matrix.variant}}
shell: powershell
working-directory: psqlodbc
run: |
if ('${{matrix.variant}}' -eq 'mimalloc') {
winbuild\regress.ps1 -Platform ARM64 -DsnInfo "SERVER=localhost|DATABASE=contrib_regression|PORT=5432|UID=postgres|PWD=password" -ExpectMimalloc
} else {
winbuild\regress.ps1 -Platform ARM64 -DsnInfo "SERVER=localhost|DATABASE=contrib_regression|PORT=5432|UID=postgres|PWD=password"
}
${{matrix.variant}}\test_arm64\RegisterRegdsn.exe uninstall_driver postgres_devw
env:
PSQLODBC_OBJBASE: ${{ github.workspace }}\psqlodbc\winbuild\${{matrix.variant}}
# -----------------------------------------------------------------
# Upload artifacts (named to match the release job's glob patterns)
# -----------------------------------------------------------------
- name: Upload ${{matrix.variant}} arm64 merge module
uses: actions/upload-artifact@v4
with:
name: psqlODBC ${{matrix.variant}} arm64 Merge Module
path: psqlodbc/winbuild/${{matrix.variant}}/installer/arm64/*.msm
retention-days: 5
if-no-files-found: error
- name: Upload ${{matrix.variant}} arm64 installer package
uses: actions/upload-artifact@v4
with:
name: psqlODBC ${{matrix.variant}} arm64 Installer
path: psqlodbc/winbuild/${{matrix.variant}}/installer/arm64/*.msi
retention-days: 5
if-no-files-found: error
# =====================================================================
# Release (only on version tags)
# =====================================================================
release:
needs: [build-and-test, build-and-test-arm]
if: startsWith(github.ref, 'refs/tags/REL-')
runs-on: windows-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create mimalloc Release
uses: ncipollo/release-action@v1.14.0
id: create_mimalloc_release
with:
tag: ${{github.ref_name}}-mimalloc
commit: ${{github.sha}}
body: A build of ${{github.ref_name}} that uses the mimalloc allocator for improved performance.
makeLatest: false
draft: false
prerelease: false
token: ${{secrets.RELEASE_TOKEN}}
artifacts: "artifacts/psqlODBC mimalloc*/**/*"
- name: Create Standard Release
uses: ncipollo/release-action@v1.14.0
id: create_standard_release
with:
makeLatest: true
draft: false
prerelease: false
token: ${{secrets.RELEASE_TOKEN}}
artifacts: "artifacts/psqlODBC standard*/**/*"