Skip to content
25 changes: 17 additions & 8 deletions test-dotnet/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,25 @@ runs:
aws-secret-access-key: ${{inputs.awsAccessKeySecret}}
aws-region: ${{inputs.awsRegion}}

# GitHubActionsTestLogger nuget package should be installed in the test project
# coverlet.msbuild nuget package should be installed to generate coverage report
# GitHubActionsTestLogger nuget package should be installed in the test project.
# coverlet.msbuild nuget package should be installed to generate coverage report.
# The loop is necessary to prevent the following error:
# "Could not find a test logger with AssemblyQualifiedName, URI or FriendlyName 'GitHubActions'."
- name: .NET Test
shell: bash
run: dotnet test
--no-restore
--configuration Debug
--logger GitHubActions
--collect "XPlat Code Coverage"
--results-directory "TestResults/"
run: |
for f in $(find . -name "*.Tests.csproj");
do
echo "testing project $f" && \
csprojName=${f##*/} && \
projectName="${csprojName/.csproj/}" && \
dotnet test $f \
--no-restore \
--configuration Debug \
--logger GitHubActions \
--collect "XPlat Code Coverage" \
--results-directory "TestResults/$projectName"
done

# .NET Test puts the coverage file under a random directory [Guid]/coverage.cobertura.xml
# That's why we locate the coverage file first and pass it to the upload script
Expand Down