Skip to content

Commit a0b2b61

Browse files
author
Aliaksandr Adziareika
committed
Add openDAQ version validation on Windows runners
Replace dpkg + grep with dpkg-query for precise package name matching
1 parent 2f2aab2 commit a0b2b61

File tree

3 files changed

+136
-15
lines changed

3 files changed

+136
-15
lines changed

.github/actions/assert-opendaq-installed/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: 'Assert openDAQ Installed'
22
description: 'Verify that openDAQ package is installed on the system'
33

44
inputs:
5-
is-32bit:
5+
enable-32bit:
66
description: 'Check for 32-bit installation on Windows'
77
required: false
88
default: false
@@ -14,16 +14,16 @@ runs:
1414
if: runner.os == 'Linux'
1515
shell: bash
1616
run: |
17-
if ! dpkg -l | grep -q opendaq; then
18-
echo "::error::✗ Package not found"
17+
if ! dpkg-query -W -f='${Status}' opendaq 2>/dev/null | grep -qx "install ok installed"; then
18+
echo "::error::✗ Package not installed or in invalid state"
1919
exit 1
2020
fi
2121
2222
- name: Verify Installation (Windows)
2323
if: runner.os == 'Windows'
2424
shell: pwsh
2525
run: |
26-
if ("${{ inputs.is-32bit }}" -eq "true") {
26+
if ("${{ inputs.enable-32bit }}" -eq "true") {
2727
$installPath = "C:\Program Files (x86)\openDAQ"
2828
$binPath = "C:\Program Files (x86)\openDAQ\bin"
2929
} else {

.github/actions/assert-opendaq-version-equals/action.yml

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,59 @@ inputs:
55
expected-version:
66
description: 'Expected version (with v prefix and optional suffix like v3.30.0-rc)'
77
required: true
8+
enable-32bit:
9+
description: 'Check 32-bit installation on Windows'
10+
required: false
11+
default: false
812

913
runs:
1014
using: composite
1115
steps:
12-
- name: Verify Version
16+
- name: Verify Version (Linux)
17+
if: runner.os == 'Linux'
1318
shell: bash
1419
run: |
15-
ACTUAL_VERSION=$(dpkg -s opendaq | grep '^Version:' | awk '{print $2}')
20+
ACTUAL_VERSION=$(dpkg-query -W -f='${Version}' opendaq)
1621
EXPECTED_VERSION="${{ inputs.expected-version }}"
1722
EXPECTED_VERSION="${EXPECTED_VERSION#v}"
1823
EXPECTED_VERSION="${EXPECTED_VERSION%%-*}"
1924
20-
# Assert version matches
2125
if [[ "$ACTUAL_VERSION" != "$EXPECTED_VERSION"* ]]; then
2226
echo "::error::✗ Version mismatch: expected <$EXPECTED_VERSION> but was <$ACTUAL_VERSION>"
2327
exit 1
2428
fi
29+
30+
- name: Verify Version (Windows)
31+
if: runner.os == 'Windows'
32+
shell: pwsh
33+
run: |
34+
if ("${{ inputs.enable-32bit }}" -eq "true") {
35+
$binDir = "C:\Program Files (x86)\openDAQ\bin"
36+
$dllPath = "$binDir\opendaq-32-3.dll"
37+
} else {
38+
$binDir = "C:\Program Files\openDAQ\bin"
39+
$dllPath = "$binDir\opendaq-64-3.dll"
40+
}
41+
42+
if (-not (Test-Path $binDir)) {
43+
Write-Host "::error::✗ Directory not found: $binDir"
44+
exit 1
45+
}
46+
47+
if (-not (Test-Path $dllPath)) {
48+
Write-Host "::error::✗ DLL not found: $dllPath"
49+
Write-Host "Directory contents:"
50+
Get-ChildItem $binDir | ForEach-Object { Write-Host " $_" }
51+
exit 1
52+
}
53+
54+
$actualVersion = (Get-Item $dllPath).VersionInfo.FileVersion
55+
$expectedVersion = "${{ inputs.expected-version }}" -replace '^v', '' -replace '-.*$', ''
56+
57+
# FileVersion is like 3.31.0.0, compare first 3 components
58+
$actualMajorMinorPatch = ($actualVersion -split '\.')[0..2] -join '.'
59+
60+
if ($actualMajorMinorPatch -ne $expectedVersion) {
61+
Write-Host "::error::✗ Version mismatch: expected <$expectedVersion> but was <$actualMajorMinorPatch>"
62+
exit 1
63+
}

.github/workflows/test-install-framework.yml

Lines changed: 90 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
uses: ./.github/actions/assert-opendaq-installed
3838

3939
ubuntu-versions-explicit:
40-
name: Ubuntu Versions Explicit (${{ matrix.version }})
40+
name: Ubuntu ${{ matrix.version }}
4141
runs-on: ubuntu-latest
4242
strategy:
4343
fail-fast: false
@@ -46,7 +46,7 @@ jobs:
4646
version:
4747
- v3.30.0
4848
- v3.29.0-rc
49-
- v3.30.0
49+
- v3.20.4
5050
- v3.19.4-rc
5151
steps:
5252
- name: Checkout
@@ -67,7 +67,7 @@ jobs:
6767
expected-version: ${{ matrix.version }}
6868

6969
ubuntu-versions-aliased:
70-
name: Ubuntu Versions Aliased (${{ matrix.version }})
70+
name: Ubuntu ${{ matrix.version }}
7171
runs-on: ubuntu-latest
7272
strategy:
7373
fail-fast: false
@@ -100,21 +100,26 @@ jobs:
100100
- name: Checkout
101101
uses: actions/checkout@v4
102102

103-
- name: Install Framework (default version)
103+
- name: Install Framework
104104
id: install
105105
uses: ./install-framework
106106

107107
- name: Verify Framework Installed
108108
uses: ./.github/actions/assert-opendaq-installed
109109

110-
windows-autodetect-version-32bit:
111-
name: Windows Autodetect Version (32-bit)
110+
- name: Verify Framework Version
111+
uses: ./.github/actions/assert-opendaq-version-equals
112+
with:
113+
expected-version: ${{ steps.install.outputs.version }}
114+
115+
windows-autodetect-32bit:
116+
name: Windows Autodetect (32-bit)
112117
runs-on: windows-latest
113118
steps:
114119
- name: Checkout
115120
uses: actions/checkout@v4
116121

117-
- name: Install Framework (32-bit)
122+
- name: Install Framework
118123
id: install
119124
uses: ./install-framework
120125
with:
@@ -123,4 +128,81 @@ jobs:
123128
- name: Verify Framework Installed
124129
uses: ./.github/actions/assert-opendaq-installed
125130
with:
126-
is-32bit: true
131+
enable-32bit: true
132+
133+
- name: Verify Framework Version
134+
uses: ./.github/actions/assert-opendaq-version-equals
135+
with:
136+
expected-version: ${{ steps.install.outputs.version }}
137+
enable-32bit: true
138+
139+
windows-versions-explicit:
140+
name: Windows ${{ matrix.version }} (${{ matrix.enable-32bit && '32-bit' || '64-bit' }})
141+
runs-on: windows-latest
142+
strategy:
143+
fail-fast: false
144+
max-parallel: 1
145+
matrix:
146+
version:
147+
- v3.30.0
148+
- v3.29.0-rc
149+
- v3.20.4
150+
- v3.19.4-rc
151+
enable-32bit:
152+
- true
153+
- false
154+
steps:
155+
- name: Checkout
156+
uses: actions/checkout@v4
157+
158+
- name: Install Framework
159+
id: install
160+
uses: ./install-framework
161+
with:
162+
version: ${{ matrix.version }}
163+
enable-32bit: ${{ matrix.enable-32bit }}
164+
165+
- name: Verify Framework Installed
166+
uses: ./.github/actions/assert-opendaq-installed
167+
with:
168+
enable-32bit: ${{ matrix.enable-32bit }}
169+
170+
- name: Verify Framework Version
171+
uses: ./.github/actions/assert-opendaq-version-equals
172+
with:
173+
expected-version: ${{ matrix.version }}
174+
enable-32bit: ${{ matrix.enable-32bit }}
175+
176+
windows-versions-aliased:
177+
name: Windows ${{ matrix.version }} (${{ matrix.enable-32bit && '32-bit' || '64-bit' }})
178+
runs-on: windows-latest
179+
strategy:
180+
fail-fast: false
181+
matrix:
182+
version:
183+
- latest
184+
- latest-stable
185+
enable-32bit:
186+
- true
187+
- false
188+
steps:
189+
- name: Checkout
190+
uses: actions/checkout@v4
191+
192+
- name: Install Framework
193+
id: install
194+
uses: ./install-framework
195+
with:
196+
version: ${{ matrix.version }}
197+
enable-32bit: ${{ matrix.enable-32bit }}
198+
199+
- name: Verify Framework Installed
200+
uses: ./.github/actions/assert-opendaq-installed
201+
with:
202+
enable-32bit: ${{ matrix.enable-32bit }}
203+
204+
- name: Verify Framework Version
205+
uses: ./.github/actions/assert-opendaq-version-equals
206+
with:
207+
expected-version: ${{ steps.install.outputs.version }}
208+
enable-32bit: ${{ matrix.enable-32bit }}

0 commit comments

Comments
 (0)