Skip to content

Commit 46670ac

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 46670ac

3 files changed

Lines changed: 56 additions & 10 deletions

File tree

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ jobs:
2828
- os: windows-latest
2929
artifact-name: windows-arm64-binaries
3030
arch: ARM64
31+
build-only: true
32+
# Windows ARM64 native: build + test using Firebird snapshot-master (win-arm64).
33+
# Firebird does not publish official ARM64 Windows releases; snapshots do.
34+
- os: windows-11-arm
3135
- os: ubuntu-22.04
3236
artifact-name: linux-x64-binaries
3337
- os: ubuntu-22.04-arm
@@ -49,7 +53,7 @@ jobs:
4953
run: sudo apt-get update && sudo apt-get install -y unixodbc unixodbc-dev
5054

5155
- name: Build, install and test
52-
if: ${{ !matrix.arch || matrix.arch == 'x64' }}
56+
if: ${{ !matrix.build-only }}
5357
shell: pwsh
5458
env:
5559
API_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -59,14 +63,17 @@ jobs:
5963
Invoke-Build test -Configuration Release @archArgs -File ./firebird-odbc-driver.build.ps1
6064
6165
- name: Build only (cross-compile)
62-
if: ${{ matrix.arch && matrix.arch != 'x64' }}
66+
if: ${{ matrix.build-only }}
6367
shell: pwsh
6468
env:
6569
API_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66-
run: Invoke-Build build -Configuration Release -Architecture ${{ matrix.arch }} -File ./firebird-odbc-driver.build.ps1
70+
run: |
71+
$archArgs = @{}
72+
if ('${{ matrix.arch }}') { $archArgs['Architecture'] = '${{ matrix.arch }}' }
73+
Invoke-Build build -Configuration Release @archArgs -File ./firebird-odbc-driver.build.ps1
6774
6875
- name: Upload artifacts (Windows)
69-
if: runner.os == 'Windows'
76+
if: runner.os == 'Windows' && matrix.artifact-name
7077
uses: actions/upload-artifact@v7
7178
with:
7279
name: ${{ matrix.artifact-name }}
@@ -76,7 +83,7 @@ jobs:
7683
build/Release/FirebirdODBC.pdb
7784
7885
- name: Upload artifacts (Linux)
79-
if: runner.os == 'Linux'
86+
if: runner.os == 'Linux' && matrix.artifact-name
8087
uses: actions/upload-artifact@v7
8188
with:
8289
name: ${{ matrix.artifact-name }}

firebird-odbc-driver.build.ps1

Lines changed: 43 additions & 4 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) and optional branch.
46+
# Used by build-test-databases to download the correct Firebird binaries.
47+
$FirebirdRid = switch ($Architecture) {
48+
'Win32' { 'win-x86' }
49+
default { '' }
50+
}
51+
$FirebirdBranch = ''
52+
53+
# On native ARM64 Windows (no Architecture override = native ARM64 build),
54+
# use the Firebird snapshot-master branch which publishes win-arm64 binaries.
55+
if (-not $Architecture -and $IsWindowsOS -and
56+
[System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq 'Arm64') {
57+
$FirebirdRid = 'win-arm64'
58+
$FirebirdBranch = 'master'
59+
}
60+
4561
# Synopsis: Remove the build directory.
4662
task clean {
4763
remove $BuildDir
@@ -69,7 +85,8 @@ task build {
6985
# Synopsis: Create Firebird test databases.
7086
task build-test-databases {
7187
$fbVersion = '5.0.2'
72-
$envPath = '/fbodbc-tests/fb502'
88+
# Use a distinct env path for snapshot (branch) builds to avoid stale cache.
89+
$envPath = if ($FirebirdBranch) { "/fbodbc-tests/snapshot-$FirebirdBranch" } else { '/fbodbc-tests/fb502' }
7390
$dbPathUtf8 = '/fbodbc-tests/TEST.FB50.FDB'
7491
$dbPathIso = '/fbodbc-tests/TEST-ISO.FB50.FDB'
7592

@@ -83,11 +100,23 @@ task build-test-databases {
83100
Import-Module PSFirebird
84101

85102
# Create or reuse Firebird environment
103+
$fbExtraParams = @{}
104+
if ($FirebirdRid) {
105+
$fbExtraParams['RuntimeIdentifier'] = $FirebirdRid
106+
print Cyan "Using Firebird RID: $FirebirdRid"
107+
}
108+
if ($FirebirdBranch) {
109+
$fbExtraParams['Branch'] = $FirebirdBranch
110+
print Cyan "Using Firebird snapshot branch: $FirebirdBranch"
111+
} else {
112+
$fbExtraParams['Version'] = $fbVersion
113+
}
114+
86115
if (Test-Path (Join-Path $envPath 'firebird.msg')) {
87116
$fb = Get-FirebirdEnvironment -Path $envPath
88117
print Green "Reusing existing Firebird environment: $envPath"
89118
} else {
90-
$fb = New-FirebirdEnvironment -Version $fbVersion -Path $envPath -Force
119+
$fb = New-FirebirdEnvironment -Path $envPath -Force @fbExtraParams
91120
print Green "Firebird environment created: $envPath"
92121
}
93122

@@ -208,7 +237,13 @@ task . build
208237
#region Windows
209238

210239
function Install-WindowsDriver {
211-
$regBase = 'HKLM:\SOFTWARE\ODBC\ODBCINST.INI'
240+
# 32-bit (x86) ODBC drivers must register under WOW6432Node so the
241+
# 32-bit ODBC Driver Manager can find them.
242+
$regBase = if ($Architecture -eq 'Win32') {
243+
'HKLM:\SOFTWARE\WOW6432Node\ODBC\ODBCINST.INI'
244+
} else {
245+
'HKLM:\SOFTWARE\ODBC\ODBCINST.INI'
246+
}
212247
$regPath = Join-Path $regBase $DriverName
213248
$driversPath = Join-Path $regBase 'ODBC Drivers'
214249

@@ -233,7 +268,11 @@ function Install-WindowsDriver {
233268
}
234269

235270
function Uninstall-WindowsDriver {
236-
$regBase = 'HKLM:\SOFTWARE\ODBC\ODBCINST.INI'
271+
$regBase = if ($Architecture -eq 'Win32') {
272+
'HKLM:\SOFTWARE\WOW6432Node\ODBC\ODBCINST.INI'
273+
} else {
274+
'HKLM:\SOFTWARE\ODBC\ODBCINST.INI'
275+
}
237276
$regPath = Join-Path $regBase $DriverName
238277
$driversPath = Join-Path $regBase 'ODBC Drivers'
239278

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.2.0 -Force -AllowClobber -Scope CurrentUser -Repository PSGallery
2525
Install-Module -Name InvokeBuild -Force -Scope CurrentUser

0 commit comments

Comments
 (0)