-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (54 loc) · 2.07 KB
/
windows-ci.yml
File metadata and controls
68 lines (54 loc) · 2.07 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
name: windows-ci
on:
push:
branches:
- main
- master
pull_request:
jobs:
build-test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup NuGet
uses: NuGet/setup-nuget@v2
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Restore
run: nuget restore .\IOBusMonitor.sln
- name: Build Debug
run: msbuild .\IOBusMonitor.sln /p:Configuration=Debug /p:Platform="Any CPU"
- name: Run tests
shell: powershell
run: |
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
if (Test-Path $vswhere) {
$vsRoot = & $vswhere -latest -products * -property installationPath
}
$searchRoots = @()
if ($vsRoot) { $searchRoots += (Join-Path $vsRoot "Common7\IDE") }
$searchRoots += @(
"${env:ProgramFiles}\Microsoft Visual Studio",
"${env:ProgramFiles(x86)}\Microsoft Visual Studio"
) | Where-Object { Test-Path $_ }
$vstest = $null
foreach ($root in $searchRoots) {
$candidate = Get-ChildItem $root -Recurse -Filter vstest.console.exe -ErrorAction SilentlyContinue |
Select-Object -First 1
if ($candidate) {
$vstest = $candidate.FullName
break
}
}
if (-not $vstest) { throw "vstest.console.exe not found" }
$testDllCandidates = @(
".\IOBusMonitorLib.Tests\bin\Debug\IOBusMonitorLib.Tests.dll",
".\IOBusMonitorLib.Tests\bin\Debug\net472\IOBusMonitorLib.Tests.dll",
".\IOBusMonitorLib.Tests\bin\Release\IOBusMonitorLib.Tests.dll",
".\IOBusMonitorLib.Tests\bin\Release\net472\IOBusMonitorLib.Tests.dll"
)
$testDll = $testDllCandidates | Where-Object { Test-Path $_ } | Select-Object -First 1
if (-not $testDll) {
throw "IOBusMonitorLib.Tests.dll not found in any expected output folder."
}
& $vstest $testDll