Skip to content

Commit 22801d7

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 22801d7

3 files changed

Lines changed: 49 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: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,22 @@ 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+
54+
# On ARM64 Windows hosts building for x64 (emulation), explicitly request
55+
# win-x64 Firebird since PSFirebird would otherwise auto-detect win-arm64.
56+
if (-not $FirebirdRid -and $IsWindowsOS -and
57+
[System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq 'Arm64') {
58+
$FirebirdRid = 'win-x64'
59+
}
60+
4561
# Synopsis: Remove the build directory.
4662
task clean {
4763
remove $BuildDir
@@ -83,11 +99,17 @@ task build-test-databases {
8399
Import-Module PSFirebird
84100

85101
# Create or reuse Firebird environment
102+
$fbExtraParams = @{}
103+
if ($FirebirdRid) {
104+
$fbExtraParams['RuntimeIdentifier'] = $FirebirdRid
105+
print Cyan "Using Firebird RID: $FirebirdRid"
106+
}
107+
86108
if (Test-Path (Join-Path $envPath 'firebird.msg')) {
87109
$fb = Get-FirebirdEnvironment -Path $envPath
88110
print Green "Reusing existing Firebird environment: $envPath"
89111
} else {
90-
$fb = New-FirebirdEnvironment -Version $fbVersion -Path $envPath -Force
112+
$fb = New-FirebirdEnvironment -Version $fbVersion -Path $envPath -Force @fbExtraParams
91113
print Green "Firebird environment created: $envPath"
92114
}
93115

@@ -208,7 +230,13 @@ task . build
208230
#region Windows
209231

210232
function Install-WindowsDriver {
211-
$regBase = 'HKLM:\SOFTWARE\ODBC\ODBCINST.INI'
233+
# 32-bit (x86) ODBC drivers must register under WOW6432Node so the
234+
# 32-bit ODBC Driver Manager can find them.
235+
$regBase = if ($Architecture -eq 'Win32') {
236+
'HKLM:\SOFTWARE\WOW6432Node\ODBC\ODBCINST.INI'
237+
} else {
238+
'HKLM:\SOFTWARE\ODBC\ODBCINST.INI'
239+
}
212240
$regPath = Join-Path $regBase $DriverName
213241
$driversPath = Join-Path $regBase 'ODBC Drivers'
214242

@@ -233,7 +261,11 @@ function Install-WindowsDriver {
233261
}
234262

235263
function Uninstall-WindowsDriver {
236-
$regBase = 'HKLM:\SOFTWARE\ODBC\ODBCINST.INI'
264+
$regBase = if ($Architecture -eq 'Win32') {
265+
'HKLM:\SOFTWARE\WOW6432Node\ODBC\ODBCINST.INI'
266+
} else {
267+
'HKLM:\SOFTWARE\ODBC\ODBCINST.INI'
268+
}
237269
$regPath = Join-Path $regBase $DriverName
238270
$driversPath = Join-Path $regBase 'ODBC Drivers'
239271

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)