Commit 522d150e authored by Nick Craver's avatar Nick Craver

Faster builds + use MySqlConnector

MySql.Data is a travesty at this point - moving to something more stable. Really we weren't testing Dapper with previous test failures, we were testing what mood MySql.Data and NuGet extraction are in and which phase of the moon is about.

Also speeds up the builds with 1 restore and 1 build. We can simplify here because everything is relevant (no wasted builds).
parent ba16b54b
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<ProjectReference Include="..\Dapper.SqlBuilder\Dapper.SqlBuilder.csproj" /> <ProjectReference Include="..\Dapper.SqlBuilder\Dapper.SqlBuilder.csproj" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="1.1.1" /> <PackageReference Include="Microsoft.Data.Sqlite" Version="1.1.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
<PackageReference Include="MySql.Data" Version="7.0.7-m61" /> <PackageReference Include="MySqlConnector" Version="0.44.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.4.0" /> <PackageReference Include="System.Data.SqlClient" Version="4.4.0" />
<PackageReference Include="xunit" Version="$(xUnitVersion)" /> <PackageReference Include="xunit" Version="$(xUnitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(xUnitVersion)" /> <PackageReference Include="xunit.runner.visualstudio" Version="$(xUnitVersion)" />
......
...@@ -37,7 +37,7 @@ static SqlServerTestSuite() ...@@ -37,7 +37,7 @@ static SqlServerTestSuite()
using (var connection = new SqlConnection(ConnectionString)) using (var connection = new SqlConnection(ConnectionString))
{ {
// ReSharper disable once AccessToDisposedClosure // ReSharper disable once AccessToDisposedClosure
Action<string> dropTable = name => connection.Execute($"IF OBJECT_ID('{name}', 'U') IS NOT NULL DROP TABLE [{name}]; "); void dropTable(string name) => connection.Execute($"IF OBJECT_ID('{name}', 'U') IS NOT NULL DROP TABLE [{name}]; ");
connection.Open(); connection.Open();
dropTable("Stuff"); dropTable("Stuff");
connection.Execute("CREATE TABLE Stuff (TheId int IDENTITY(1,1) not null, Name nvarchar(100) not null, Created DateTime null);"); connection.Execute("CREATE TABLE Stuff (TheId int IDENTITY(1,1) not null, Name nvarchar(100) not null, Created DateTime null);");
...@@ -65,12 +65,10 @@ static SqlServerTestSuite() ...@@ -65,12 +65,10 @@ static SqlServerTestSuite()
public class MySqlServerTestSuite : TestSuite public class MySqlServerTestSuite : TestSuite
{ {
private const string DbName = "DapperContribTests";
public static string ConnectionString { get; } = public static string ConnectionString { get; } =
IsAppVeyor IsAppVeyor
? "Server=localhost;Uid=root;Pwd=Password12!;" ? "Server=localhost;Database=test;Uid=root;Pwd=Password12!;UseAffectedRows=false;"
: "Server=localhost;Uid=test;Pwd=pass;"; : "Server=localhost;Database=tests;Uid=test;Pwd=pass;UseAffectedRows=false;";
public override IDbConnection GetConnection() public override IDbConnection GetConnection()
{ {
...@@ -87,9 +85,8 @@ static MySqlServerTestSuite() ...@@ -87,9 +85,8 @@ static MySqlServerTestSuite()
using (var connection = new MySqlConnection(ConnectionString)) using (var connection = new MySqlConnection(ConnectionString))
{ {
// ReSharper disable once AccessToDisposedClosure // ReSharper disable once AccessToDisposedClosure
Action<string> dropTable = name => connection.Execute($"DROP TABLE IF EXISTS `{name}`;"); void dropTable(string name) => connection.Execute($"DROP TABLE IF EXISTS `{name}`;");
connection.Open(); connection.Open();
connection.Execute($"DROP DATABASE IF EXISTS {DbName}; CREATE DATABASE {DbName}; USE {DbName};");
dropTable("Stuff"); dropTable("Stuff");
connection.Execute("CREATE TABLE Stuff (TheId int not null AUTO_INCREMENT PRIMARY KEY, Name nvarchar(100) not null, Created DateTime null);"); connection.Execute("CREATE TABLE Stuff (TheId int not null AUTO_INCREMENT PRIMARY KEY, Name nvarchar(100) not null, Created DateTime null);");
dropTable("People"); dropTable("People");
......
...@@ -19,9 +19,8 @@ ...@@ -19,9 +19,8 @@
<PackageReference Include="FirebirdSql.Data.FirebirdClient" Version="5.9.1" /> <PackageReference Include="FirebirdSql.Data.FirebirdClient" Version="5.9.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.2" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.2" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.2" />
<PackageReference Include="Microsoft.SqlServer.Compact" Version="4.0.8876.1" />
<PackageReference Include="Microsoft.SqlServer.Types" Version="14.0.314.76" /> <PackageReference Include="Microsoft.SqlServer.Types" Version="14.0.314.76" />
<PackageReference Include="MySql.Data" Version="7.0.7-m61" /> <PackageReference Include="MySqlConnector" Version="0.44.1" />
<PackageReference Include="NHibernate" Version="4.1.1.4000" /> <PackageReference Include="NHibernate" Version="4.1.1.4000" />
<PackageReference Include="Iesi.Collections" Version="4.0.2" /> <PackageReference Include="Iesi.Collections" Version="4.0.2" />
<PackageReference Include="Npgsql" Version="3.2.5" /> <PackageReference Include="Npgsql" Version="3.2.5" />
...@@ -46,6 +45,6 @@ ...@@ -46,6 +45,6 @@
<Compile Update="Benchmarks.*.cs" DependentUpon="Benchmarks.cs" /> <Compile Update="Benchmarks.*.cs" DependentUpon="Benchmarks.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Update="SourceLink.Create.GitHub" Version="2.1.2" /> <PackageReference Update="SourceLink.Create.GitHub" Version="2.8.3" />
</ItemGroup> </ItemGroup>
</Project> </Project>
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<ProjectReference Include="..\Dapper.Contrib\Dapper.Contrib.csproj" /> <ProjectReference Include="..\Dapper.Contrib\Dapper.Contrib.csproj" />
<PackageReference Include="FirebirdSql.Data.FirebirdClient" Version="5.9.1" /> <PackageReference Include="FirebirdSql.Data.FirebirdClient" Version="5.9.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
<PackageReference Include="MySql.Data" Version="8.0.8-dmr" /> <PackageReference Include="MySqlConnector" Version="0.44.1" />
<PackageReference Include="Npgsql" Version="3.2.5" /> <PackageReference Include="Npgsql" Version="3.2.5" />
<PackageReference Include="System.Data.SqlClient" Version="4.4.0" /> <PackageReference Include="System.Data.SqlClient" Version="4.4.0" />
<PackageReference Include="System.ValueTuple" Version="4.4.0" /> <PackageReference Include="System.ValueTuple" Version="4.4.0" />
......
...@@ -29,17 +29,15 @@ if ($PullRequestNumber) { ...@@ -29,17 +29,15 @@ if ($PullRequestNumber) {
$CreatePackages = $false $CreatePackages = $false
} }
Write-Host "Building projects..." -ForegroundColor "Magenta" Write-Host "Restoring all projects..." -ForegroundColor "Magenta"
foreach ($project in $projectsToBuild + $testsToRun) { dotnet restore
Write-Host "Building $project (dotnet restore/build)..." -ForegroundColor "Magenta" Write-Host "Done restoring." -ForegroundColor "Green"
dotnet restore ".\$project\$project.csproj" /p:CI=true
dotnet build ".\$project\$project.csproj" -c Release /p:CI=true Write-Host "Building all projects..." -ForegroundColor "Magenta"
Write-Host "" dotnet build -c Release --no-restore /p:CI=true
}
Write-Host "Done building." -ForegroundColor "Green" Write-Host "Done building." -ForegroundColor "Green"
if ($RunTests) { if ($RunTests) {
dotnet restore /ConsoleLoggerParameters:Verbosity=Quiet
foreach ($project in $testsToRun) { foreach ($project in $testsToRun) {
Write-Host "Running tests: $project (all frameworks)" -ForegroundColor "Magenta" Write-Host "Running tests: $project (all frameworks)" -ForegroundColor "Magenta"
Push-Location ".\$project" Push-Location ".\$project"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment