Skip to content

Commit 242e17e

Browse files
authored
chore: add GitHub action to run tests (#13)
1 parent 797afdb commit 242e17e

File tree

7 files changed

+54
-10
lines changed

7 files changed

+54
-10
lines changed

.github/workflows/dotnet.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: .NET
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
8+
runs-on: ubuntu-latest
9+
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
include:
14+
- DB: SqlServer
15+
CONNECTION_STRING: "Server=localhost;User Id=sa;Password=P@ssw0rd;packet size=4096;"
16+
17+
name: ${{matrix.DB}}
18+
19+
steps:
20+
- name: Set up SqlServer
21+
if: matrix.DB == 'SqlServer'
22+
run: |
23+
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=P@ssw0rd" -e "MSSQL_PID=Express" -p 1433:1433 -d --name sqlexpress mcr.microsoft.com/mssql/server:2019-latest;
24+
25+
- uses: actions/checkout@v3
26+
27+
- name: Setup .NET
28+
uses: actions/setup-dotnet@v3
29+
with:
30+
dotnet-version: 6.0.x
31+
32+
- name: Restore dependencies
33+
run: dotnet restore src/NHibernate.Search.sln
34+
35+
- name: Build
36+
run: dotnet build src/NHibernate.Search.sln --no-restore
37+
38+
- name: Configure
39+
run: |
40+
sudo apt-get install xmlstarlet -yy
41+
cp build-common/teamcity-hibernate.cfg.xml ./hibernate.cfg.xml
42+
xmlstarlet ed -L -N ns="urn:nhibernate-configuration-2.2" -u '//ns:property[@name="connection.connection_string"]' -v '${{matrix.CONNECTION_STRING}}' hibernate.cfg.xml
43+
44+
- name: Test
45+
run: dotnet test src/NHibernate.Search.sln -f net6.0 --no-build --verbosity normal

build-common/teamcity-hibernate.cfg.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
<property name="prepare_sql">false</property>
1616
<property name="cache.provider_class">NHibernate.Cache.HashtableCacheProvider, NHibernate</property>
1717
<property name="cache.use_query_cache">true</property>
18-
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
1918

2019
<!-- the following part is not read by the test, they are here being a template-->
2120
<listener class='NHibernate.Search.Event.FullTextIndexEventListener, NHibernate.Search' type='post-insert'/>

src/NHibernate.Search.Tests/Async/Shards/ShardsTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public async Task InternalShardingAsync()
106106
await (tx.CommitAsync());
107107

108108
s.Clear();
109-
DirectoryReader reader = DirectoryReader.Open(FSDirectory.Open(new DirectoryInfo(BaseIndexDir.FullName + "\\Animal00")));
109+
DirectoryReader reader = DirectoryReader.Open(FSDirectory.Open(new DirectoryInfo(Path.Combine(BaseIndexDir.FullName, "Animal00"))));
110110
try
111111
{
112112
int num = reader.NumDocs;
@@ -117,7 +117,7 @@ public async Task InternalShardingAsync()
117117
reader.Dispose();
118118
}
119119

120-
reader = DirectoryReader.Open(FSDirectory.Open(new DirectoryInfo(BaseIndexDir.FullName + "\\Animal.1")));
120+
reader = DirectoryReader.Open(FSDirectory.Open(new DirectoryInfo(Path.Combine(BaseIndexDir.FullName, "Animal.1"))));
121121
try
122122
{
123123
int num = reader.NumDocs;
@@ -135,7 +135,7 @@ public async Task InternalShardingAsync()
135135

136136
s.Clear();
137137

138-
reader = DirectoryReader.Open(FSDirectory.Open(new DirectoryInfo(BaseIndexDir.FullName + "\\Animal.1")));
138+
reader = DirectoryReader.Open(FSDirectory.Open(new DirectoryInfo(Path.Combine(BaseIndexDir.FullName, "Animal.1"))));
139139
try
140140
{
141141
int num = reader.NumDocs;

src/NHibernate.Search.Tests/Async/Util/FileHelperTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ private FileInfo CreateFile(string directory, string name, bool write)
8888
di.Create();
8989
}
9090

91-
string fileName = di.FullName + "\\" + name;
91+
string fileName = Path.Combine(di.FullName, name);
9292
StreamWriter sw = File.CreateText(fileName);
9393
try
9494
{

src/NHibernate.Search.Tests/PhysicalTestCase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ protected FileInfo BaseIndexDir
1414
get
1515
{
1616
FileInfo current = new FileInfo(".");
17-
FileInfo sub = new FileInfo(current.FullName + "\\indextemp");
17+
FileInfo sub = new FileInfo(Path.Combine(current.FullName, "indextemp"));
1818
return sub;
1919
}
2020
}

src/NHibernate.Search.Tests/Shards/ShardsTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public void InternalSharding()
105105
tx.Commit();
106106

107107
s.Clear();
108-
DirectoryReader reader = DirectoryReader.Open(FSDirectory.Open(new DirectoryInfo(BaseIndexDir.FullName + "\\Animal00")));
108+
DirectoryReader reader = DirectoryReader.Open(FSDirectory.Open(new DirectoryInfo(Path.Combine(BaseIndexDir.FullName, "Animal00"))));
109109
try
110110
{
111111
int num = reader.NumDocs;
@@ -116,7 +116,7 @@ public void InternalSharding()
116116
reader.Dispose();
117117
}
118118

119-
reader = DirectoryReader.Open(FSDirectory.Open(new DirectoryInfo(BaseIndexDir.FullName + "\\Animal.1")));
119+
reader = DirectoryReader.Open(FSDirectory.Open(new DirectoryInfo(Path.Combine(BaseIndexDir.FullName, "Animal.1"))));
120120
try
121121
{
122122
int num = reader.NumDocs;
@@ -134,7 +134,7 @@ public void InternalSharding()
134134

135135
s.Clear();
136136

137-
reader = DirectoryReader.Open(FSDirectory.Open(new DirectoryInfo(BaseIndexDir.FullName + "\\Animal.1")));
137+
reader = DirectoryReader.Open(FSDirectory.Open(new DirectoryInfo(Path.Combine(BaseIndexDir.FullName, "Animal.1"))));
138138
try
139139
{
140140
int num = reader.NumDocs;

src/NHibernate.Search.Tests/Util/FileHelperTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private FileInfo CreateFile(string directory, string name, bool write)
7777
di.Create();
7878
}
7979

80-
string fileName = di.FullName + "\\" + name;
80+
string fileName = Path.Combine(di.FullName, name);
8181
StreamWriter sw = File.CreateText(fileName);
8282
try
8383
{

0 commit comments

Comments
 (0)