From 468815f4e18fb024dab8e4ebe95b85fbdd551e69 Mon Sep 17 00:00:00 2001 From: Alex Zaytsev Date: Thu, 2 Oct 2025 23:55:21 +1000 Subject: [PATCH] Migrate from AppVeyor to GitHub Actions --- .github/workflows/.NET-Framework.yml | 81 ++++++++++++++++++++++++++++ .github/workflows/dotnet-linux.yml | 63 ++++++++++++++++++++++ .github/workflows/dotnet-windows.yml | 58 ++++++++++++++++++++ appveyor.yml | 32 ----------- 4 files changed, 202 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/.NET-Framework.yml create mode 100644 .github/workflows/dotnet-linux.yml create mode 100644 .github/workflows/dotnet-windows.yml delete mode 100644 appveyor.yml diff --git a/.github/workflows/.NET-Framework.yml b/.github/workflows/.NET-Framework.yml new file mode 100644 index 00000000..f452929f --- /dev/null +++ b/.github/workflows/.NET-Framework.yml @@ -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 diff --git a/.github/workflows/dotnet-linux.yml b/.github/workflows/dotnet-linux.yml new file mode 100644 index 00000000..e28f05e2 --- /dev/null +++ b/.github/workflows/dotnet-linux.yml @@ -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 diff --git a/.github/workflows/dotnet-windows.yml b/.github/workflows/dotnet-windows.yml new file mode 100644 index 00000000..87de2a7d --- /dev/null +++ b/.github/workflows/dotnet-windows.yml @@ -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 diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 01808985..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,32 +0,0 @@ -image: - - Visual Studio 2022 - -skip_branch_with_pr: true - -environment: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - DOTNET_CLI_TELEMETRY_OPTOUT: true - IGNORE_NORMALISATION_GIT_HEAD_MOVE: 1 - -init: - - net start MSSQL$SQL2019 - -build_script: - - build.cmd - -before_build: - - dotnet restore - -test_script: - - test.cmd - -artifacts: -- path: '**/*.nupkg' -- path: '**/*.snupkg' - -deploy: -- provider: NuGet - on: - APPVEYOR_REPO_TAG: true - api_key: - secure: 5FZW9z7tXGnTdpNTGDdaN978jpCyyTRfeturAxhwrTcO7OsE/sas7hbsOBZlPZg/