-
Notifications
You must be signed in to change notification settings - Fork 19
279 lines (234 loc) · 8.98 KB
/
release.yml
File metadata and controls
279 lines (234 loc) · 8.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
workflow_dispatch: # allows manual retrigger via: gh workflow run Release --ref v<tag>
permissions:
contents: write
jobs:
build-and-test:
uses: ./.github/workflows/build-and-test.yml
release:
needs: build-and-test
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Get version from tag
id: get_version
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Detect prerelease
id: detect_prerelease
run: |
if [[ "${{ github.ref }}" =~ -[a-zA-Z] ]]; then
echo "is_prerelease=true" >> $GITHUB_OUTPUT
else
echo "is_prerelease=false" >> $GITHUB_OUTPUT
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v2.6.1
with:
name: Firebird ODBC Driver v${{ steps.get_version.outputs.version }}
draft: false
prerelease: ${{ steps.detect_prerelease.outputs.is_prerelease }}
generate_release_notes: true
package-windows:
needs: [build-and-test, release]
runs-on: windows-2022
strategy:
matrix:
include:
- artifact: windows-x64-binaries
wix-arch: x64
target-arch: x64
suffix: win-x64
- artifact: windows-x86-binaries
wix-arch: x86
target-arch: x86
suffix: win-x86
- artifact: windows-arm64-binaries
wix-arch: arm64
target-arch: arm64
suffix: win-arm64
steps:
- uses: actions/checkout@v6
with:
sparse-checkout: |
installer
README.md
- name: Download Windows artifacts
uses: actions/download-artifact@v8
with:
name: ${{ matrix.artifact }}
path: artifacts
- name: Download Windows x86 artifacts (bundled in x64 installer)
if: matrix.target-arch == 'x64'
uses: actions/download-artifact@v8
with:
name: windows-x86-binaries
path: artifacts-x86
- name: Install WiX Toolset
run: dotnet tool install --global wix --version 5.0.2
- name: Build MSI installer
shell: pwsh
run: |
$version = "${{ needs.release.outputs.version }}"
# MSI ProductVersion requires exactly 3 or 4 numeric parts — strip any prerelease suffix
$msiVersion = ($version -replace '-.*', '') + '.0'
$dllPath = Resolve-Path "artifacts/FirebirdODBC.dll"
$extraArgs = @()
if ('${{ matrix.target-arch }}' -eq 'x64') {
$x86DllPath = Resolve-Path "artifacts-x86/FirebirdODBC.dll"
$extraArgs = @('-d', "DriverPathX86=$x86DllPath")
}
wix build `
-d ProductVersion=$msiVersion `
-d DriverPath="$dllPath" `
-d Configuration=Release `
-d TargetArch=${{ matrix.target-arch }} `
-arch ${{ matrix.wix-arch }} `
@extraArgs `
-o "firebird-odbc-driver-$version-${{ matrix.suffix }}.msi" `
installer/Product.wxs
- name: Package Windows ZIP
shell: pwsh
run: |
$version = "${{ needs.release.outputs.version }}"
$packageDir = "package-windows"
New-Item -ItemType Directory -Path $packageDir -Force | Out-Null
Copy-Item "artifacts/FirebirdODBC.dll" -Destination $packageDir
Copy-Item "artifacts/FirebirdODBC.lib" -Destination $packageDir -ErrorAction SilentlyContinue
Copy-Item "README.md" -Destination $packageDir -ErrorAction SilentlyContinue
# x64 package also includes the 32-bit DLL for WoW64 applications
if ('${{ matrix.target-arch }}' -eq 'x64') {
$x86Dir = Join-Path $packageDir "x86"
New-Item -ItemType Directory -Path $x86Dir -Force | Out-Null
Copy-Item "artifacts-x86/FirebirdODBC.dll" -Destination $x86Dir
}
Compress-Archive -Path "$packageDir/*" `
-DestinationPath "firebird-odbc-driver-$version-${{ matrix.suffix }}.zip"
- name: Upload release assets
uses: softprops/action-gh-release@v2.6.1
with:
files: |
firebird-odbc-driver-${{ needs.release.outputs.version }}-${{ matrix.suffix }}.msi
firebird-odbc-driver-${{ needs.release.outputs.version }}-${{ matrix.suffix }}.zip
- name: Upload MSI as workflow artifact (for installer tests)
uses: actions/upload-artifact@v7
with:
name: msi-${{ matrix.suffix }}
path: firebird-odbc-driver-${{ needs.release.outputs.version }}-${{ matrix.suffix }}.msi
test-installer:
needs: [package-windows]
runs-on: windows-2022
strategy:
matrix:
include:
- suffix: win-x64
expect-x86: true
- suffix: win-x86
expect-x86: false
# ARM64 MSI cannot be installed on x64 runners — skip
steps:
- name: Download MSI
uses: actions/download-artifact@v8
with:
name: msi-${{ matrix.suffix }}
path: msi
- name: Find MSI file
id: find-msi
shell: pwsh
run: |
$msi = Get-ChildItem -Path msi -Filter '*.msi' -Recurse | Select-Object -First 1
if (-not $msi) { throw "No MSI file found" }
"msi_path=$($msi.FullName)" >> $env:GITHUB_OUTPUT
Write-Host "Found MSI: $($msi.FullName)"
- name: Install MSI
shell: pwsh
run: |
$proc = Start-Process msiexec.exe -ArgumentList "/i `"${{ steps.find-msi.outputs.msi_path }}`" /qn /l*v install.log" -Wait -PassThru
if ($proc.ExitCode -ne 0) {
Get-Content install.log -Tail 50
throw "MSI install failed with exit code $($proc.ExitCode)"
}
- name: Verify ODBC driver registration
shell: pwsh
run: |
$driverName = 'Firebird ODBC Driver'
# Check 64-bit or 32-bit native registration
$drivers = Get-OdbcDriver -Name $driverName -ErrorAction SilentlyContinue
if (-not $drivers) {
throw "ODBC driver '$driverName' not found after install"
}
Write-Host "Found ODBC drivers:"
$drivers | Format-Table -AutoSize
# For x64 installer, verify both 64-bit and 32-bit registrations
if ('${{ matrix.expect-x86 }}' -eq 'true') {
$reg64 = Test-Path "HKLM:\SOFTWARE\ODBC\ODBCINST.INI\$driverName"
$reg32 = Test-Path "HKLM:\SOFTWARE\WOW6432Node\ODBC\ODBCINST.INI\$driverName"
if (-not $reg64) { throw "64-bit ODBC registration missing" }
if (-not $reg32) { throw "32-bit (WOW6432Node) ODBC registration missing" }
$dll64 = Join-Path $env:SystemRoot 'System32' 'FirebirdODBC.dll'
$dll32 = Join-Path $env:SystemRoot 'SysWOW64' 'FirebirdODBC.dll'
if (-not (Test-Path $dll64)) { throw "64-bit DLL missing: $dll64" }
if (-not (Test-Path $dll32)) { throw "32-bit DLL missing: $dll32" }
Write-Host "PASS: Both 64-bit and 32-bit drivers installed correctly"
}
- name: Uninstall MSI
shell: pwsh
run: |
$proc = Start-Process msiexec.exe -ArgumentList "/x `"${{ steps.find-msi.outputs.msi_path }}`" /qn /l*v uninstall.log" -Wait -PassThru
if ($proc.ExitCode -ne 0) {
Get-Content uninstall.log -Tail 50
throw "MSI uninstall failed with exit code $($proc.ExitCode)"
}
- name: Verify clean uninstall
shell: pwsh
run: |
$driverName = 'Firebird ODBC Driver'
$drivers = Get-OdbcDriver -Name $driverName -ErrorAction SilentlyContinue
if ($drivers) {
throw "ODBC driver '$driverName' still registered after uninstall"
}
Write-Host "PASS: Driver cleanly uninstalled"
package-linux:
needs: [build-and-test, release]
runs-on: ubuntu-latest
strategy:
matrix:
include:
- artifact: linux-x64-binaries
suffix: linux-x64
- artifact: linux-arm64-binaries
suffix: linux-arm64
steps:
- uses: actions/checkout@v6
with:
sparse-checkout: README.md
- name: Download Linux artifacts
uses: actions/download-artifact@v8
with:
name: ${{ matrix.artifact }}
path: artifacts
- name: Package Linux build
run: |
version="${{ needs.release.outputs.version }}"
packageDir="package-linux"
mkdir -p "$packageDir"
cp artifacts/libOdbcFb.so "$packageDir/"
cp README.md "$packageDir/" 2>/dev/null || true
cat > "$packageDir/odbcinst.ini.sample" << 'EOF'
[Firebird ODBC Driver]
Description = Firebird ODBC Driver
Driver = /usr/local/lib/odbc/libOdbcFb.so
Setup = /usr/local/lib/odbc/libOdbcFb.so
FileUsage = 1
EOF
cd "$packageDir"
tar -czf "../firebird-odbc-driver-${version}-${{ matrix.suffix }}.tar.gz" *
- name: Upload release assets
uses: softprops/action-gh-release@v2.6.1
with:
files: |
firebird-odbc-driver-${{ needs.release.outputs.version }}-${{ matrix.suffix }}.tar.gz