-
Notifications
You must be signed in to change notification settings - Fork 69
71 lines (60 loc) · 2.76 KB
/
test.yaml
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
69
70
71
name: .NET Test 🚀
on: [push, pull_request]
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
framework:
- 9.0.x
- 8.0.x
- v4.8.1
- v4.5.2
steps:
# 1. Checkout repository
- name: Checkout Code
uses: actions/checkout@v4
# 2. Setup .NET SDK (for .NET Core / Modern .NET)
- name: Setup .NET SDK
if: "!startsWith(matrix.framework, 'v')"
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.framework }}
# 3. Install NuGet CLI (for .NET Framework)
- name: Install NuGet CLI
if: startsWith(matrix.framework, 'v')
uses: NuGet/setup-nuget@v2
with:
nuget-version: '5.x'
# 4. Restore Dependencies
- name: Restore Dependencies
shell: pwsh
run: |
Write-Host "🔄 Restoring dependencies for: ${{ matrix.framework }}"
if (!startsWith("${{ matrix.framework }}", "v")) { dotnet restore }
if (startsWith("${{ matrix.framework }}", "v")) { nuget.exe restore CloudinaryDotNet.sln }
# 5. Build Solution
- name: Build Solution
shell: pwsh
run: |
Write-Host "⚒️ Building for: ${{ matrix.framework }}"
if (!startsWith("${{ matrix.framework }}", "v")) { dotnet build --configuration Release --no-restore }
if (startsWith("${{ matrix.framework }}", "v")) { msbuild CloudinaryDotNet.sln /p:Configuration=Release /p:TargetFrameworkVersion=${{ matrix.framework }} }
# 6. Run before_build.ps1
- name: Run before_build.ps1
shell: pwsh
run: . ./before_build.ps1
# 7. Run Unit Tests
- name: Run Unit Tests
shell: pwsh
run: |
Write-Host "🧪 Running Unit Tests for: ${{ matrix.framework }}"
if (!startsWith("${{ matrix.framework }}", "v")) { dotnet test "./CloudinaryDotNet.Tests/CloudinaryDotNet.Tests.csproj" --configuration Release --no-build }
if (startsWith("${{ matrix.framework }}", "v")) { vstest.console.exe "./CloudinaryDotNet.Tests/bin/Release/${{ matrix.framework }}/CloudinaryDotNet.Tests.dll" /Framework:${{ matrix.framework }} }
# 8. Run Integration Tests
- name: Run Integration Tests
shell: pwsh
run: |
Write-Host "🧪 Running Integration Tests for: ${{ matrix.framework }}"
if (!startsWith("${{ matrix.framework }}", "v")) { dotnet test "./CloudinaryDotNet.IntegrationTests/CloudinaryDotNet.IntegrationTests.csproj" --configuration Release --no-build }
if (startsWith("${{ matrix.framework }}", "v")) { vstest.console.exe "./CloudinaryDotNet.IntegrationTests/bin/Release/${{ matrix.framework }}/CloudinaryDotNet.IntegrationTests.dll" /Framework:${{ matrix.framework }} }