Skip to content

Improve test execution error handling in workflows #150

Improve test execution error handling in workflows

Improve test execution error handling in workflows #150

Workflow file for this run

name: Windows / .NET Tests
on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:
jobs:
dotnet-windows:
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: |
$failed = $false
function Fail { $script:failed = $true }
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.Tests || Fail
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.Tests.VB || Fail
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.EntityFramework.Tests || Fail
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.EntityFrameworkCore8.Tests || Fail
dotnet test --no-build -c Release -f net9.0 src/DelegateDecompiler.EntityFrameworkCore9.Tests || Fail
dotnet test --no-build -c Release -f net10.0 src/DelegateDecompiler.EntityFrameworkCore10.Tests || Fail
if ($failed) { exit 1 }