1
1
name : .NET Test 🚀
2
2
3
- on : [push, pull_request]
3
+ on : [ push, pull_request ]
4
4
5
5
jobs :
6
6
build :
@@ -33,19 +33,10 @@ jobs:
33
33
with :
34
34
nuget-version : ' 5.x'
35
35
36
- # 4. Set MSBuild Path (for .NET Framework)
37
- - name : Set MSBuild Path
36
+ # 4. Add MSBuild to PATH (for .NET Framework)
37
+ - name : Add MSBuild to PATH
38
38
if : contains(matrix.framework, 'v')
39
- shell : pwsh
40
- run : |
41
- Write-Host "🔧 Setting MSBuild path for .NET Framework..."
42
- $msbuildPath = &"C:\Program Files\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe
43
- if (-not $msbuildPath) {
44
- Write-Error "❌ MSBuild not found!"
45
- exit 1
46
- }
47
- Write-Host "✅ MSBuild found at: $msbuildPath"
48
- echo "MSBUILD_PATH=$msbuildPath" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8
39
+ uses : microsoft/setup-msbuild@v2
49
40
50
41
# 5. Restore Dependencies
51
42
- name : Restore Dependencies
60
51
shell : pwsh
61
52
run : |
62
53
Write-Host "⚒️ Building for: ${{ matrix.framework }}"
63
- if ("${{ matrix.framework }}" -notlike "v*") { dotnet build --configuration Release --no-restore }
64
- if ("${{ matrix.framework }}" -like "v*") { & $env:MSBUILD_PATH CloudinaryDotNet.sln /p:Configuration=Release /p:TargetFrameworkVersion=${{ matrix.framework }} }
54
+ if ("${{ matrix.framework }}" -notlike "v*") {
55
+ dotnet build --configuration Release --no-restore
56
+ }
57
+ if ("${{ matrix.framework }}" -like "v*") {
58
+ msbuild CloudinaryDotNet.sln /p:Configuration=Release /p:TargetFrameworkVersion=${{ matrix.framework }}
59
+ }
65
60
66
61
# 7. Run before_build.ps1
67
62
- name : Run before_build.ps1
@@ -73,13 +68,21 @@ jobs:
73
68
shell : pwsh
74
69
run : |
75
70
Write-Host "🧪 Running Unit Tests for: ${{ matrix.framework }}"
76
- if ("${{ matrix.framework }}" -notlike "v*") { dotnet test "./CloudinaryDotNet.Tests/CloudinaryDotNet.Tests.csproj" --configuration Release --no-build }
77
- if ("${{ matrix.framework }}" -like "v*") { vstest.console.exe "./CloudinaryDotNet.Tests/bin/Release/${{ matrix.framework }}/CloudinaryDotNet.Tests.dll" /Framework:${{ matrix.framework }} }
71
+ if ("${{ matrix.framework }}" -notlike "v*") {
72
+ dotnet test "./CloudinaryDotNet.Tests/CloudinaryDotNet.Tests.csproj" --configuration Release --no-build
73
+ }
74
+ if ("${{ matrix.framework }}" -like "v*") {
75
+ vstest.console.exe "./CloudinaryDotNet.Tests/bin/Release/${{ matrix.framework }}/CloudinaryDotNet.Tests.dll" /Framework:${{ matrix.framework }}
76
+ }
78
77
79
78
# 9. Run Integration Tests
80
79
- name : Run Integration Tests
81
80
shell : pwsh
82
81
run : |
83
82
Write-Host "🧪 Running Integration Tests for: ${{ matrix.framework }}"
84
- if ("${{ matrix.framework }}" -notlike "v*") { dotnet test "./CloudinaryDotNet.IntegrationTests/CloudinaryDotNet.IntegrationTests.csproj" --configuration Release --no-build }
85
- if ("${{ matrix.framework }}" -like "v*") { vstest.console.exe "./CloudinaryDotNet.IntegrationTests/bin/Release/${{ matrix.framework }}/CloudinaryDotNet.IntegrationTests.dll" /Framework:${{ matrix.framework }} }
83
+ if ("${{ matrix.framework }}" -notlike "v*") {
84
+ dotnet test "./CloudinaryDotNet.IntegrationTests/CloudinaryDotNet.IntegrationTests.csproj" --configuration Release --no-build
85
+ }
86
+ if ("${{ matrix.framework }}" -like "v*") {
87
+ vstest.console.exe "./CloudinaryDotNet.IntegrationTests/bin/Release/${{ matrix.framework }}/CloudinaryDotNet.IntegrationTests.dll" /Framework:${{ matrix.framework }}
88
+ }
0 commit comments