refactor tests around supported query annotations #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: .Net Framework Tests (Legacy) | |
defaults: | |
run: | |
shell: bash | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "*" ] | |
paths: | |
- "**" | |
- "!**.md" | |
jobs: | |
# As this can run only on Windows machines, these tests should run only in CI | |
end2end-tests: | |
name: End-to-End Tests | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Load .env file | |
uses: xom9ikk/dotenv@v2.3.0 | |
with: | |
load-mode: strict | |
- name: Setup Visual Studio for .NET Framework | |
uses: microsoft/setup-msbuild@v1 | |
with: | |
vs-version: 'latest' | |
- name: Setup NuGet | |
uses: NuGet/setup-nuget@v2.0.1 | |
- name: Install Chocolatey | |
shell: powershell | |
run: | | |
Set-ExecutionPolicy Bypass -Scope Process -Force | |
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 | |
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) | |
- uses: ikalnytskyi/action-setup-postgres@v7 | |
with: | |
username: ${{ env.POSTGRES_USER }} | |
password: ${{ env.POSTGRES_PASSWORD }} | |
database: ${{ env.TESTS_DB }} | |
postgres-version: "16" | |
id: postgres | |
- name: Init PostgresSQL Schema | |
shell: powershell | |
run: psql -U $Env:POSTGRES_USER -f 'examples/config/postgresql/schema.sql' | |
env: | |
PGSERVICE: ${{ steps.postgres.outputs.service-name }} | |
PGPASSWORD: ${{ env.POSTGRES_PASSWORD }} | |
- name: Install MySQL and restore test projects in parallel | |
shell: pwsh | |
run: | | |
$mysqlJob = Start-Job -ScriptBlock { | |
choco install mysql --no-progress --version=8.0.31 -y --params "/serviceName:MySQL" | |
return $LASTEXITCODE | |
} | |
$restoreJob = Start-Job -ScriptBlock { | |
Get-ChildItem -Path examples -Recurse -Filter *.csproj | | |
Where-Object { $_.FullName -like '*Legacy*' } | | |
ForEach-Object { nuget restore $_.FullName } | |
nuget restore ./EndToEndCommon/EndToEndCommon.csproj | |
nuget restore ./LegacyEndToEndTests/LegacyEndToEndTests.csproj | |
msbuild.exe ./LegacyEndToEndTests/LegacyEndToEndTests.csproj -p:Configuration=Release -p:FrameworkVersion=v4.7.2 | |
return $LASTEXITCODE | |
} | |
$mysqlOutput = Receive-Job -Job $mysqlJob -Wait | |
$mysqlExitCode = @($mysqlOutput)[-1] | |
if ($mysqlExitCode -ne 0) { | |
Write-Error "MySQL install failed with exit code: $mysqlExitCode" | |
return $mysqlExitCode | |
} | |
$restoreOutput = Receive-Job -Job $restoreJob -Wait | |
$restoreExitCode = @($restoreOutput)[-1] | |
if ($restoreExitCode -ne 0) { | |
Write-Error "Restore/build failed with exit code: $restoreExitCode" | |
return $restoreExitCode | |
} | |
- name: Init MySQL Schema | |
shell: powershell | |
run: | | |
$env:Path += ";C:\Program Files\MySQL\MySQL Server 8.0\bin" | |
[Environment]::SetEnvironmentVariable("Path", $env:Path, "Machine") | |
mysql -u root -e "CREATE DATABASE $Env:TESTS_DB;" | |
mysql -u root $Env:TESTS_DB --execute="source examples/config/mysql/schema.sql" | |
- name: Run Tests | |
shell: powershell | |
run: | | |
$path = vswhere -latest -products * -requires Microsoft.VisualStudio.Workload.ManagedDesktop Microsoft.VisualStudio.Workload.Web -requiresAny -property installationPath | |
$path = join-path $path 'Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe' | |
& $path ./LegacyEndToEndTests/bin/Release/net472/LegacyEndToEndTests.dll |