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 @@
<ProjectReference Include="..\Dapper.SqlBuilder\Dapper.SqlBuilder.csproj" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="1.1.1" />
<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="xunit" Version="$(xUnitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(xUnitVersion)" />
......
......@@ -37,7 +37,7 @@ static SqlServerTestSuite()
using (var connection = new SqlConnection(ConnectionString))
{
// 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();
dropTable("Stuff");
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()
public class MySqlServerTestSuite : TestSuite
{
private const string DbName = "DapperContribTests";
public static string ConnectionString { get; } =
IsAppVeyor
? "Server=localhost;Uid=root;Pwd=Password12!;"
: "Server=localhost;Uid=test;Pwd=pass;";
? "Server=localhost;Database=test;Uid=root;Pwd=Password12!;UseAffectedRows=false;"
: "Server=localhost;Database=tests;Uid=test;Pwd=pass;UseAffectedRows=false;";
public override IDbConnection GetConnection()
{
......@@ -87,9 +85,8 @@ static MySqlServerTestSuite()
using (var connection = new MySqlConnection(ConnectionString))
{
// 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.Execute($"DROP DATABASE IF EXISTS {DbName}; CREATE DATABASE {DbName}; USE {DbName};");
dropTable("Stuff");
connection.Execute("CREATE TABLE Stuff (TheId int not null AUTO_INCREMENT PRIMARY KEY, Name nvarchar(100) not null, Created DateTime null);");
dropTable("People");
......
......@@ -19,9 +19,8 @@
<PackageReference Include="FirebirdSql.Data.FirebirdClient" Version="5.9.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" 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="MySql.Data" Version="7.0.7-m61" />
<PackageReference Include="MySqlConnector" Version="0.44.1" />
<PackageReference Include="NHibernate" Version="4.1.1.4000" />
<PackageReference Include="Iesi.Collections" Version="4.0.2" />
<PackageReference Include="Npgsql" Version="3.2.5" />
......@@ -46,6 +45,6 @@
<Compile Update="Benchmarks.*.cs" DependentUpon="Benchmarks.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="SourceLink.Create.GitHub" Version="2.1.2" />
<PackageReference Update="SourceLink.Create.GitHub" Version="2.8.3" />
</ItemGroup>
</Project>
......@@ -21,7 +21,7 @@
<ProjectReference Include="..\Dapper.Contrib\Dapper.Contrib.csproj" />
<PackageReference Include="FirebirdSql.Data.FirebirdClient" Version="5.9.1" />
<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="System.Data.SqlClient" Version="4.4.0" />
<PackageReference Include="System.ValueTuple" Version="4.4.0" />
......
......@@ -29,17 +29,15 @@ if ($PullRequestNumber) {
$CreatePackages = $false
}
Write-Host "Building projects..." -ForegroundColor "Magenta"
foreach ($project in $projectsToBuild + $testsToRun) {
Write-Host "Building $project (dotnet restore/build)..." -ForegroundColor "Magenta"
dotnet restore ".\$project\$project.csproj" /p:CI=true
dotnet build ".\$project\$project.csproj" -c Release /p:CI=true
Write-Host ""
}
Write-Host "Restoring all projects..." -ForegroundColor "Magenta"
dotnet restore
Write-Host "Done restoring." -ForegroundColor "Green"
Write-Host "Building all projects..." -ForegroundColor "Magenta"
dotnet build -c Release --no-restore /p:CI=true
Write-Host "Done building." -ForegroundColor "Green"
if ($RunTests) {
dotnet restore /ConsoleLoggerParameters:Verbosity=Quiet
foreach ($project in $testsToRun) {
Write-Host "Running tests: $project (all frameworks)" -ForegroundColor "Magenta"
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