Skip to content

Commit 468815f

Browse files
committed
Migrate from AppVeyor to GitHub Actions
1 parent 1ae944d commit 468815f

File tree

4 files changed

+202
-32
lines changed

4 files changed

+202
-32
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: .NET Framework Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
dotnet-framework:
11+
name: Tests
12+
runs-on: windows-latest
13+
defaults:
14+
run:
15+
shell: pwsh
16+
env:
17+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
18+
DOTNET_CLI_TELEMETRY_OPTOUT: true
19+
20+
steps:
21+
- name: Install NUnit Console
22+
run: choco install nunit-console-runner --version=3.17.0 -y
23+
24+
- name: Install LocalDB
25+
run: choco install sqllocaldb -y --no-progress
26+
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0 # need for GitVersion to work properly
31+
32+
- name: Setup .NET
33+
uses: actions/setup-dotnet@v4
34+
with:
35+
global-json-file: global.json
36+
37+
- name: Add MSBuild to PATH
38+
uses: microsoft/setup-msbuild@v2
39+
40+
- name: Patch App.config for LocalDB
41+
run: |
42+
$cfg = 'src/DelegateDecompiler.EntityFramework.Tests/App.config'
43+
[xml]$xml = Get-Content $cfg
44+
$cs = $xml.configuration.connectionStrings.add | Where-Object name -eq 'DelegateDecompilerEfTestDb'
45+
$cs.connectionString = 'Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=DelegateDecompilerEfTestDb;MultipleActiveResultSets=True;Integrated Security=True;TrustServerCertificate=True'
46+
$xml.Save($cfg)
47+
48+
- name: Restore
49+
run: dotnet restore
50+
51+
- name: Build
52+
run: dotnet build --no-restore -c Release DelegateDecompiler.sln
53+
54+
- name: Locate NUnit Console
55+
run: |
56+
$exe = Get-ChildItem -Path "$Env:ChocolateyInstall\lib" -Recurse -Filter nunit3-console.exe | Select-Object -First 1
57+
if (-not $exe) { Write-Error 'nunit3-console.exe not found after installation.'; exit 1 }
58+
Write-Host "Found NUnit console at $($exe.FullName)"
59+
"NUNIT_CONSOLE=$($exe.FullName)" | Out-File -FilePath $Env:GITHUB_ENV -Append
60+
61+
- name: Test
62+
run: |
63+
$ErrorActionPreference = 'Stop'
64+
$dlls = @(
65+
'src/DelegateDecompiler.Tests/bin/Release/net40/DelegateDecompiler.Tests.dll',
66+
'src/DelegateDecompiler.Tests.VB/bin/Release/net40/DelegateDecompiler.Tests.VB.dll',
67+
'src/DelegateDecompiler.Tests/bin/Release/net45/DelegateDecompiler.Tests.dll',
68+
'src/DelegateDecompiler.Tests.VB/bin/Release/net45/DelegateDecompiler.Tests.VB.dll',
69+
'src/DelegateDecompiler.EntityFramework.Tests/bin/Release/net45/DelegateDecompiler.EntityFramework.Tests.dll'
70+
)
71+
if (-not $Env:NUNIT_CONSOLE) { Write-Error 'NUNIT_CONSOLE env var not set.'; exit 1 }
72+
$resultArg = '--result=DelegateDecompiler.framework.tests.xml'
73+
& $Env:NUNIT_CONSOLE @dlls $resultArg
74+
shell: pwsh
75+
76+
- name: Upload NUnit results
77+
if: always()
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: nunit-framework
81+
path: DelegateDecompiler.framework.tests.xml

.github/workflows/dotnet-linux.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: .NET Tests / Linux
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
dotnet-linux:
12+
name: Tests
13+
runs-on: ubuntu-latest
14+
defaults:
15+
run:
16+
shell: pwsh
17+
env:
18+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
19+
DOTNET_CLI_TELEMETRY_OPTOUT: true
20+
services:
21+
sqlserver:
22+
image: mcr.microsoft.com/mssql/server:2022-latest
23+
env:
24+
ACCEPT_EULA: Y
25+
MSSQL_SA_PASSWORD: Your_strong_password123
26+
ports:
27+
- 1433:1433
28+
options: >-
29+
--health-cmd "bash -c '(/opt/mssql-tools18/bin/sqlcmd -C -S localhost -U sa -P Your_strong_password123 -Q \"SELECT 1\" || exit 1)'"
30+
--health-interval 10s --health-timeout 5s --health-retries 10
31+
32+
steps:
33+
- name: Checkout (full history)
34+
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0 # need for GitVersion to work properly
37+
38+
- name: Setup .NET
39+
uses: actions/setup-dotnet@v4
40+
with:
41+
global-json-file: global.json
42+
43+
- name: Restore
44+
run: dotnet restore
45+
- name: Patch App.config
46+
run: |
47+
$configPath = 'src/DelegateDecompiler.EntityFramework.Tests/App.config'
48+
[xml]$xml = Get-Content $configPath
49+
$node = $xml.configuration.connectionStrings.add | Where-Object { $_.name -eq 'DelegateDecompilerEfTestDb' }
50+
$node.connectionString = 'Data Source=localhost,1433;Initial Catalog=DelegateDecompilerEfTestDb;User ID=sa;Password=Your_strong_password123;Encrypt=False;TrustServerCertificate=True;MultipleActiveResultSets=True'
51+
$xml.Save($configPath)
52+
53+
- name: Build
54+
run: dotnet build --no-restore -c Release DelegateDecompiler.sln
55+
56+
- name: Run tests
57+
run: |
58+
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.Tests
59+
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.Tests.VB
60+
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.EntityFramework.Tests
61+
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.EntityFrameworkCore6.Tests
62+
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.EntityFrameworkCore8.Tests
63+
dotnet test --no-build -c Release -f net9.0 src/DelegateDecompiler.EntityFrameworkCore9.Tests
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: .NET Tests / Windows
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
dotnet-windows:
12+
name: Tests
13+
runs-on: windows-latest
14+
defaults:
15+
run:
16+
shell: pwsh
17+
env:
18+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
19+
DOTNET_CLI_TELEMETRY_OPTOUT: true
20+
21+
steps:
22+
23+
- name: Install LocalDB
24+
run: |
25+
choco install sqllocaldb -y --no-progress
26+
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0 # need for GitVersion to work properly
31+
32+
- name: Setup .NET
33+
uses: actions/setup-dotnet@v4
34+
with:
35+
global-json-file: global.json
36+
37+
- name: Patch App.config for LocalDB
38+
run: |
39+
$cfg = 'src/DelegateDecompiler.EntityFramework.Tests/App.config'
40+
[xml]$xml = Get-Content $cfg
41+
$cs = $xml.configuration.connectionStrings.add | Where-Object name -eq 'DelegateDecompilerEfTestDb'
42+
$cs.connectionString = 'Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=DelegateDecompilerEfTestDb;MultipleActiveResultSets=True;Integrated Security=True;TrustServerCertificate=True'
43+
$xml.Save($cfg)
44+
45+
- name: Restore
46+
run: dotnet restore
47+
48+
- name: Build
49+
run: dotnet build --no-restore -c Release DelegateDecompiler.sln
50+
51+
- name: Run tests
52+
run: |
53+
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.Tests
54+
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.Tests.VB
55+
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.EntityFramework.Tests
56+
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.EntityFrameworkCore6.Tests
57+
dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.EntityFrameworkCore8.Tests
58+
dotnet test --no-build -c Release -f net9.0 src/DelegateDecompiler.EntityFrameworkCore9.Tests

appveyor.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)