another fix #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: .NET Test 🚀 | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
framework: | |
- 9.0.x | |
- 8.0.x | |
- net452 | |
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, 'net')" | |
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, 'net4') | |
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 }}", "net")) { dotnet restore } | |
if (startsWith("${{ matrix.framework }}", "net")) { nuget.exe restore CloudinaryDotNet.sln } | |
# 5. Build Solution | |
- name: Build Solution | |
shell: pwsh | |
run: | | |
Write-Host "⚒️ Building for: ${{ matrix.framework }}" | |
if (!startsWith("${{ matrix.framework }}", "net")) { dotnet build --configuration Release --no-restore } | |
if (startsWith("${{ matrix.framework }}", "net")) { msbuild CloudinaryDotNet.sln /p:Configuration=Release } | |
# 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 }}", "net")) { dotnet test "./CloudinaryDotNet.Tests/CloudinaryDotNet.Tests.csproj" --configuration Release --no-build } | |
if (startsWith("${{ matrix.framework }}", "net")) { vstest.console.exe "./CloudinaryDotNet.Tests/bin/Release/${{ matrix.framework }}/CloudinaryDotNet.Tests.dll" } | |
# 8. Run Integration Tests | |
- name: Run Integration Tests | |
shell: pwsh | |
run: | | |
Write-Host "🧪 Running Integration Tests for: ${{ matrix.framework }}" | |
if (!startsWith("${{ matrix.framework }}", "net")) { dotnet test "./CloudinaryDotNet.IntegrationTests/CloudinaryDotNet.IntegrationTests.csproj" --configuration Release --no-build } | |
if (startsWith("${{ matrix.framework }}", "net")) { vstest.console.exe "./CloudinaryDotNet.IntegrationTests/bin/Release/${{ matrix.framework }}/CloudinaryDotNet.IntegrationTests.dll" } |