|
6 | 6 | build:
|
7 | 7 | runs-on: windows-latest
|
8 | 8 |
|
| 9 | + strategy: |
| 10 | + matrix: |
| 11 | + framework: |
| 12 | + - net9.0 |
| 13 | + - net8.0 |
| 14 | + - net481 |
| 15 | + - net452 |
| 16 | + |
9 | 17 | 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 |
12 | 33 | with:
|
13 |
| - dotnet-version: '9.0.x' |
| 34 | + nuget-version: '5.x' |
14 | 35 |
|
| 36 | + # 4. Restore Dependencies |
15 | 37 | - 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 } |
17 | 43 |
|
18 |
| - - name: Before Build |
| 44 | + # 5. Build Solution |
| 45 | + - name: Build Solution |
19 | 46 | 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 } |
21 | 51 |
|
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 |
24 | 56 |
|
25 |
| - - name: Unit Tests |
| 57 | + # 7. Run Unit Tests |
| 58 | + - name: Run Unit Tests |
26 | 59 | shell: pwsh
|
27 | 60 | 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" } |
32 | 64 |
|
33 |
| - - name: Integration Tests |
| 65 | + # 8. Run Integration Tests |
| 66 | + - name: Run Integration Tests |
34 | 67 | shell: pwsh
|
35 | 68 | 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