Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/.NET-Framework.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: .NET Framework Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
dotnet-framework:
name: Tests
runs-on: windows-latest
defaults:
run:
shell: pwsh
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true

steps:
- name: Install NUnit Console
run: choco install nunit-console-runner --version=3.17.0 -y

- name: Install LocalDB
run: choco install sqllocaldb -y --no-progress

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # need for GitVersion to work properly

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json

- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2

- name: Patch App.config for LocalDB
run: |
$cfg = 'src/DelegateDecompiler.EntityFramework.Tests/App.config'
[xml]$xml = Get-Content $cfg
$cs = $xml.configuration.connectionStrings.add | Where-Object name -eq 'DelegateDecompilerEfTestDb'
$cs.connectionString = 'Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=DelegateDecompilerEfTestDb;MultipleActiveResultSets=True;Integrated Security=True;TrustServerCertificate=True'
$xml.Save($cfg)

- name: Restore
run: dotnet restore

- name: Build
run: dotnet build --no-restore -c Release DelegateDecompiler.sln

- name: Locate NUnit Console
run: |
$exe = Get-ChildItem -Path "$Env:ChocolateyInstall\lib" -Recurse -Filter nunit3-console.exe | Select-Object -First 1
if (-not $exe) { Write-Error 'nunit3-console.exe not found after installation.'; exit 1 }
Write-Host "Found NUnit console at $($exe.FullName)"
"NUNIT_CONSOLE=$($exe.FullName)" | Out-File -FilePath $Env:GITHUB_ENV -Append

- name: Test
run: |
$ErrorActionPreference = 'Stop'
$dlls = @(
'src/DelegateDecompiler.Tests/bin/Release/net40/DelegateDecompiler.Tests.dll',
'src/DelegateDecompiler.Tests.VB/bin/Release/net40/DelegateDecompiler.Tests.VB.dll',
'src/DelegateDecompiler.Tests/bin/Release/net45/DelegateDecompiler.Tests.dll',
'src/DelegateDecompiler.Tests.VB/bin/Release/net45/DelegateDecompiler.Tests.VB.dll',
'src/DelegateDecompiler.EntityFramework.Tests/bin/Release/net45/DelegateDecompiler.EntityFramework.Tests.dll'
)
if (-not $Env:NUNIT_CONSOLE) { Write-Error 'NUNIT_CONSOLE env var not set.'; exit 1 }
$resultArg = '--result=DelegateDecompiler.framework.tests.xml'
& $Env:NUNIT_CONSOLE @dlls $resultArg
shell: pwsh

- name: Upload NUnit results
if: always()
uses: actions/upload-artifact@v4
with:
name: nunit-framework
path: DelegateDecompiler.framework.tests.xml
63 changes: 63 additions & 0 deletions .github/workflows/dotnet-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: .NET Tests / Linux

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
dotnet-linux:
name: Tests
runs-on: ubuntu-latest
defaults:
run:
shell: pwsh
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2022-latest
env:
ACCEPT_EULA: Y
MSSQL_SA_PASSWORD: Your_strong_password123
ports:
- 1433:1433
options: >-
--health-cmd "bash -c '(/opt/mssql-tools18/bin/sqlcmd -C -S localhost -U sa -P Your_strong_password123 -Q \"SELECT 1\" || exit 1)'"
--health-interval 10s --health-timeout 5s --health-retries 10

steps:
- name: Checkout (full history)
uses: actions/checkout@v4
with:
fetch-depth: 0 # need for GitVersion to work properly

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json

- name: Restore
run: dotnet restore
- name: Patch App.config
run: |
$configPath = 'src/DelegateDecompiler.EntityFramework.Tests/App.config'
[xml]$xml = Get-Content $configPath
$node = $xml.configuration.connectionStrings.add | Where-Object { $_.name -eq 'DelegateDecompilerEfTestDb' }
$node.connectionString = 'Data Source=localhost,1433;Initial Catalog=DelegateDecompilerEfTestDb;User ID=sa;Password=Your_strong_password123;Encrypt=False;TrustServerCertificate=True;MultipleActiveResultSets=True'
$xml.Save($configPath)

- name: Build
run: dotnet build --no-restore -c Release DelegateDecompiler.sln

- name: Run tests
run: |
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.Tests
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.Tests.VB
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.EntityFramework.Tests
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.EntityFrameworkCore6.Tests
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.EntityFrameworkCore8.Tests
dotnet test --no-build -c Release -f net9.0 src/DelegateDecompiler.EntityFrameworkCore9.Tests
58 changes: 58 additions & 0 deletions .github/workflows/dotnet-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: .NET Tests / Windows

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
dotnet-windows:
name: Tests
runs-on: windows-latest
defaults:
run:
shell: pwsh
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true

steps:

- name: Install LocalDB
run: |
choco install sqllocaldb -y --no-progress

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # need for GitVersion to work properly

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json

- name: Patch App.config for LocalDB
run: |
$cfg = 'src/DelegateDecompiler.EntityFramework.Tests/App.config'
[xml]$xml = Get-Content $cfg
$cs = $xml.configuration.connectionStrings.add | Where-Object name -eq 'DelegateDecompilerEfTestDb'
$cs.connectionString = 'Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=DelegateDecompilerEfTestDb;MultipleActiveResultSets=True;Integrated Security=True;TrustServerCertificate=True'
$xml.Save($cfg)

- name: Restore
run: dotnet restore

- name: Build
run: dotnet build --no-restore -c Release DelegateDecompiler.sln

- name: Run tests
run: |
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.Tests
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.Tests.VB
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.EntityFramework.Tests
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.EntityFrameworkCore6.Tests
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.EntityFrameworkCore8.Tests
dotnet test --no-build -c Release -f net9.0 src/DelegateDecompiler.EntityFrameworkCore9.Tests
32 changes: 0 additions & 32 deletions appveyor.yml

This file was deleted.