From 4ef3e059bcfee4c7229aa87526d0268606dce764 Mon Sep 17 00:00:00 2001 From: Nano Taboada <87288+nanotaboada@users.noreply.github.com> Date: Mon, 7 Apr 2025 22:36:10 -0300 Subject: [PATCH 1/3] chore(test): initial .runsettings file --- .github/workflows/dotnet.yml | 2 +- .runsettings | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .runsettings diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 6e09025..c9c1764 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -46,7 +46,7 @@ jobs: uses: actions/checkout@v4 - name: Run tests and generate Cobertura coverage reports - run: dotnet test --results-directory "coverage" --collect:"Code Coverage;Format=cobertura" + run: dotnet test --results-directory "coverage" --collect:"Code Coverage;Format=cobertura" --settings .runsettings - name: Install dotnet-coverage tool run: dotnet tool install --global dotnet-coverage diff --git a/.runsettings b/.runsettings new file mode 100644 index 0000000..1b3097a --- /dev/null +++ b/.runsettings @@ -0,0 +1,19 @@ + + + + + + + + + + + .*\.Tests\.dll$ + + + + + + + + From 714c0e8356874d5468666d521f2a70b4ddff75a9 Mon Sep 17 00:00:00 2001 From: Nano Taboada <87288+nanotaboada@users.noreply.github.com> Date: Mon, 7 Apr 2025 22:36:32 -0300 Subject: [PATCH 2/3] chore(ci): adjust Codecov YAML --- codecov.yml | 97 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 42 deletions(-) diff --git a/codecov.yml b/codecov.yml index 241f628..35c64aa 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,52 +1,65 @@ +# Codecov repository YAML # https://docs.codecov.com/docs/codecov-yaml - coverage: # https://docs.codecov.com/docs/commit-status status: + project: default: - target: 80% # Default target for all components - threshold: 10% # Allowable drop in coverage without failing - if_not_found: success # If no coverage report is found, don't fail - if_ci_failed: error # CI failure should fail coverage check - - # Components for focused coverage metrics - controllers: - paths: - - "Dotnet.Samples.AspNetCore.WebApi/Controllers/" - services: - paths: - - "Dotnet.Samples.AspNetCore.WebApi/Services/" - - patch: - default: - target: 80% # Target for changed lines - threshold: 10% + target: 80% # Default target for all components + threshold: 10% # Allowable drop in coverage without failing + if_not_found: success # If no coverage report is found, don't fail + if_ci_failed: error # CI failure should fail coverage check + + patch: + default: + target: 80% # Target for changed lines + threshold: 10% # Allowable drop in coverage without failing + +component_management: + + default_rules: # default rules that will be inherited by all components + statuses: + - type: project # components that don't have a status defined will have a project type one + target: auto + branches: + - "!main" + + individual_components: + - component_id: controllers # this is an identifier that should not be changed + name: Controllers # this is a display name, and can be changed freely + paths: + - 'src/Dotnet.Samples.AspNetCore.WebApi/Controllers/' + - component_id: services + name: Services + paths: + - 'src/Dotnet.Samples.AspNetCore.WebApi/Services/' + +comment: + layout: "header, diff, flags, components" # https://docs.codecov.com/docs/ignoring-paths ignore: - # Ignore common project metadata and config files - - '.*\.sln' # Solution files - - '.*\.csproj' # C# project files - - '.*\.json' # JSON config files (e.g., appsettings) - - '.*\.yml' # YAML config files (e.g., pipelines) - - '.*\.png' # Image assets (e.g., Swagger diagram) - - # Ignore test project entirely - - '.*\/test\/.*' # Any file in the test folder (unit/integration/utils) - - # Ignore infrastructure and support folders anywhere in the project - - '.*\/Data\/.*' # Repositories, DbContext, database files - - '.*\/Enums\/.*' # Enums like Position - - '.*\/Mappings\/.*' # AutoMapper profiles - - '.*\/Migrations\/.*' # EF Core migration artifacts - - '.*\/Models\/.*' # Domain and DTO models - - '.*\/Properties\/.*' # launchSettings.json or other system files - - '.*\/Utilities\/.*' # Static helper and extension classes - - # Ignore application entry point and documentation files - - '.*\/Program\.cs' # ASP.NET Core entry point - - '.*\/\.gitignore' # Git ignore file - - '.*\/LICENSE' # License text - - '.*\/README\.md' # Project readme + # Ignoring specific file yypes + - '**/*.sln' # Solution files + - '**/*.csproj' # C# project files + - '**/*.json' # JSON config files (e.g., appsettings) + - '**/*.yml' # YAML config files (e.g., pipelines) + - '**/*.png' # Image assets (e.g., Swagger diagram) + + # Ignoring a specific folder + - 'src/**/Data/**/*' # Repositories, DbContext, database files + - 'src/**/Enums/**/*' # Enums like Position + - 'src/**/Mappings/**/*' # AutoMapper profiles + - 'src/**/Migrations/**/*' # EF Core migration artifacts + - 'src/**/Models/**/*' # Domain and DTO models + - 'src/**/Properties/**/*' # launchSettings.json or other system files + - 'src/**/Utilities/**/*' # Static helper and extension classes + - 'test' # Any file in the test folder (unit/integration/utils) + + # Ignoring Specific Files At All Depths + - '**/Program.cs' # ASP.NET Core entry point + - '**/.gitignore' # Git ignore file + - '**/LICENSE' # License text + - '**/README.md' # Project readme From b47e6f921ad6cb772db3c28b51dcde8ba7297a5b Mon Sep 17 00:00:00 2001 From: Nano Taboada <87288+nanotaboada@users.noreply.github.com> Date: Mon, 7 Apr 2025 23:03:52 -0300 Subject: [PATCH 3/3] chore(ci): adjust glob for test folder on Codacy config --- .codacy.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.codacy.yml b/.codacy.yml index e37cf79..578b9d3 100644 --- a/.codacy.yml +++ b/.codacy.yml @@ -1,10 +1,12 @@ # Codacy configuration for excluding files and folders from analysis # https://docs.codacy.com/repositories-configure/codacy-configuration-file/#ignore-files -# Uses Java GLOB syntax: https://docs.oracle.com/javase/tutorial/essential/io/fileOps.html#glob +# Uses Java glob syntax: https://docs.oracle.com/javase/tutorial/essential/io/fileOps.html#glob exclude_paths: - # Ignore all project-level metadata and documentation + + # Ignore all root-level metadata and documentation - '.gitignore' # root Git ignore file + - '.runsettings' # root runsettings file - 'LICENSE' # root license file - 'README.md' # root readme @@ -26,4 +28,4 @@ exclude_paths: - '**/Models/**' # Domain and DTO models - '**/Properties/**' # launchSettings.json or AssemblyInfo.cs - '**/Utilities/**' # Helper extensions or static classes - - '**/test/**' # Entire test suite (unit + integration) + - 'test/**/*' # Entire test suite (unit + integration)