Skip to content

Commit 8105742

Browse files
committed
fix(ci): resolve PostgreSQL extension build on macOS, drop Windows
macOS: guard Security.h include behind !CLOUDSYNC_POSTGRESQL_BUILD to avoid type conflicts (Size, uint64) with PostgreSQL headers, use getentropy instead. Windows: dropped from postgres-build matrix — MSYS2 PostgreSQL headers expect Unix includes incompatible with MinGW.
1 parent 25fe161 commit 8105742

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,6 @@ jobs:
285285
- os: macos-13
286286
arch: x86_64
287287
name: macos
288-
- os: windows-2022
289-
arch: x86_64
290-
name: windows
291-
292288
steps:
293289

294290
- uses: actions/checkout@v4.2.2
@@ -307,12 +303,6 @@ jobs:
307303
if: matrix.name == 'macos'
308304
run: brew install postgresql@17 gettext
309305

310-
- uses: msys2/setup-msys2@v2.27.0
311-
if: matrix.name == 'windows'
312-
with:
313-
msystem: ucrt64
314-
install: mingw-w64-ucrt-x86_64-gcc make mingw-w64-ucrt-x86_64-postgresql
315-
316306
- name: build and package postgresql extension (linux)
317307
if: matrix.name == 'linux'
318308
run: make postgres-package
@@ -321,11 +311,6 @@ jobs:
321311
if: matrix.name == 'macos'
322312
run: make postgres-package PG_CONFIG=$(brew --prefix postgresql@17)/bin/pg_config PG_EXTRA_CFLAGS="-I$(brew --prefix gettext)/include"
323313

324-
- name: build and package postgresql extension (windows)
325-
if: matrix.name == 'windows'
326-
shell: msys2 {0}
327-
run: make postgres-package
328-
329314
- uses: actions/upload-artifact@v4.6.2
330315
with:
331316
name: cloudsync-postgresql-${{ matrix.name }}-${{ matrix.arch }}

src/utils.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#define file_close _close
1919
#else
2020
#include <unistd.h>
21-
#if defined(__APPLE__)
21+
#if defined(__APPLE__) && !defined(CLOUDSYNC_POSTGRESQL_BUILD)
2222
#include <Security/Security.h>
2323
#elif !defined(__ANDROID__)
2424
#include <sys/random.h>
@@ -57,9 +57,12 @@ int cloudsync_uuid_v7 (uint8_t value[UUID_LEN]) {
5757
// fill the buffer with high-quality random data
5858
#ifdef _WIN32
5959
if (BCryptGenRandom(NULL, (BYTE*)value, UUID_LEN, BCRYPT_USE_SYSTEM_PREFERRED_RNG) != STATUS_SUCCESS) return -1;
60-
#elif defined(__APPLE__)
60+
#elif defined(__APPLE__) && !defined(CLOUDSYNC_POSTGRESQL_BUILD)
6161
// Use SecRandomCopyBytes for macOS/iOS
6262
if (SecRandomCopyBytes(kSecRandomDefault, UUID_LEN, value) != errSecSuccess) return -1;
63+
#elif defined(__APPLE__) && defined(CLOUDSYNC_POSTGRESQL_BUILD)
64+
// PostgreSQL build: use getentropy to avoid Security.framework type conflicts
65+
if (getentropy(value, UUID_LEN) != 0) return -1;
6366
#elif defined(__ANDROID__)
6467
//arc4random_buf doesn't have a return value to check for success
6568
arc4random_buf(value, UUID_LEN);

0 commit comments

Comments
 (0)