Skip to content

Commit f989cd7

Browse files
committed
Enable tests for Windows x86 and ARM64 architectures
- Win32 (x86): register driver under WOW6432Node for 32-bit ODBC Driver Manager; use PSFirebird win-x86 RID for x86 Firebird binaries - Windows ARM64: test on windows-11-arm with x64 build + x64 Firebird via emulation (no ARM64 Firebird Windows binaries exist yet); keep cross-compile on windows-latest for ARM64 release artifact - Add FirebirdRid mapping: Win32->win-x86, ARM64->win-x64 (emulation) - Require PSFirebird >= 1.1.0 (x86/ARM64 support)
1 parent 2be9067 commit f989cd7

3 files changed

Lines changed: 42 additions & 9 deletions

File tree

.github/workflows/build-and-test.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ jobs:
2828
- os: windows-latest
2929
artifact-name: windows-arm64-binaries
3030
arch: ARM64
31+
build-only: true
32+
# Windows ARM64 tests: build as x64 and test via emulation
33+
# because Firebird has no ARM64 Windows binaries yet.
34+
- os: windows-11-arm
35+
arch: x64
3136
- os: ubuntu-22.04
3237
artifact-name: linux-x64-binaries
3338
- os: ubuntu-22.04-arm
@@ -49,7 +54,7 @@ jobs:
4954
run: sudo apt-get update && sudo apt-get install -y unixodbc unixodbc-dev
5055

5156
- name: Build, install and test
52-
if: ${{ !matrix.arch || matrix.arch == 'x64' }}
57+
if: ${{ !matrix.build-only }}
5358
shell: pwsh
5459
env:
5560
API_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -59,14 +64,17 @@ jobs:
5964
Invoke-Build test -Configuration Release @archArgs -File ./firebird-odbc-driver.build.ps1
6065
6166
- name: Build only (cross-compile)
62-
if: ${{ matrix.arch && matrix.arch != 'x64' }}
67+
if: ${{ matrix.build-only }}
6368
shell: pwsh
6469
env:
6570
API_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66-
run: Invoke-Build build -Configuration Release -Architecture ${{ matrix.arch }} -File ./firebird-odbc-driver.build.ps1
71+
run: |
72+
$archArgs = @{}
73+
if ('${{ matrix.arch }}') { $archArgs['Architecture'] = '${{ matrix.arch }}' }
74+
Invoke-Build build -Configuration Release @archArgs -File ./firebird-odbc-driver.build.ps1
6775
6876
- name: Upload artifacts (Windows)
69-
if: runner.os == 'Windows'
77+
if: runner.os == 'Windows' && matrix.artifact-name
7078
uses: actions/upload-artifact@v7
7179
with:
7280
name: ${{ matrix.artifact-name }}
@@ -76,7 +84,7 @@ jobs:
7684
build/Release/FirebirdODBC.pdb
7785
7886
- name: Upload artifacts (Linux)
79-
if: runner.os == 'Linux'
87+
if: runner.os == 'Linux' && matrix.artifact-name
8088
uses: actions/upload-artifact@v7
8189
with:
8290
name: ${{ matrix.artifact-name }}

firebird-odbc-driver.build.ps1

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ if ($IsWindowsOS) {
4242
$DriverPath = Join-Path $BuildDir $DriverFileName
4343
}
4444

45+
# Map build Architecture to PSFirebird RuntimeIdentifier (RID).
46+
# Used by build-test-databases to download the correct Firebird binaries.
47+
# ARM64 falls back to win-x64 because Firebird has no ARM64 Windows builds.
48+
$FirebirdRid = switch ($Architecture) {
49+
'Win32' { 'win-x86' }
50+
'ARM64' { 'win-x64' }
51+
default { '' }
52+
}
53+
4554
# Synopsis: Remove the build directory.
4655
task clean {
4756
remove $BuildDir
@@ -83,11 +92,17 @@ task build-test-databases {
8392
Import-Module PSFirebird
8493

8594
# Create or reuse Firebird environment
95+
$fbExtraParams = @{}
96+
if ($FirebirdRid) {
97+
$fbExtraParams['RuntimeIdentifier'] = $FirebirdRid
98+
print Cyan "Using Firebird RID: $FirebirdRid"
99+
}
100+
86101
if (Test-Path (Join-Path $envPath 'firebird.msg')) {
87102
$fb = Get-FirebirdEnvironment -Path $envPath
88103
print Green "Reusing existing Firebird environment: $envPath"
89104
} else {
90-
$fb = New-FirebirdEnvironment -Version $fbVersion -Path $envPath -Force
105+
$fb = New-FirebirdEnvironment -Version $fbVersion -Path $envPath -Force @fbExtraParams
91106
print Green "Firebird environment created: $envPath"
92107
}
93108

@@ -208,7 +223,13 @@ task . build
208223
#region Windows
209224

210225
function Install-WindowsDriver {
211-
$regBase = 'HKLM:\SOFTWARE\ODBC\ODBCINST.INI'
226+
# 32-bit (x86) ODBC drivers must register under WOW6432Node so the
227+
# 32-bit ODBC Driver Manager can find them.
228+
$regBase = if ($Architecture -eq 'Win32') {
229+
'HKLM:\SOFTWARE\WOW6432Node\ODBC\ODBCINST.INI'
230+
} else {
231+
'HKLM:\SOFTWARE\ODBC\ODBCINST.INI'
232+
}
212233
$regPath = Join-Path $regBase $DriverName
213234
$driversPath = Join-Path $regBase 'ODBC Drivers'
214235

@@ -233,7 +254,11 @@ function Install-WindowsDriver {
233254
}
234255

235256
function Uninstall-WindowsDriver {
236-
$regBase = 'HKLM:\SOFTWARE\ODBC\ODBCINST.INI'
257+
$regBase = if ($Architecture -eq 'Win32') {
258+
'HKLM:\SOFTWARE\WOW6432Node\ODBC\ODBCINST.INI'
259+
} else {
260+
'HKLM:\SOFTWARE\ODBC\ODBCINST.INI'
261+
}
237262
$regPath = Join-Path $regBase $DriverName
238263
$driversPath = Join-Path $regBase 'ODBC Drivers'
239264

install-prerequisites.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ if ($IsLinux) {
2121
Register-PackageSource -Name 'NuGet' -Location 'https://api.nuget.org/v3/index.json' -ProviderName NuGet -Force
2222
}
2323

24-
Install-Module -Name PSFirebird -Force -AllowClobber -Scope CurrentUser -Repository PSGallery
24+
Install-Module -Name PSFirebird -MinimumVersion 1.1.0 -Force -AllowClobber -Scope CurrentUser -Repository PSGallery
2525
Install-Module -Name InvokeBuild -Force -Scope CurrentUser

0 commit comments

Comments
 (0)