Skip to content

Test multiple frameworks #8

Test multiple frameworks

Test multiple frameworks #8

Workflow file for this run

name: .NET Test 🚀
on: [push, pull_request]
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
framework:
- net9.0
- net8.0
- net481
- 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') && !startsWith(matrix.framework, 'net4')
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 ("${{ matrix.framework }}" -match "net[5-9]+") { dotnet restore }
if ("${{ matrix.framework }}" -match "net[1-4]\d+") { nuget.exe restore CloudinaryDotNet.sln }
# 5. Build Solution
- name: Build Solution
shell: pwsh
run: |
Write-Host "⚒️ Building for: ${{ matrix.framework }}"
if ("${{ matrix.framework }}" -match "net[5-9]+") { dotnet build --configuration Release --no-restore }
if ("${{ matrix.framework }}" -match "net[1-4]\d+") { 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 ("${{ matrix.framework }}" -match "net[5-9]+") { dotnet test "./CloudinaryDotNet.Tests/CloudinaryDotNet.Tests.csproj" --configuration Release --no-build }
if ("${{ matrix.framework }}" -match "net[1-4]\d+") { 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 ("${{ matrix.framework }}" -match "net[5-9]+") { dotnet test "./CloudinaryDotNet.IntegrationTests/CloudinaryDotNet.IntegrationTests.csproj" --configuration Release --no-build }
if ("${{ matrix.framework }}" -match "net[1-4]\d+") { vstest.console.exe "./CloudinaryDotNet.IntegrationTests/bin/Release/${{ matrix.framework }}/CloudinaryDotNet.IntegrationTests.dll" }