Skip to content

Commit 3ae891b

Browse files
author
s-a
committed
fix: build native libs on windows
1 parent 12bb53f commit 3ae891b

File tree

4 files changed

+183
-234
lines changed

4 files changed

+183
-234
lines changed

.github/workflows/build-binaries.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ jobs:
7272
echo "📋 Checking generated native libraries:"
7373
find src/GrepSQL/runtimes/ -name "libpgquery_wrapper.*" -type f || echo "No native libraries found"
7474
75+
- name: Install protoc on Windows
76+
if: runner.os == 'Windows'
77+
run: choco install protoc -y
78+
79+
- name: Setup MSVC environment
80+
if: runner.os == 'Windows'
81+
uses: ilammy/msvc-dev-cmd@v1
82+
7583
- name: Build for Windows
7684
if: runner.os == 'Windows'
7785
shell: pwsh
@@ -83,9 +91,37 @@ jobs:
8391
if: runner.os != 'Windows'
8492
run: dotnet test --configuration Release --no-build --verbosity normal
8593

94+
- name: Restore test project (Windows)
95+
if: runner.os == 'Windows'
96+
run: dotnet restore "tests/GrepSQL.Tests/GrepSQL.Tests.csproj"
97+
98+
- name: Build test project (Windows)
99+
if: runner.os == 'Windows'
100+
run: dotnet build "tests/GrepSQL.Tests/GrepSQL.Tests.csproj" --configuration Release -p:Platform="Any CPU" --no-restore
101+
102+
- name: Copy native wrapper for tests (Windows)
103+
if: runner.os == 'Windows'
104+
shell: pwsh
105+
run: |
106+
Remove-Item Env:Platform -ErrorAction SilentlyContinue
107+
108+
$testOut = "tests\GrepSQL.Tests\bin\Release\net9.0"
109+
New-Item -ItemType Directory -Path $testOut -Force | Out-Null
110+
111+
Copy-Item `
112+
-Path "src\GrepSQL\runtimes\win-x64\native\libpgquery_wrapper.dll" `
113+
-Destination $testOut `
114+
-Force
115+
86116
- name: Test (Windows)
87117
if: runner.os == 'Windows'
88-
run: dotnet test --configuration Release --no-build --verbosity normal
118+
shell: pwsh
119+
run: |
120+
# Unset Platform so --no-build test finds the DLL
121+
Remove-Item Env:Platform -ErrorAction SilentlyContinue
122+
dotnet test "tests/GrepSQL.Tests/GrepSQL.Tests.csproj" `
123+
--configuration Release `
124+
--verbosity normal
89125
90126
- name: Publish GrepSQL Binary
91127
run: dotnet publish src/GrepSQL.CLI/GrepSQL/GrepSQL.csproj --configuration Release --runtime ${{ matrix.platform }} --self-contained true --output ./publish/${{ matrix.platform }} -p:PublishSingleFile=true -p:PublishTrimmed=true -p:IncludeNativeLibrariesForSelfExtract=true

0 commit comments

Comments
 (0)