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
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"docfx": {
"version": "2.81.0",
"version": "2.82.0",
"commands": [
"docfx"
],
Expand Down
37 changes: 27 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
- name: Run the tests (${{ matrix.name }})
env:
ODX_REQUIRE_SQL: 1
run: dotnet test Tests/Open.Database.Extensions.Core.Tests -c ${{ matrix.configuration }} -f ${{ matrix.tfm }} --logger "trx;LogFileName=${{ matrix.name }}.trx" --results-directory TestResults/${{ matrix.name }}
run: dotnet test --project Tests/Open.Database.Extensions.Core.Tests -c ${{ matrix.configuration }} -f ${{ matrix.tfm }} --report-xunit-trx --report-xunit-trx-filename ${{ matrix.name }}.trx --results-directory TestResults/${{ matrix.name }}

- name: Upload the TRX files
if: always()
Expand Down Expand Up @@ -118,11 +118,11 @@ jobs:
$failed = @()
$started = Get-Date
foreach ($framework in $frameworks) {
dotnet test $project -c Release --no-build -f $framework --logger "trx;LogFilePrefix=legacy-compiler-$framework" --results-directory TestResults/legacy-compiler
dotnet test --project $project -c Release --no-build -f $framework --report-xunit-trx --report-xunit-trx-filename "legacy-compiler-$framework.trx" --results-directory TestResults/legacy-compiler
$exitCode = $LASTEXITCODE
# `dotnet test --no-build -f` exits 0 without running anything for a target framework that was not built, so a missing TRX file is a failure too,
# and so is a TRX file that counts no tests.
$results = @(Get-ChildItem TestResults/legacy-compiler -Filter "legacy-compiler-${framework}_*.trx" -ErrorAction SilentlyContinue | Where-Object LastWriteTime -ge $started)
$results = @(Get-ChildItem TestResults/legacy-compiler -Filter "legacy-compiler-$framework.trx" -ErrorAction SilentlyContinue | Where-Object LastWriteTime -ge $started)
$total = 0
foreach ($result in $results) { $total += [int]([xml](Get-Content -Raw $result.FullName)).TestRun.ResultSummary.Counters.total }
if ($exitCode -ne 0 -or -not $results -or $total -eq 0) {
Expand Down Expand Up @@ -173,7 +173,13 @@ jobs:
- name: Run the generator tests
env:
ODX_REQUIRE_SQL: 1
run: dotnet test Tests/Open.Database.Extensions.Generator.Tests -c Release --logger "trx;LogFilePrefix=generator" --results-directory TestResults/generator
run: dotnet test --project Tests/Open.Database.Extensions.Generator.Tests -c Release --report-xunit-trx --report-xunit-trx-filename generator.trx --results-directory TestResults/generator

# The same tests against the generator built on Roslyn 5.12 (Source/Generator.Roslyn5); Core packs both builds.
- name: Run the generator tests on the Roslyn 5.12 build
env:
ODX_REQUIRE_SQL: 1
run: dotnet test --project Tests/Open.Database.Extensions.Generator.Tests -c Release -p:OdxGeneratorRoslyn=5.12 --report-xunit-trx --report-xunit-trx-filename generator-roslyn5.12.trx --results-directory TestResults/generator-roslyn5.12

# What a NuGet user gets: the packages are packed, and a project that references only them is built and run with the generator on,
# arriving through MSSqlClient alone, switched off, and with C# 12. It runs on net472 and net11.0, against LocalDB and SQLite.
Expand All @@ -182,6 +188,8 @@ jobs:
ODX_REQUIRE_SQL: 1
run: |
$suffix = "ci.${{ github.run_id }}.${{ github.run_attempt }}"
# The version prefix of Source/Directory.Build.props, so a version change there never leaves this step behind.
$prefix = ([xml](Get-Content Source/Directory.Build.props -Raw)).Project.PropertyGroup.VersionPrefix | Where-Object { $_ } | Select-Object -First 1
$feed = Join-Path $env:RUNNER_TEMP 'feed'
$siblings = 'MSSqlClient', 'Channel', 'Dataflow', 'Extensions'
foreach ($project in @('Core') + $siblings) {
Expand All @@ -193,12 +201,12 @@ jobs:
# The Core package carries the generator and its build targets, and no sibling package holds them back from its consumers.
Add-Type -AssemblyName System.IO.Compression.FileSystem
function Read-Package($id) {
$path = Join-Path $feed "$id.11.0.0-$suffix.nupkg"
$path = Join-Path $feed "$id.$prefix-$suffix.nupkg"
[IO.Compression.ZipFile]::OpenRead($path)
}
$core = Read-Package 'Open.Database.Extensions.Core'
try {
foreach ($entry in 'analyzers/dotnet/roslyn4.14/cs/Open.Database.Extensions.Generator.dll', 'buildTransitive/Open.Database.Extensions.Core.targets') {
foreach ($entry in 'analyzers/dotnet/roslyn4.14/cs/Open.Database.Extensions.Generator.dll', 'analyzers/dotnet/roslyn5.12/cs/Open.Database.Extensions.Generator.dll', 'buildTransitive/Open.Database.Extensions.Core.targets') {
if (-not $core.GetEntry($entry)) { throw "The Core package has no $entry" }
}
} finally { $core.Dispose() }
Expand All @@ -217,12 +225,20 @@ jobs:
$variants = [ordered]@{ core = @(); mssqlclient = @('-p:OdxVia=MSSqlClient'); off = @('-p:OdxGenerateMaps=false'); csharp12 = @('-p:LangVersion=12') }
$failed = @()
foreach ($variant in $variants.Keys) {
$options = @("-p:OdxFeed=$feed", "-p:OdxPackageVersion=11.0.0-$suffix") + $variants[$variant]
$options = @("-p:OdxFeed=$feed", "-p:OdxPackageVersion=$prefix-$suffix") + $variants[$variant]
$consumer = 'Tests/Open.Database.Extensions.PackageConsumer.Tests'
dotnet build $consumer -c Release --no-incremental @options
if ($LASTEXITCODE -ne 0) { $failed += "$variant (build)"; continue }
dotnet test $consumer -c Release --no-build @options --logger "trx;LogFilePrefix=$variant" --results-directory TestResults/consumer
if ($LASTEXITCODE -ne 0) { $failed += $variant }
# The compiler of this SDK (global.json) supports Roslyn 5.12, so NuGet must hand it the generator in the roslyn5.12 folder, not the roslyn4.14 one.
if ($variant -in 'core', 'mssqlclient') {
$analyzers = (dotnet msbuild $consumer '-t:ResolvePackageAssets;ResolveLockFileAnalyzers' -getItem:Analyzer -p:Configuration=Release -p:TargetFramework=net11.0 @options | ConvertFrom-Json).Items.Analyzer.Identity
if (-not ($analyzers -like '*roslyn5.12*Open.Database.Extensions.Generator.dll')) { $failed += "$variant (the roslyn5.12 generator was not selected: $($analyzers -join ', '))"; continue }
}
# One run per target framework: a run of both writes the same TRX file twice, and the second overwrites the first.
foreach ($framework in 'net472', 'net11.0') {
dotnet test --project $consumer -c Release --no-build -f $framework @options --report-xunit-trx --report-xunit-trx-filename "$variant-$framework.trx" --results-directory TestResults/consumer
if ($LASTEXITCODE -ne 0) { $failed += "$variant ($framework)" }
}
}
if ($failed.Count -gt 0) { throw "Package consumer tests failed: $($failed -join ', ')" }

Expand All @@ -233,6 +249,7 @@ jobs:
name: trx-generator
path: |
TestResults/generator/*.trx
TestResults/generator-roslyn5.12/*.trx
TestResults/consumer/*.trx

benchmarks-build:
Expand Down Expand Up @@ -280,7 +297,7 @@ jobs:
$projects = @(
'Source\Core', 'Source\MSSqlClient', 'Source\Channel', 'Source\Dataflow', 'Source\Extensions',
'Tests\Open.Database.Extensions.Core.Tests', 'Tests\Open.Database.Extensions.LegacyCompiler.Tests', 'docsite\samples', 'Benchmarks\Open.Database.Extensions.Benchmarks',
'Source\Generator', 'Tests\Open.Database.Extensions.Generator.Models', 'Tests\Open.Database.Extensions.Generator.Tests', 'Benchmarks\Open.Database.Extensions.Benchmarks.Generated')
'Source\Generator', 'Source\Generator.Roslyn5', 'Tests\Open.Database.Extensions.Generator.Models', 'Tests\Open.Database.Extensions.Generator.Tests', 'Benchmarks\Open.Database.Extensions.Benchmarks.Generated')
$failures = @()
foreach ($project in $projects) {
# A full Windows path: with forward slashes the formatter loads nothing and reports a false zero.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.15.8" />
<PackageReference Include="Dapper" Version="2.1.89" />
<PackageReference Include="Dapper.AOT" Version="1.1.0" />
<PackageReference Include="FastExpressionCompiler" Version="6.0.0" />
<PackageReference Include="ZLinq" Version="1.6.1" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="10.0.14" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="7.1.1" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="10.0.14" />
<PackageReference Include="BenchmarkDotNet" />
<PackageReference Include="Dapper" />
<PackageReference Include="Dapper.AOT" />
<PackageReference Include="FastExpressionCompiler" />
<PackageReference Include="ZLinq" />
<PackageReference Include="Microsoft.Data.Sqlite" />
<PackageReference Include="Microsoft.Data.SqlClient" />
<PackageReference Include="System.Security.Cryptography.Pkcs" />
</ItemGroup>

<ItemGroup>
Expand Down
76 changes: 76 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<Project>

<!--
Every package version of the repository, in one place. A project names the package (and its PrivateAssets / IncludeAssets);
this file says which version. A project that needs another version states it as VersionOverride on its PackageReference,
so each exception sits beside the reference that needs it.
-->
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>

<ItemGroup Label="Shipped packages">
<PackageVersion Include="Microsoft.Data.SqlClient" Version="8.0.0" />
<!-- MSSqlClient and every project that uses SqlClient pin Pkcs themselves. SqlClient 7.1.1 brought Pkcs 9.0.18 (NU1902/NU1903 advisories); SqlClient 8.0.0 depends on Pkcs 10.0.15, which has none, so the pin no longer fixes a vulnerability. It stays so that these projects take the newest Pkcs, not SqlClient's minimum. -->
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="11.0.0" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="11.0.0" />
<PackageVersion Include="System.Memory" Version="4.6.3" />
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.6.3" />
<!-- The legacy SqlClient project: out of the build, kept as source. -->
<PackageVersion Include="System.Data.SqlClient" Version="4.9.1" />
</ItemGroup>

<!--
The System.* packages Core and Dataflow take on their netstandard targets. Each target gets the newest version its consumers can use.
The 11.0.0 packages support .NET Framework (the netstandard2.0 build's consumers) and .NET 10 and later, and warn at build time when a
.NET 8 or .NET 9 project, which takes the netstandard2.1 build, references them ("doesn't support net8.0"). That build stays on the
newest 10.0.x until .NET 8 and .NET 9 are out of the picture.
-->
<ItemGroup Label="System packages: newest per target">
<PackageVersion Include="System.Linq.AsyncEnumerable" Version="11.0.0" Condition="'$(TargetFramework)' != 'netstandard2.1'" />
<PackageVersion Include="System.Linq.AsyncEnumerable" Version="10.0.15" Condition="'$(TargetFramework)' == 'netstandard2.1'" />
<PackageVersion Include="System.Threading.Channels" Version="11.0.0" Condition="'$(TargetFramework)' != 'netstandard2.1'" />
<PackageVersion Include="System.Threading.Channels" Version="10.0.15" Condition="'$(TargetFramework)' == 'netstandard2.1'" />
<PackageVersion Include="System.Collections.Immutable" Version="11.0.0" Condition="'$(TargetFramework)' != 'netstandard2.1'" />
<PackageVersion Include="System.Collections.Immutable" Version="10.0.15" Condition="'$(TargetFramework)' == 'netstandard2.1'" />
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="11.0.0" Condition="'$(TargetFramework)' != 'netstandard2.1'" />
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="10.0.15" Condition="'$(TargetFramework)' == 'netstandard2.1'" />
</ItemGroup>

<ItemGroup Label="Build tools of the packages">
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="11.0.100" />
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="5.6.0" />
<!-- The source generator: the lowest Roslyn it has been built and run against. Generator.Tests runs the generator itself on it. -->
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="5.12.0" />
</ItemGroup>

<ItemGroup Label="Tests">
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.12.0" />
<PackageVersion Include="xunit.v3" Version="4.0.4" />
<PackageVersion Include="xunit.runner.visualstudio" Version="4.0.2" />
<PackageVersion Include="coverlet.collector" Version="10.1.1" />
<PackageVersion Include="NSubstitute" Version="6.2.0" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.2" />
<!-- 11.0.0 supports .NET 10 and later only; the net472 consumer project takes the newest 10.x. -->
<PackageVersion Include="Microsoft.Data.Sqlite" Version="11.0.0" Condition="'$(TargetFramework)' != 'net472'" />
<PackageVersion Include="Microsoft.Data.Sqlite" Version="10.0.15" Condition="'$(TargetFramework)' == 'net472'" />
</ItemGroup>

<ItemGroup Label="Benchmarks">
<PackageVersion Include="BenchmarkDotNet" Version="0.15.8" />
<PackageVersion Include="Dapper" Version="2.1.100" />
<PackageVersion Include="Dapper.AOT" Version="1.1.0" />
<PackageVersion Include="FastExpressionCompiler" Version="6.0.0" />
<PackageVersion Include="ZLinq" Version="1.6.1" />
</ItemGroup>

<ItemGroup Label="Documentation samples">
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="11.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="11.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="11.0.0" />
<PackageVersion Include="xunit.v3.assert" Version="4.0.4" />
<PackageVersion Include="xunit.v3.extensibility.core" Version="4.0.4" />
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions Open.Database.Extensions.slnx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Solution>
<Folder Name="/Solution Items/">
<File Path=".editorconfig" />
<File Path="Directory.Packages.props" />
<File Path="README.md" />
<File Path="Source/Directory.Build.props" />
</Folder>
Expand All @@ -15,5 +16,6 @@
<Project Path="Source/Dataflow/Open.Database.Extensions.Dataflow.csproj" />
<Project Path="Source/Extensions/Open.Database.Extensions.csproj" />
<Project Path="Source/Generator/Open.Database.Extensions.Generator.csproj" />
<Project Path="Source/Generator.Roslyn5/Open.Database.Extensions.Generator.Roslyn5.csproj" />
<Project Path="Source/MSSqlClient/Open.Database.Extensions.MSSqlClient.csproj" />
</Solution>
4 changes: 2 additions & 2 deletions Source/Channel/Open.Database.Extensions.Channel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.403" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
</ItemGroup>

<!-- Public API surface tracking, as on Core: enabled on the modern targets only (the public API differs on the netstandard shims).
The package's own targets add PublicAPI.Shipped.txt and PublicAPI.Unshipped.txt as AdditionalFiles when they sit next to the project. -->
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0' or '$(TargetFramework)' == 'net11.0'">
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.4">
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Loading