Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scripts for test and coverage reports. #351

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.vs/
.git/
.git/
**/TestResults
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ indent_style = space
# Standard properties
end_of_line = crlf

# bash scripts
[*.{sh,bash}]
end_of_line = lf

# XML project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2
Expand Down
5 changes: 3 additions & 2 deletions Ardalis.Specification.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docker", "Docker", "{A74A4C
.dockerignore = .dockerignore
docker-compose.yml = docker-compose.yml
Dockerfile = Dockerfile
RunTests.bat = RunTests.bat
RunTests.sh = RunTests.sh
run-tests-docker.bat = run-tests-docker.bat
run-tests-docker.sh = run-tests-docker.sh
run-tests.sh = run-tests.sh
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Solution Items", "_Solution Items", "{C443291A-7311-455F-9AC6-995EB29DD6D2}"
Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /

COPY . ./

ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.8.0/wait /wait
#RUN chmod +x /wait
RUN /bin/bash -c 'ls -la /wait; chmod +x /wait; ls -la /wait'

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

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
CMD /wait && \
dotnet build ci.slnf --configuration release && \
dotnet test -f net7.0 ci.slnf --configuration release --no-build --no-restore --collect:"xplat code coverage" && \
tools/reportgenerator -reports:Specification*/**/coverage.cobertura.xml -targetdir:/var/temp/TestResults -assemblyfilters:"-*Tests*;"
1 change: 0 additions & 1 deletion GetCoverage.sh

This file was deleted.

2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
environment:
WAIT_HOSTS: databaseEF:1433
volumes:
- ./TestResults:/var/temp
- ./TestResults:/var/temp/TestResults
depends_on:
- databaseEF

Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions RunTests.sh → run-tests-docker.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/bin/bash
docker-compose build
docker-compose up --abort-on-container-exit
13 changes: 13 additions & 0 deletions run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

find . -type d -name TestResults -exec rm -rf {} \; > /dev/null 2>&1

testtarget="$1"

if [ "$testtarget" = "" ]; then
testtarget="ci.slnf"
fi

dotnet build "$testtarget" --configuration release
dotnet test "$testtarget" --configuration release --no-build --no-restore --collect:"xplat code coverage"
reportgenerator -reports:Specification*/**/coverage.cobertura.xml -targetdir:TestResults -assemblyfilters:"-*Tests*;"