From 98de0bbbe1038f4716af432afd6f2e3926d420d8 Mon Sep 17 00:00:00 2001 From: Rolf Kristensen Date: Tue, 2 Aug 2022 20:47:55 +0200 Subject: [PATCH] dotnet list package --vulnerable --include-transitive --- NLog.Extensions.Logging.sln | 1 + appveyor.yml | 4 ++-- run-tests.ps1 | 9 ++++++++- .../NLog.Extensions.Hosting.Tests.csproj | 7 ++++--- .../NLog.Extensions.Logging.Tests.csproj | 9 +++++---- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/NLog.Extensions.Logging.sln b/NLog.Extensions.Logging.sln index ecb4856c..8f24cb06 100644 --- a/NLog.Extensions.Logging.sln +++ b/NLog.Extensions.Logging.sln @@ -10,6 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution build.ps1 = build.ps1 CHANGELOG.MD = CHANGELOG.MD README.md = README.md + run-tests.ps1 = run-tests.ps1 EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NLog.Extensions.Logging", "src\NLog.Extensions.Logging\NLog.Extensions.Logging.csproj", "{6A236D76-C9D9-4B1D-8DDE-F6978D110288}" diff --git a/appveyor.yml b/appveyor.yml index afec3fa6..820200c2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -21,10 +21,10 @@ artifacts: test_script: - nuget.exe install OpenCover -ExcludeVersion -DependencyVersion Ignore - - OpenCover\tools\OpenCover.Console.exe -register:user -target:"C:/Program Files/dotnet/dotnet.exe" -targetargs:"test -f netcoreapp2.1 -c debug NLog.Extensions.Logging.Tests" -filter:"+[NLog.Extensions.Logging]* +[NLog.Extensions.Hosting]* -[NLog.Extensions.Logging.Tests]* -[NLog.Extensions.Hosting.Tests]*" -output:"coverage.xml" -oldstyle -targetdir:"test" + - OpenCover\tools\OpenCover.Console.exe -register:user -target:"C:/Program Files/dotnet/dotnet.exe" -targetargs:"test -f net461 -c debug NLog.Extensions.Logging.Tests" -filter:"+[NLog.Extensions.Logging]* +[NLog.Extensions.Hosting]* -[NLog.Extensions.Logging.Tests]* -[NLog.Extensions.Hosting.Tests]*" -output:"coverage.xml" -oldstyle -targetdir:"test" - OpenCover\tools\OpenCover.Console.exe -register:user -mergeoutput -target:"C:/Program Files/dotnet/dotnet.exe" -targetargs:"test -f netcoreapp3.1 -c debug NLog.Extensions.Logging.Tests" -filter:"+[NLog.Extensions.Logging]* -[NLog.Extensions.Logging.Tests]*" -output:"coverage.xml" -oldstyle -targetdir:"test" - OpenCover\tools\OpenCover.Console.exe -register:user -mergeoutput -target:"C:/Program Files/dotnet/dotnet.exe" -targetargs:"test -f net5.0 -c debug NLog.Extensions.Logging.Tests" -filter:"+[NLog.Extensions.Logging]* -[NLog.Extensions.Logging.Tests]*" -output:"coverage.xml" -oldstyle -targetdir:"test" - - OpenCover\tools\OpenCover.Console.exe -register:user -mergeoutput -target:"C:/Program Files/dotnet/dotnet.exe" -targetargs:"test -f netcoreapp2.1 -c debug NLog.Extensions.Hosting.Tests" -filter:"+[NLog.Extensions.Logging]* +[NLog.Extensions.Hosting]* -[NLog.Extensions.Logging.Tests]* -[NLog.Extensions.Hosting.Tests]*" -output:"coverage.xml" -oldstyle -targetdir:"test" + - OpenCover\tools\OpenCover.Console.exe -register:user -mergeoutput -target:"C:/Program Files/dotnet/dotnet.exe" -targetargs:"test -f net461 -c debug NLog.Extensions.Hosting.Tests" -filter:"+[NLog.Extensions.Logging]* +[NLog.Extensions.Hosting]* -[NLog.Extensions.Logging.Tests]* -[NLog.Extensions.Hosting.Tests]*" -output:"coverage.xml" -oldstyle -targetdir:"test" - OpenCover\tools\OpenCover.Console.exe -register:user -mergeoutput -target:"C:/Program Files/dotnet/dotnet.exe" -targetargs:"test -f netcoreapp3.1 -c debug NLog.Extensions.Hosting.Tests" -filter:"+[NLog.Extensions.Logging]* +[NLog.Extensions.Hosting]* -[NLog.Extensions.Logging.Tests]* -[NLog.Extensions.Hosting.Tests]*" -output:"coverage.xml" -oldstyle -targetdir:"test" - OpenCover\tools\OpenCover.Console.exe -register:user -mergeoutput -target:"C:/Program Files/dotnet/dotnet.exe" -targetargs:"test -f net5.0 -c debug NLog.Extensions.Hosting.Tests" -filter:"+[NLog.Extensions.Logging]* +[NLog.Extensions.Hosting]* -[NLog.Extensions.Logging.Tests]* -[NLog.Extensions.Hosting.Tests]*" -output:"coverage.xml" -oldstyle -targetdir:"test" - pip install codecov diff --git a/run-tests.ps1 b/run-tests.ps1 index b2e7586e..76fbdffc 100644 --- a/run-tests.ps1 +++ b/run-tests.ps1 @@ -1,5 +1,6 @@ dotnet restore test/NLog.Extensions.Logging.Tests -v minimal dotnet restore test/NLog.Extensions.Hosting.Tests -v minimal + dotnet build test/NLog.Extensions.Logging.Tests --configuration release -v minimal if (-Not $LastExitCode -eq 0) { exit $LastExitCode } @@ -16,4 +17,10 @@ dotnet test test/NLog.Extensions.Hosting.Tests --configuration release if (-Not $LastExitCode -eq 0) { exit $LastExitCode } -exit $LastExitCode \ No newline at end of file +dotnet restore +dotnet list ./ package --vulnerable --include-transitive | findstr /S /c:"has the following vulnerable packages" +if (-Not $LastExitCode -eq 1) +{ + dotnet list ./ package --vulnerable --include-transitive + exit 1 +} \ No newline at end of file diff --git a/test/NLog.Extensions.Hosting.Tests/NLog.Extensions.Hosting.Tests.csproj b/test/NLog.Extensions.Hosting.Tests/NLog.Extensions.Hosting.Tests.csproj index e6af92fd..becbb812 100644 --- a/test/NLog.Extensions.Hosting.Tests/NLog.Extensions.Hosting.Tests.csproj +++ b/test/NLog.Extensions.Hosting.Tests/NLog.Extensions.Hosting.Tests.csproj @@ -15,7 +15,7 @@ - + @@ -23,12 +23,13 @@ - + - + + diff --git a/test/NLog.Extensions.Logging.Tests/NLog.Extensions.Logging.Tests.csproj b/test/NLog.Extensions.Logging.Tests/NLog.Extensions.Logging.Tests.csproj index 4c219498..5f701b81 100644 --- a/test/NLog.Extensions.Logging.Tests/NLog.Extensions.Logging.Tests.csproj +++ b/test/NLog.Extensions.Logging.Tests/NLog.Extensions.Logging.Tests.csproj @@ -16,12 +16,13 @@ - - + + + @@ -30,8 +31,8 @@ - - + +