Repository navigation
296 lines (251 loc) · 11.6 KB
/
Copy pathpostgresql-dev-windows.yml
File metadata and controls
296 lines (251 loc) · 11.6 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
name: Build PostgreSQL (Dev) (Windows)
# There is no immutable per-version companion to this release, as there is for
# the per-package ones, because this tracks a branch rather than a release:
# "master" names different code every day, so a tag carrying it would be a
# promise the build cannot keep.
on:
workflow_dispatch:
workflow_call:
# The one package whose source moves without anybody editing the manifest:
# its version is "master", so it is a different build every day. Everything
# else is pinned to an exact version and is rebuilt when that changes, which
# is why the orchestrators no longer run nightly.
schedule:
- cron: "00 01 * * *"
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
# Declared rather than inherited. A called workflow runs with the CALLER's
# permissions, and a push-triggered run does not get the same default token
# as a scheduled or dispatched one: every push-triggered run of this
# orchestrator failed at Create Release with 403 whilst every scheduled one
# succeeded, and because the Windows leaves delete before they create, each
# failure left no release at all until the next schedule repaired it.
permissions:
contents: write
jobs:
get-versions:
uses: ./.github/workflows/manifest.yml
with:
config-path: manifest.json
build-postgresql-dev:
needs: get-versions
strategy:
fail-fast: false
env:
POSTGRESQL-DEV_VERSION: ${{needs.get-versions.outputs.POSTGRESQL-DEV_VERSION}}
runs-on: windows-latest
steps:
- uses: ilammy/msvc-dev-cmd@v1
# When run via build-all (workflow_call), the all-deps-windows-x86_64 artifact is
# produced by the bundle-deps job earlier in the same run, so this
# same-run lookup succeeds. continue-on-error lets a standalone dispatch
# (where no such artifact exists) fall through to the release fallback
# below instead of failing the job.
- name: Download dependencies
id: download-deps
uses: actions/download-artifact@v7
continue-on-error: true
with:
name: all-deps-windows-x86_64
path: /builddeps
# Standalone dispatch has no same-run artifact; pull the dependencies
# from the dependencies-windows-x86_64-latest release published by bundle-deps. The
# release archive has a top-level builddeps/ directory, so extracting to
# the filesystem root reproduces the \builddeps layout. Skipped on
# build-all runs, where the step above already succeeded.
- name: Download dependencies (release fallback)
if: steps.download-deps.outcome == 'failure'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download dependencies-windows-x86_64-latest `
--repo ${{ github.repository }} `
--pattern postgresql-dependencies-windows-x86_64-latest.zip `
--dir $env:RUNNER_TEMP
Expand-Archive `
-Path $env:RUNNER_TEMP\postgresql-dependencies-windows-x86_64-latest.zip `
-DestinationPath \ -Force
# Copy libraries requires at runtime to installation directory.
#
# Do so before configuring / building postgres, otherwise we need to
# duplicate knowledge about aberrant paths like "bin64".
- name: Install Dependencies
run: |
mkdir \postgresql
mkdir \postgresql\bin
copy \builddeps\bin64\icuuc*.dll \postgresql\bin\
copy \builddeps\bin64\icudt*.dll \postgresql\bin\
copy \builddeps\bin64\icuin*.dll \postgresql\bin\
copy \builddeps\bin\libiconv-2.dll \postgresql\bin\
copy \builddeps\bin\libintl-8.dll \postgresql\bin\
copy \builddeps\bin\libxml2.dll \postgresql\bin\
copy \builddeps\bin\libxslt.dll \postgresql\bin\
copy \builddeps\bin\libssl-*-x64.dll \postgresql\bin\
copy \builddeps\bin\libcrypto-*-x64.dll \postgresql\bin\
copy \builddeps\bin\liblz4.dll \postgresql\bin\
copy \builddeps\bin\libzstd.dll \postgresql\bin\
copy \builddeps\bin\zlib1.dll \postgresql\bin\
# GSSAPI (MIT Kerberos) is enabled for the dev (master) build, so bundle
# the krb5 runtime DLLs that libpq's gssapi support links against.
- name: Install GSSAPI runtime dependencies
run: |
copy \builddeps\bin\gssapi64.dll \postgresql\bin\
copy \builddeps\bin\krb5_64.dll \postgresql\bin\
copy \builddeps\bin\comerr64.dll \postgresql\bin\
copy \builddeps\bin\k5sprt64.dll \postgresql\bin\
copy \builddeps\bin\xpprof64.dll \postgresql\bin\
copy \builddeps\bin\krbcc64.dll \postgresql\bin\
shell: cmd
- name: Add build deps to path
run: |
# so binaries and libraries can be found/run
echo "/builddeps/bin" >> $ENV:GITHUB_PATH
echo "/builddeps" >> $ENV:GITHUB_PATH
echo "/postgresql/bin" >> $ENV:GITHUB_PATH
# This is run as a privileged user. For some reason windows ends up
# creating the directories owned by "Administrator", which causes
# problems because when postgres drops privileges, it doesn't have
# sufficient rights to access them anymore!
#
# I have pulled most of my hair out over the last hours.
#
# See also https://www.postgresql.org/message-id/20240707064046.blgjxoqiywunbebl%40awork3.anarazel.de
- name: Work around privilege issue
run: |
icacls.exe . /inheritance:e /grant 'runneradmin:(OI)(CI)F'
- name: Checkout
uses: actions/checkout@v6
with:
repository: postgres/postgres
path: postgresql-${{ env.POSTGRESQL-DEV_VERSION }}
ref: ${{ env.POSTGRESQL-DEV_VERSION }}
- name: Source archive
run: |
cd postgresql-${{ env.POSTGRESQL-DEV_VERSION }}
git archive --format=tar.gz -o ../postgresql-dev-${{ env.POSTGRESQL-DEV_VERSION }}.tar.gz --prefix=postgresql-dev-${{ env.POSTGRESQL-DEV_VERSION }}/ ${{ env.POSTGRESQL-DEV_VERSION }}
- name: Configure
run: |
# Optimize path length for Meson 1.9.1+ to avoid Windows 32KB PATH limit
# Move to short root path: \s\pg\b instead of long GitHub Actions path
# This saves ~40 chars per path = ~8KB total with 200+ test directories
New-Item -ItemType Directory -Force -Path \s
Move-Item postgresql-${{ env.POSTGRESQL-DEV_VERSION }} \s\pg
# Resolve builddeps path
$deps = resolve-path /builddeps
# Change to source directory
cd \s\pg
# can't enable some extra tests
# - libpq_encryption -> fails for unknown reasons
# - kerberos -> test not yet supported on windows
# - load_balance -> would need to set up hostnames
meson setup `
--prefix=\postgresql `
"--cmake-prefix-path=${deps}" `
"--pkg-config-path=${deps}\lib\pkgconfig" `
"-Dextra_include_dirs=${deps}\include" `
"-Dextra_lib_dirs=${deps}\lib,${deps}\lib\amd64" `
"-DPG_TEST_EXTRA=ldap ssl" `
-Duuid=ossp `
-Db_pch=true `
-Dgssapi=enabled `
-Dbuildtype=debugoptimized `
b
- name: Build
run: |
cd \s\pg\b
ninja -j 1
- name: Test - core
run: |
cd \s\pg\b
# use unix socket to prevent port conflicts
$env:PG_TEST_USE_UNIX_SOCKETS = 1;
# otherwise pg_regress insists on creating the directory and does it
# in a non-existing place, this needs to be fixed :(
mkdir d:/sockets
$env:PG_REGRESS_SOCK_DIR = "d:/sockets/"
meson test --timeout-multiplier 2 --suite setup --suite recovery --suite subscription
- name: Test - ecpg
run: |
cd \s\pg\b
$env:PG_TEST_USE_UNIX_SOCKETS = 1;
$env:PG_REGRESS_SOCK_DIR = "d:/sockets/"
meson test --timeout-multiplier 2 --suite ecpg
- name: Test - tools
run: |
cd \s\pg\b
$env:PG_TEST_USE_UNIX_SOCKETS = 1;
$env:PG_REGRESS_SOCK_DIR = "d:/sockets/"
meson test --no-rebuild --timeout-multiplier 2 --suite scripts --suite pg_verifybackup --suite pg_rewind --suite pg_combinebackup --suite pg_upgrade --suite amcheck --suite pg_amcheck --suite pg_basebackup --suite pg_dump --suite authentication --suite libpq --suite commit_ts --suite pg_ctl --suite test_misc
- name: Test - contrib & extensions
run: |
cd \s\pg\b
$env:PG_TEST_USE_UNIX_SOCKETS = 1;
$env:PG_REGRESS_SOCK_DIR = "d:/sockets/"
meson test --no-rebuild --timeout-multiplier 2 --no-suite setup --no-suite recovery --no-suite subscription --no-suite ecpg --no-suite scripts --no-suite pg_verifybackup --no-suite pg_rewind --no-suite pg_combinebackup --no-suite pg_upgrade --no-suite amcheck --no-suite pg_amcheck --no-suite pg_basebackup --no-suite pg_dump --no-suite authentication --no-suite libpq --no-suite commit_ts --no-suite pg_ctl --no-suite test_misc
- name: Upload Test Results
if: ${{ !success() }}
uses: actions/upload-artifact@v7
with:
name: test_logs
path: |
\s\pg\b\testrun\**\*.log
\s\pg\b\testrun\**\regress_log_*
\s\pg\b\testrun\**\*.diffs
\s\pg\b\testrun\**\*.out
\s\pg\b\meson-logs\testlog.txt
- name: Install
run: |
cd \s\pg\b
meson install --quiet
- name: Checkout local actions
uses: actions/checkout@v6
with:
path: _src
sparse-checkout: |
.github/actions/generate-spdx
.github/actions/publish-release
sparse-checkout-cone-mode: false
- name: Copy dependency SPDX manifests
shell: pwsh
run: |
if (Test-Path /builddeps/MANIFESTS) {
New-Item -ItemType Directory -Path /postgresql/MANIFESTS -Force | Out-Null
Copy-Item /builddeps/MANIFESTS/*.spdx.json /postgresql/MANIFESTS/
}
- name: Generate SPDX manifest
uses: ./_src/.github/actions/generate-spdx
with:
package: postgresql-dev
install-dir: /postgresql
- name: Upload Source
uses: actions/upload-artifact@v7
with:
if-no-files-found: error
name: postgresql-dev-${{ env.POSTGRESQL-DEV_VERSION }}-src
path: postgresql-dev-${{ env.POSTGRESQL-DEV_VERSION }}.tar.gz
- name: Upload Binaries
uses: actions/upload-artifact@v7
with:
if-no-files-found: error
name: postgresql-dev-${{ env.POSTGRESQL-DEV_VERSION }}-windows-x86_64
path: /postgresql
- name: Upload Meson Log
if: always()
uses: actions/upload-artifact@v7
with:
if-no-files-found: error
name: meson_log
path: \s\pg\b\meson-logs\meson-log.txt
- name: Package Release Assets
shell: pwsh
run: |
Compress-Archive /postgresql /postgresql-${{ env.POSTGRESQL-DEV_VERSION }}-windows-x86_64-latest.zip
- name: Publish Release
# Only from the default branch; see the macOS leaves for why.
if: github.ref == 'refs/heads/main'
uses: ./_src/.github/actions/publish-release
with:
asset: /postgresql-${{ env.POSTGRESQL-DEV_VERSION }}-windows-x86_64-latest.zip
tag: postgresql-${{ env.POSTGRESQL-DEV_VERSION }}-windows-x86_64-latest
title: PostgreSQL ${{ env.POSTGRESQL-DEV_VERSION }} (Windows x86_64)
version: ${{ env.POSTGRESQL-DEV_VERSION }}