Skip to content

Commit 18e4ab2

Browse files
Test multiple frameworks
1 parent a5851b9 commit 18e4ab2

File tree

1 file changed

+50
-18
lines changed

1 file changed

+50
-18
lines changed

.github/workflows/test.yaml

+50-18
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,66 @@ jobs:
66
build:
77
runs-on: windows-latest
88

9+
strategy:
10+
matrix:
11+
framework:
12+
- net9.0
13+
- net8.0
14+
- net481
15+
- net452
16+
917
steps:
10-
- uses: actions/checkout@v4
11-
- uses: actions/setup-dotnet@v4
18+
# 1. Checkout repository
19+
- name: Checkout Code
20+
uses: actions/checkout@v4
21+
22+
# 2. Setup .NET SDK (for .NET Core / Modern .NET)
23+
- name: Setup .NET SDK
24+
if: startsWith(matrix.framework, 'net') && !startsWith(matrix.framework, 'net4')
25+
uses: actions/setup-dotnet@v4
26+
with:
27+
dotnet-version: ${{ matrix.framework }}
28+
29+
# 3. Install NuGet CLI (for .NET Framework)
30+
- name: Install NuGet CLI
31+
if: startsWith(matrix.framework, 'net4')
32+
uses: NuGet/setup-nuget@v2
1233
with:
13-
dotnet-version: '9.0.x'
34+
nuget-version: '5.x'
1435

36+
# 4. Restore Dependencies
1537
- name: Restore Dependencies
16-
run: dotnet restore
38+
shell: pwsh
39+
run: |
40+
Write-Host "🔄 Restoring dependencies for: ${{ matrix.framework }}"
41+
if ("${{ matrix.framework }}" -match "net[5-9]+") { dotnet restore }
42+
if ("${{ matrix.framework }}" -match "net[1-4]\d+") { nuget.exe restore CloudinaryDotNet.sln }
1743
18-
- name: Before Build
44+
# 5. Build Solution
45+
- name: Build Solution
1946
shell: pwsh
20-
run: ./before_build.ps1
47+
run: |
48+
Write-Host "⚒️ Building for: ${{ matrix.framework }}"
49+
if ("${{ matrix.framework }}" -match "net[5-9]+") { dotnet build --configuration Release --no-restore }
50+
if ("${{ matrix.framework }}" -match "net[1-4]\d+") { msbuild CloudinaryDotNet.sln /p:Configuration=Release }
2151
22-
- name: Build
23-
run: dotnet build --configuration Release --no-restore
52+
# 6. Run before_build.ps1
53+
- name: Run before_build.ps1
54+
shell: pwsh
55+
run: . ./before_build.ps1
2456

25-
- name: Unit Tests
57+
# 7. Run Unit Tests
58+
- name: Run Unit Tests
2659
shell: pwsh
2760
run: |
28-
dotnet test "./CloudinaryDotNet.Tests/CloudinaryDotNet.Tests.csproj" `
29-
--configuration Release `
30-
--no-build `
31-
--logger:"trx"
61+
Write-Host "🧪 Running Unit Tests for: ${{ matrix.framework }}"
62+
if ("${{ matrix.framework }}" -match "net[5-9]+") { dotnet test "./CloudinaryDotNet.Tests/CloudinaryDotNet.Tests.csproj" --configuration Release --no-build }
63+
if ("${{ matrix.framework }}" -match "net[1-4]\d+") { vstest.console.exe "./CloudinaryDotNet.Tests/bin/Release/${{ matrix.framework }}/CloudinaryDotNet.Tests.dll" }
3264
33-
- name: Integration Tests
65+
# 8. Run Integration Tests
66+
- name: Run Integration Tests
3467
shell: pwsh
3568
run: |
36-
dotnet test "./CloudinaryDotNet.IntegrationTests/CloudinaryDotNet.IntegrationTests.csproj" `
37-
--configuration Release `
38-
--no-build `
39-
--logger:"trx"
69+
Write-Host "🧪 Running Integration Tests for: ${{ matrix.framework }}"
70+
if ("${{ matrix.framework }}" -match "net[5-9]+") { dotnet test "./CloudinaryDotNet.IntegrationTests/CloudinaryDotNet.IntegrationTests.csproj" --configuration Release --no-build }
71+
if ("${{ matrix.framework }}" -match "net[1-4]\d+") { vstest.console.exe "./CloudinaryDotNet.IntegrationTests/bin/Release/${{ matrix.framework }}/CloudinaryDotNet.IntegrationTests.dll" }

0 commit comments

Comments
 (0)