Skip to content

Commit 8a18b6e

Browse files
committed
Fix release packaging and test gating
1 parent 5efc256 commit 8a18b6e

3 files changed

Lines changed: 30 additions & 2 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,34 @@ jobs:
3333
- name: Build Release x64
3434
run: msbuild .\IOBusMonitor.sln /p:Configuration=Release /p:Platform="x64"
3535

36+
- name: Run tests
37+
shell: powershell
38+
run: |
39+
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
40+
if (Test-Path $vswhere) {
41+
$vsRoot = & $vswhere -latest -products * -property installationPath
42+
}
43+
44+
$searchRoots = @()
45+
if ($vsRoot) { $searchRoots += (Join-Path $vsRoot "Common7\IDE") }
46+
$searchRoots += @(
47+
"${env:ProgramFiles}\Microsoft Visual Studio",
48+
"${env:ProgramFiles(x86)}\Microsoft Visual Studio"
49+
) | Where-Object { Test-Path $_ }
50+
51+
$vstest = $null
52+
foreach ($root in $searchRoots) {
53+
$candidate = Get-ChildItem $root -Recurse -Filter vstest.console.exe -ErrorAction SilentlyContinue |
54+
Select-Object -First 1
55+
if ($candidate) {
56+
$vstest = $candidate.FullName
57+
break
58+
}
59+
}
60+
61+
if (-not $vstest) { throw "vstest.console.exe not found" }
62+
& $vstest .\IOBusMonitorLib.Tests\bin\Release\IOBusMonitorLib.Tests.dll
63+
3664
- name: Package release
3765
shell: powershell
3866
run: |

‎build/package-release.ps1‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function Copy-FilteredTree {
4040
}
4141

4242
$segments = $relativePath.Split('\')
43-
if (($segments | Where-Object { $excludedDirectories -contains $_ }).Count -gt 0) {
43+
if ($segments | Where-Object { $excludedDirectories -contains $_ }) {
4444
return
4545
}
4646

‎docs/RELEASE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ This additionally copies local `Settings`, `Data`, and `Logs` folders into the s
4444
The automated release flow lives in [`.github/workflows/release.yml`](../.github/workflows/release.yml).
4545

4646
- Push a tag such as `v1.0.0`
47-
- GitHub Actions restores packages, builds `Release|x64`, and runs `build/package-release.ps1 -GenerateChecksum`
47+
- GitHub Actions restores packages, builds `Release|x64`, runs the test project, and then runs `build/package-release.ps1 -GenerateChecksum`
4848
- The workflow creates a GitHub Release and uploads the ZIP plus SHA-256 file
4949
- You can also run the workflow manually from the Actions tab with `workflow_dispatch`
5050

0 commit comments

Comments
 (0)