|
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:
|
7 | 7 | runs-on: windows-latest
|
8 |
| - |
9 | 8 | strategy:
|
10 | 9 | matrix:
|
11 |
| - framework: |
12 |
| - - 9.0.x |
13 |
| - - 8.0.x |
14 |
| - - v4.8.1 |
15 |
| - - v4.5.2 |
16 |
| - |
| 10 | + dotnet-version: |
| 11 | + - 9.0.x |
| 12 | + - 8.0.x |
17 | 13 | steps:
|
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, 'v')" |
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, 'v') |
32 |
| - uses: NuGet/setup-nuget@v2 |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + - uses: actions/setup-dotnet@v4 |
33 | 16 | with:
|
34 |
| - nuget-version: '5.x' |
| 17 | + dotnet-version: ${{ matrix.dotnet-version }} |
35 | 18 |
|
36 |
| - # 4. Add MSBuild to PATH (for .NET Framework) |
37 |
| - - name: Add MSBuild to PATH |
38 |
| - if: contains(matrix.framework, 'v') |
39 |
| - uses: microsoft/setup-msbuild@v2 |
40 |
| - |
41 |
| - # 5. Restore Dependencies |
42 | 19 | - name: Restore Dependencies
|
43 |
| - shell: pwsh |
44 |
| - run: | |
45 |
| - Write-Host "🔄 Restoring dependencies for: ${{ matrix.framework }}" |
46 |
| - if ("${{ matrix.framework }}" -notlike "v*") { dotnet restore } |
47 |
| - if ("${{ matrix.framework }}" -like "v*") { nuget.exe restore CloudinaryDotNet.sln } |
| 20 | + run: dotnet restore |
48 | 21 |
|
49 |
| - # 6. Build Solution |
50 |
| - - name: Build Solution |
| 22 | + - name: Before Build |
51 | 23 | shell: pwsh
|
52 |
| - run: | |
53 |
| - Write-Host "⚒️ Building for: ${{ 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 |
| - } |
| 24 | + run: ./before_build.ps1 |
60 | 25 |
|
61 |
| - # 7. Run before_build.ps1 |
62 |
| - - name: Run before_build.ps1 |
63 |
| - shell: pwsh |
64 |
| - run: . ./before_build.ps1 |
| 26 | + - name: Build |
| 27 | + run: dotnet build --configuration Release --no-restore |
65 | 28 |
|
66 |
| - # 8. Run Unit Tests |
67 |
| - - name: Run Unit Tests |
| 29 | + - name: Unit Tests |
68 | 30 | shell: pwsh
|
69 | 31 | run: |
|
70 |
| - Write-Host "🧪 Running Unit Tests for: ${{ 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 |
| - } |
| 32 | + dotnet test "./CloudinaryDotNet.Tests/CloudinaryDotNet.Tests.csproj" ` |
| 33 | + --configuration Release ` |
| 34 | + --no-build |
77 | 35 |
|
78 |
| - # 9. Run Integration Tests |
79 |
| - - name: Run Integration Tests |
| 36 | + - name: Integration Tests |
80 | 37 | shell: pwsh
|
81 | 38 | run: |
|
82 |
| - Write-Host "🧪 Running Integration Tests for: ${{ 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 |
| - } |
| 39 | + dotnet test "./CloudinaryDotNet.IntegrationTests/CloudinaryDotNet.IntegrationTests.csproj" ` |
| 40 | + --configuration Release ` |
| 41 | + --no-build |
0 commit comments