diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c9d20b --- /dev/null +++ b/.gitignore @@ -0,0 +1,193 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Xamarin Studio / monodevelop user-specific +*.userprefs +*.dll.mdb +*.exe.mdb + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +build/ +[Bb]in/ +[Oo]bj/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Other Visual Studio data +.vs/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml + +# Enable nuget.exe in the .nuget folder (though normally executables are not tracked) +!.nuget/NuGet.exe + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# VSCode +.vscode/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + + +#LightSwitch generated files +GeneratedArtifacts/ +_Pvt_Extensions/ +ModelManifest.xml + +# ========================= +# Windows detritus +# ========================= + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac desktop service store files +.DS_Store + +# =================================================== +# Exclude F# project specific directories and files +# =================================================== + +# NuGet Packages Directory +packages/ + +# Test results produced by build +TestResults.xml + +# Nuget outputs +nuget/*.nupkg +release.cmd +release.sh +localpackages/ +paket-files +*.orig +docsrc/content/license.md +docsrc/content/release-notes.md +.fake +.idea +docsrc/tools/FSharp.Formatting.svclog +artifacts +/artifacts +/artifacts + +.ionide +AssemblyInfo.cs +launchSettings.json diff --git a/src/CodeCoverageExtractor.csproj b/src/CodeCoverageExtractor.csproj new file mode 100644 index 0000000..68a9bb0 --- /dev/null +++ b/src/CodeCoverageExtractor.csproj @@ -0,0 +1,19 @@ + + + + Exe + net8.0 + enable + enable + + true + codecoverageextractor2 + ./nupkg + true + codecoverageextractor2 + Monster1025 + admin@yandex5.ru + Code Coverage Extractor + + + diff --git a/src/Program.cs b/src/Program.cs new file mode 100644 index 0000000..63e182a --- /dev/null +++ b/src/Program.cs @@ -0,0 +1,28 @@ +using System.Xml; + +try +{ + if (!args.Any()) + { + Console.WriteLine("No file specified"); + return; + } + + XmlDocument doc = new XmlDocument(); + doc.Load(args[0]); + + var coverage = doc.SelectSingleNode("/coverage/@line-rate")!.Value; + if (decimal.TryParse(coverage, out var dCoverage)) + { + var format = args.Length > 1 ? args[1] : "total_coverage={0}"; + Console.WriteLine(string.Format(format, dCoverage * 100)); + } + else + { + Console.WriteLine("Value could not be extracted"); + } +} +catch (Exception ex) +{ + Console.WriteLine($"An error occurred: {ex.Message}"); +} \ No newline at end of file diff --git a/src/nupkg/codecoverageextractor.1.0.0.nupkg b/src/nupkg/codecoverageextractor.1.0.0.nupkg new file mode 100644 index 0000000..5c5a276 Binary files /dev/null and b/src/nupkg/codecoverageextractor.1.0.0.nupkg differ diff --git a/src/nupkg/codecoverageextractor2.1.0.0.nupkg b/src/nupkg/codecoverageextractor2.1.0.0.nupkg new file mode 100644 index 0000000..51b7c75 Binary files /dev/null and b/src/nupkg/codecoverageextractor2.1.0.0.nupkg differ