Skip to content

Commit aea488b

Browse files
authored
Merge pull request #1559 from StackExchange/craver/docker-bits
Let's get the first version of this going. If you want to try locally: 1. Start the servers (ensuring you have no conflicting port usage - shut down locals if so): ```bash cd /tests/ docker-compose up ``` Run tests: ```bash cd <repo root> dotnet test Build.csproj ```
2 parents 009b430 + acbd6f7 commit aea488b

File tree

4 files changed

+90
-1
lines changed

4 files changed

+90
-1
lines changed

.github/workflows/main.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Main Build
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- '*'
10+
- '!/docs/*' # Don't run workflow when files are only in the /docs directory
11+
12+
jobs:
13+
vm-job:
14+
name: Ubuntu
15+
runs-on: ubuntu-latest
16+
services:
17+
postgres:
18+
image: postgres
19+
ports:
20+
- 5432/tcp
21+
env:
22+
POSTGRES_USER: postgres
23+
POSTGRES_PASSWORD: postgres
24+
POSTGRES_DB: test
25+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
26+
sqlserver:
27+
image: mcr.microsoft.com/mssql/server:2019-latest
28+
ports:
29+
- 1433/tcp
30+
env:
31+
ACCEPT_EULA: Y
32+
SA_PASSWORD: "Password."
33+
mysql:
34+
image: mysql
35+
ports:
36+
- 3306/tcp
37+
env:
38+
MYSQL_ROOT_PASSWORD: root
39+
MYSQL_DATABASE: test
40+
steps:
41+
- name: Checkout code
42+
uses: actions/checkout@v1
43+
- name: .NET Build
44+
run: dotnet build Build.csproj -c Release /p:CI=true
45+
- name: Dapper Tests
46+
run: dotnet test tests/Dapper.Tests/Dapper.Tests.csproj -c Release --logger GitHubActions /p:CI=true
47+
env:
48+
MySqlConnectionString: Server=localhost;Port=${{ job.services.mysql.ports[3306] }};Uid=root;Pwd=root;Database=test;Allow User Variables=true
49+
OLEDBConnectionString: Provider=SQLOLEDB;Server=tcp:localhost,${{ job.services.sqlserver.ports[1433] }};Database=tempdb;User Id=sa;Password=Password.;
50+
PostgesConnectionString: Server=localhost;Port=${{ job.services.postgres.ports[5432] }};Database=test;User Id=postgres;Password=postgres;
51+
SqlServerConnectionString: Server=tcp:localhost,${{ job.services.sqlserver.ports[1433] }};Database=tempdb;User Id=sa;Password=Password.;
52+
- name: Dapper.Contrib Tests
53+
run: dotnet test tests/Dapper.Tests.Contrib/Dapper.Tests.Contrib.csproj -c Release --logger GitHubActions /p:CI=true
54+
env:
55+
MySqlConnectionString: Server=localhost;Port=${{ job.services.mysql.ports[3306] }};Uid=root;Pwd=root;Database=test;Allow User Variables=true
56+
OLEDBConnectionString: Provider=SQLOLEDB;Server=tcp:localhost,${{ job.services.sqlserver.ports[1433] }};Database=tempdb;User Id=sa;Password=Password.;
57+
PostgesConnectionString: Server=localhost;Port=${{ job.services.postgres.ports[5432] }};Database=test;User Id=postgres;Password=postgres;
58+
SqlServerConnectionString: Server=tcp:localhost,${{ job.services.sqlserver.ports[1433] }};Database=tempdb;User Id=sa;Password=Password.;
59+
- name: .NET Lib Pack
60+
run: dotnet pack Build.csproj --no-build -c Release /p:PackageOutputPath=%CD%\.nupkgs /p:CI=true

tests/Dapper.Tests/QueryMultipleTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ private void TestMultiSelectWithSomeEmptyGrids(bool buffered)
236236
}
237237
catch (ObjectDisposedException ex)
238238
{ // expected; success
239-
Assert.Equal("The reader has been disposed; this can happen after all data has been consumed\r\nObject name: 'Dapper.SqlMapper+GridReader'.", ex.Message);
239+
Assert.Equal("The reader has been disposed; this can happen after all data has been consumed\r\nObject name: 'Dapper.SqlMapper+GridReader'.", ex.Message, ignoreLineEndingDifferences: true);
240240
}
241241

242242
Assert.Single(one);

tests/Directory.Build.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<GenerateDocumentationFile>false</GenerateDocumentationFile>
77
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
88
<IsPackable>false</IsPackable>
9+
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
910

1011
<DebugType>Full</DebugType>
1112
<DefineConstants Condition="'$(OS)' == 'Windows_NT'">$(DefineConstants);WINDOWS</DefineConstants>
@@ -14,6 +15,7 @@
1415
<ItemGroup>
1516
<ProjectReference Include="../../Dapper/Dapper.csproj" />
1617
<ProjectReference Include="../../Dapper.Contrib/Dapper.Contrib.csproj" />
18+
<PackageReference Include="GitHubActionsTestLogger" Version="1.1.0" />
1719
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
1820
<PackageReference Include="xunit" Version="2.4.1" />
1921
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />

tests/docker-compose.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
version: "3"
2+
services:
3+
mysql:
4+
image: mysql:8
5+
container_name: mysql
6+
ports:
7+
- 3306:3306
8+
environment:
9+
MYSQL_ROOT_PASSWORD: root
10+
MYSQL_DATABASE: test
11+
postgres:
12+
image: postgres:alpine
13+
container_name: postgres
14+
ports:
15+
- 5432:5432
16+
environment:
17+
POSTGRES_USER: postgres
18+
POSTGRES_PASSWORD: postgres
19+
POSTGRES_DB: test
20+
sqlserver:
21+
image: mcr.microsoft.com/mssql/server:2019-latest
22+
container_name: sql-server-db
23+
ports:
24+
- 1433:1433
25+
environment:
26+
ACCEPT_EULA: Y
27+
SA_PASSWORD: "Password."

0 commit comments

Comments
 (0)