Skip to content

Commit 9f40a1c

Browse files
authored
Added and updated scripts for test and coverage reports. (#351)
1 parent aeb9467 commit 9f40a1c

File tree

9 files changed

+29
-7
lines changed

9 files changed

+29
-7
lines changed

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.vs/
2-
.git/
2+
.git/
3+
**/TestResults

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ indent_style = space
99
# Standard properties
1010
end_of_line = crlf
1111

12+
# bash scripts
13+
[*.{sh,bash}]
14+
end_of_line = lf
15+
1216
# XML project files
1317
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
1418
indent_size = 2

Ardalis.Specification.sln

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docker", "Docker", "{A74A4C
1616
.dockerignore = .dockerignore
1717
docker-compose.yml = docker-compose.yml
1818
Dockerfile = Dockerfile
19-
RunTests.bat = RunTests.bat
20-
RunTests.sh = RunTests.sh
19+
run-tests-docker.bat = run-tests-docker.bat
20+
run-tests-docker.sh = run-tests-docker.sh
21+
run-tests.sh = run-tests.sh
2122
EndProjectSection
2223
EndProject
2324
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Solution Items", "_Solution Items", "{C443291A-7311-455F-9AC6-995EB29DD6D2}"

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
22
WORKDIR /
33

44
COPY . ./
5+
56
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.8.0/wait /wait
6-
#RUN chmod +x /wait
77
RUN /bin/bash -c 'ls -la /wait; chmod +x /wait; ls -la /wait'
88

99
# install the report generator tool
1010
RUN dotnet tool install dotnet-reportgenerator-globaltool --version 5.1.23 --tool-path /tools
1111

12-
CMD /wait && dotnet test -f net7.0 Specification/tests/Ardalis.Specification.UnitTests/Ardalis.Specification.UnitTests.csproj --collect:"XPlat Code Coverage" && dotnet test -f net7.0 Specification.EntityFrameworkCore/tests/Ardalis.Specification.EntityFrameworkCore.IntegrationTests/Ardalis.Specification.EntityFrameworkCore.IntegrationTests.csproj --collect:"XPlat Code Coverage" && tools/reportgenerator -reports:Specification*/**/coverage.cobertura.xml -targetdir:/var/temp/coverage -reporttypes:HtmlInline_AzurePipelines\;HTMLChart\;Cobertura
12+
CMD /wait && \
13+
dotnet build ci.slnf --configuration release && \
14+
dotnet test -f net7.0 ci.slnf --configuration release --no-build --no-restore --collect:"xplat code coverage" && \
15+
tools/reportgenerator -reports:Specification*/**/coverage.cobertura.xml -targetdir:/var/temp/TestResults -assemblyfilters:"-*Tests*;"

GetCoverage.sh

Lines changed: 0 additions & 1 deletion
This file was deleted.

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ services:
88
environment:
99
WAIT_HOSTS: databaseEF:1433
1010
volumes:
11-
- ./TestResults:/var/temp
11+
- ./TestResults:/var/temp/TestResults
1212
depends_on:
1313
- databaseEF
1414

File renamed without changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
#!/bin/bash
12
docker-compose build
23
docker-compose up --abort-on-container-exit

run-tests.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
find . -type d -name TestResults -exec rm -rf {} \; > /dev/null 2>&1
4+
5+
testtarget="$1"
6+
7+
if [ "$testtarget" = "" ]; then
8+
testtarget="ci.slnf"
9+
fi
10+
11+
dotnet build "$testtarget" --configuration release
12+
dotnet test "$testtarget" --configuration release --no-build --no-restore --collect:"xplat code coverage"
13+
reportgenerator -reports:Specification*/**/coverage.cobertura.xml -targetdir:TestResults -assemblyfilters:"-*Tests*;"

0 commit comments

Comments
 (0)