Skip to content

Commit b8e2998

Browse files
add only .net
1 parent 1e48d4e commit b8e2998

File tree

4 files changed

+22
-71
lines changed

4 files changed

+22
-71
lines changed

.github/workflows/test.yaml

Lines changed: 20 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,41 @@
11
name: .NET Test 🚀
22

3-
on: [ push, pull_request ]
3+
on: [push, pull_request]
44

55
jobs:
66
build:
77
runs-on: windows-latest
8-
98
strategy:
109
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
1713
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
3316
with:
34-
nuget-version: '5.x'
17+
dotnet-version: ${{ matrix.dotnet-version }}
3518

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
4219
- 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
4821

49-
# 6. Build Solution
50-
- name: Build Solution
22+
- name: Before Build
5123
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
6025

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
6528

66-
# 8. Run Unit Tests
67-
- name: Run Unit Tests
29+
- name: Unit Tests
6830
shell: pwsh
6931
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
7735
78-
# 9. Run Integration Tests
79-
- name: Run Integration Tests
36+
- name: Integration Tests
8037
shell: pwsh
8138
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

CloudinaryDotNet.IntegrationTests/CloudinaryDotNet.IntegrationTests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
<ItemGroup>
1515
<PackageReference Include="System.Net.Http" Version="4.3.4" />
1616
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
17-
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
1817
<PackageReference Include="Moq" Version="4.16.1" />
1918
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
2019
<PackageReference Include="NUnit" Version="3.13.3" />

CloudinaryDotNet.IntegrationTests/IntegrationTestBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ public static string GetTaggedRandomValue()
158158
{
159159
var assembly = typeof(IntegrationTestBase).Assembly;
160160
var result = assembly.GetName().Name.Replace('.', '_');
161-
var appveyorJobId = Environment.GetEnvironmentVariable("APPVEYOR_JOB_ID");
162-
result += $"{appveyorJobId}_{new Random().Next(100000, 999999).ToString()}";
161+
var githubRunId = Environment.GetEnvironmentVariable("GITHUB_RUN_ID") ?? "local";
162+
result += $"{githubRunId}_{new Random().Next(100000, 999999)}";
163163
return result;
164164
}
165165

CloudinaryDotNet.Tests/CloudinaryDotNet.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
<ItemGroup>
1515
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
16-
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
1716
<PackageReference Include="Moq" Version="4.16.1" />
1817
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
1918
<PackageReference Include="NUnit" Version="3.13.3" />

0 commit comments

Comments
 (0)